Skip to content

Commit

Permalink
Merge pull request #106 from melissalinkert/progressbar-fix
Browse files Browse the repository at this point in the history
Fix progress bars for multiple planes
  • Loading branch information
sbesson authored Jul 19, 2023
2 parents 7baf577 + 9e9ab1e commit 6310b01
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1151,8 +1151,6 @@ public void convertToPyramid()
InterruptedException, DependencyException
{
for (PyramidSeries s : series) {
executor = new ThreadPoolExecutor(
maxWorkers, maxWorkers, 0L, TimeUnit.MILLISECONDS, tileQueue);
convertPyramid(s);
}
StopWatch t0 = new Slf4JStopWatch("writeIFDs");
Expand All @@ -1179,13 +1177,17 @@ private void convertPyramid(PyramidSeries s)

int rgbChannels = s.rgb ? 3 : 1;
int bytesPerPixel = FormatTools.getBytesPerPixel(s.pixelType);
try {
for (int resolution=0; resolution<s.numberOfResolutions; resolution++) {
for (int resolution=0; resolution<s.numberOfResolutions; resolution++) {
executor = new ThreadPoolExecutor(
maxWorkers, maxWorkers, 0L, TimeUnit.MILLISECONDS, tileQueue);

try {
LOG.info("Converting resolution #{}", resolution);
ResolutionDescriptor descriptor = s.resolutions.get(resolution);
int tileCount = descriptor.numberOfTilesY * descriptor.numberOfTilesX;
int totalTileCount = tileCount * s.planeCount;

getProgressListener().notifyResolutionStart(resolution, tileCount);
getProgressListener().notifyResolutionStart(resolution, totalTileCount);

int plane = 0;
for (int t=0; t<s.t; t++) {
Expand Down Expand Up @@ -1272,15 +1274,14 @@ private void convertPyramid(PyramidSeries s)
}
}
}

}
finally {
executor.shutdown();
executor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
getProgressListener().notifyResolutionEnd(resolution);
}
}
finally {
executor.shutdown();
executor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
getProgressListener().notifySeriesEnd(s.index);
}
getProgressListener().notifySeriesEnd(s.index);
}

private void writeIFDs() throws FormatException, IOException {
Expand Down

0 comments on commit 6310b01

Please sign in to comment.