Search in sources :

Example 1 with StatusEvent

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)"));
    }
}
Also used : ImageProcessorReader(loci.plugins.util.ImageProcessorReader) StatusEvent(loci.common.StatusEvent)

Example 2 with StatusEvent

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));
}
Also used : ImageProcessorReader(loci.plugins.util.ImageProcessorReader) StatusEvent(loci.common.StatusEvent)

Example 3 with StatusEvent

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()));
}
Also used : StatusEvent(loci.common.StatusEvent)

Example 4 with StatusEvent

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;
}
Also used : IFormatReader(loci.formats.IFormatReader) ImageStack(ij.ImageStack) VirtualImagePlus(loci.plugins.util.VirtualImagePlus) ArrayList(java.util.ArrayList) LUT(ij.process.LUT) VirtualImagePlus(loci.plugins.util.VirtualImagePlus) ImagePlus(ij.ImagePlus) FileInfo(ij.io.FileInfo) StatusEvent(loci.common.StatusEvent)

Aggregations

StatusEvent (loci.common.StatusEvent)4 ImageProcessorReader (loci.plugins.util.ImageProcessorReader)2 ImagePlus (ij.ImagePlus)1 ImageStack (ij.ImageStack)1 FileInfo (ij.io.FileInfo)1 LUT (ij.process.LUT)1 ArrayList (java.util.ArrayList)1 IFormatReader (loci.formats.IFormatReader)1 VirtualImagePlus (loci.plugins.util.VirtualImagePlus)1