use of loci.common.StatusEvent in project bioformats by openmicroscopy.
the class ImagePlusReader method finishTiming.
private void finishTiming() {
final ImageProcessorReader reader = process.getReader();
long endTime = System.currentTimeMillis();
double elapsed = (endTime - startTime) / 1000.0;
if (reader.getImageCount() == 1) {
notifyListeners(new StatusEvent("Bio-Formats: " + elapsed + " seconds"));
} else {
long average = (endTime - startTime) / reader.getImageCount();
notifyListeners(new StatusEvent("Bio-Formats: " + elapsed + " seconds (" + average + " ms per plane)"));
}
}
use of loci.common.StatusEvent in project bioformats by openmicroscopy.
the class ImagePlusReader method updateTiming.
private void updateTiming(int s, int i, int current, int total) {
final ImageProcessorReader reader = process.getReader();
long clock = System.currentTimeMillis();
if (clock - time >= 100) {
String sLabel = reader.getSeriesCount() > 1 ? ("series " + (s + 1) + ", ") : "";
String pLabel = "plane " + (i + 1) + "/" + total;
notifyListeners(new StatusEvent("Reading " + sLabel + pLabel));
time = clock;
}
notifyListeners(new StatusEvent(current, total, null));
}
use of loci.common.StatusEvent in project bioformats by openmicroscopy.
the class ImportProcess method step.
// -- Helper methods - miscellaneous --
private void step(ImportStep step) {
this.step = step;
notifyListeners(new StatusEvent(step.getStep(), ImportStep.COMPLETE.getStep(), step.getMessage()));
}
use of loci.common.StatusEvent in project bioformats by openmicroscopy.
the class ImagePlusReader method readImage.
private ImagePlus readImage(int s, boolean thumbnail) throws FormatException, IOException {
final ImporterOptions options = process.getOptions();
final int zCount = process.getZCount(s);
final int cCount = process.getCCount(s);
final int tCount = process.getTCount(s);
final List<LUT> luts = new ArrayList<LUT>();
// create image stack
final ImageStack stack;
if (options.isVirtual())
stack = createVirtualStack(process, s, luts);
else
stack = readPlanes(process, s, luts, thumbnail);
notifyListeners(new StatusEvent(1, 1, "Creating image"));
// create title
final String seriesName = process.getOMEMetadata().getImageName(s);
final String file = process.getCurrentFile();
final IFormatReader reader = process.getReader();
final String title = constructImageTitle(reader, file, seriesName, options.isGroupFiles());
// create image
final ImagePlus imp;
if (stack.isVirtual()) {
VirtualImagePlus vip = new VirtualImagePlus(title, stack);
vip.setReader(reader);
imp = vip;
saveLUTs(imp, luts);
} else
imp = createImage(title, stack, luts);
// if concatenating images only store metadata on first series
if (!options.isConcatenate() || s == 0) {
final String metadata = process.getOriginalMetadata().toString();
imp.setProperty("Info", metadata);
}
imp.setProperty(PROP_SERIES, s);
// retrieve the spatial calibration information, if available
final FileInfo fi = createFileInfo();
new Calibrator(process).applyCalibration(imp);
imp.setFileInfo(fi);
imp.setDimensions(cCount, zCount, tCount);
// open as a hyperstack, as appropriate
final boolean hyper = !options.isViewStandard();
imp.setOpenAsHyperStack(hyper);
return imp;
}
Aggregations