Search in sources :

Example 1 with ImportProcess

use of loci.plugins.in.ImportProcess in project bioformats by openmicroscopy.

the class BF method openImagePlus.

public static ImagePlus[] openImagePlus(ImporterOptions options) throws FormatException, IOException {
    ImportProcess process = new ImportProcess(options);
    if (!process.execute())
        return null;
    DisplayHandler displayHandler = new DisplayHandler(process);
    if (options != null && options.isShowOMEXML()) {
        displayHandler.displayOMEXML();
    }
    ImagePlusReader reader = new ImagePlusReader(process);
    ImagePlus[] imps = reader.openImagePlus();
    if (options != null && options.showROIs()) {
        displayHandler.displayROIs(imps);
    }
    if (!options.isVirtual()) {
        process.getReader().close();
    }
    return imps;
}
Also used : ImagePlusReader(loci.plugins.in.ImagePlusReader) DisplayHandler(loci.plugins.in.DisplayHandler) ImportProcess(loci.plugins.in.ImportProcess) ImagePlus(ij.ImagePlus)

Example 2 with ImportProcess

use of loci.plugins.in.ImportProcess in project bioformats by openmicroscopy.

the class LociFunctions method openThumbImage.

public void openThumbImage(String title, Double no) throws FormatException, IOException {
    ImporterOptions options = new ImporterOptions();
    options.setWindowless(true);
    options.setId(r.getCurrentFile());
    options.setCrop(true);
    options.setSpecifyRanges(true);
    options.setSeriesOn(r.getSeries(), true);
    int[] zct = r.getZCTCoords(no.intValue());
    options.setCBegin(r.getSeries(), zct[1]);
    options.setZBegin(r.getSeries(), zct[0]);
    options.setTBegin(r.getSeries(), zct[2]);
    options.setCEnd(r.getSeries(), zct[1]);
    options.setZEnd(r.getSeries(), zct[0]);
    options.setTEnd(r.getSeries(), zct[2]);
    ImportProcess process = new ImportProcess(options);
    process.execute();
    ImagePlusReader reader = new ImagePlusReader(process);
    final ImagePlus imp = reader.openThumbImagePlus()[0];
    Calibrator calibrator = new Calibrator(process);
    calibrator.applyCalibration(imp);
    process.getReader().close();
    imp.show();
}
Also used : ImporterOptions(loci.plugins.in.ImporterOptions) Calibrator(loci.plugins.in.Calibrator) ImagePlusReader(loci.plugins.in.ImagePlusReader) ImportProcess(loci.plugins.in.ImportProcess) ImagePlus(ij.ImagePlus)

Example 3 with ImportProcess

use of loci.plugins.in.ImportProcess in project bioformats by openmicroscopy.

the class LociFunctions method openSubImage.

public void openSubImage(String title, Double no, Double x, Double y, Double w, Double h) throws FormatException, IOException {
    ImporterOptions options = new ImporterOptions();
    options.setWindowless(true);
    options.setId(r.getCurrentFile());
    options.setCrop(true);
    options.setSpecifyRanges(true);
    options.setSeriesOn(r.getSeries(), true);
    int[] zct = r.getZCTCoords(no.intValue());
    options.setCBegin(r.getSeries(), zct[1]);
    options.setZBegin(r.getSeries(), zct[0]);
    options.setTBegin(r.getSeries(), zct[2]);
    options.setCEnd(r.getSeries(), zct[1]);
    options.setZEnd(r.getSeries(), zct[0]);
    options.setTEnd(r.getSeries(), zct[2]);
    Region region = new Region(x.intValue(), y.intValue(), w.intValue(), h.intValue());
    options.setCropRegion(r.getSeries(), region);
    ImportProcess process = new ImportProcess(options);
    process.execute();
    ImagePlusReader reader = new ImagePlusReader(process);
    final ImagePlus imp = reader.openImagePlus()[0];
    Calibrator calibrator = new Calibrator(process);
    calibrator.applyCalibration(imp);
    process.getReader().close();
    imp.show();
}
Also used : ImporterOptions(loci.plugins.in.ImporterOptions) Calibrator(loci.plugins.in.Calibrator) ImagePlusReader(loci.plugins.in.ImagePlusReader) ImportProcess(loci.plugins.in.ImportProcess) Region(loci.common.Region) ImagePlus(ij.ImagePlus)

Example 4 with ImportProcess

use of loci.plugins.in.ImportProcess in project bioformats by openmicroscopy.

the class BF method openThumbImagePlus.

public static ImagePlus[] openThumbImagePlus(ImporterOptions options) throws FormatException, IOException {
    // NB: Only needed due to ImporterPrompter.
    options.setQuiet(true);
    // NB: Only needed due to ImporterPrompter.
    options.setWindowless(true);
    ImportProcess process = new ImportProcess(options);
    // NB: Could eliminate this (see above).
    new ImporterPrompter(process);
    if (!process.execute())
        return null;
    ImagePlusReader reader = new ImagePlusReader(process);
    ImagePlus[] imps = reader.openThumbImagePlus();
    if (!options.isVirtual()) {
        process.getReader().close();
    }
    return imps;
}
Also used : ImagePlusReader(loci.plugins.in.ImagePlusReader) ImportProcess(loci.plugins.in.ImportProcess) ImporterPrompter(loci.plugins.in.ImporterPrompter) ImagePlus(ij.ImagePlus)

Aggregations

ImagePlus (ij.ImagePlus)4 ImagePlusReader (loci.plugins.in.ImagePlusReader)4 ImportProcess (loci.plugins.in.ImportProcess)4 Calibrator (loci.plugins.in.Calibrator)2 ImporterOptions (loci.plugins.in.ImporterOptions)2 Region (loci.common.Region)1 DisplayHandler (loci.plugins.in.DisplayHandler)1 ImporterPrompter (loci.plugins.in.ImporterPrompter)1