Search in sources :

Example 1 with TiffSeriesVirtualStack

use of uk.ac.sussex.gdsc.smlm.ij.plugins.TiffSeriesViewer.TiffSeriesVirtualStack in project GDSC-SMLM by aherbert.

the class PeakResultTableModelFrame method doSourceShowImage.

private void doSourceShowImage() {
    final PeakResultTableModel model = getModel();
    if (model == null) {
        return;
    }
    final ImageSource source = model.getSource();
    if (source == null) {
        return;
    }
    // Check if already open
    final ImagePlus imp = WindowManager.getImage(source.getName());
    if (imp != null) {
        imp.getWindow().toFront();
        return;
    }
    // Check if an ImageJ image source
    if (source instanceof IJImageSource) {
        final IJImageSource imageSource = (IJImageSource) source;
        final String path = imageSource.getPath();
        if (path != null && new File(path).exists()) {
            IJ.showStatus("Opening image ...");
            IJ.open(path);
            IJ.showStatus("");
        } else {
            IJ.log("Cannot find the image source: " + path);
        }
        return;
    }
    // Open a SeriesImageSource.
    if (source instanceof SeriesImageSource) {
        final SeriesImageSource imageSource = (SeriesImageSource) source;
        // No memory buffer
        imageSource.setBufferLimit(0);
        imageSource.setReadHint(ReadHint.NONSEQUENTIAL);
        if (!source.open()) {
            IJ.log("Cannot open the series image source");
            return;
        }
        new TiffSeriesVirtualStack(imageSource).show();
    }
}
Also used : IJImageSource(uk.ac.sussex.gdsc.smlm.ij.IJImageSource) SeriesImageSource(uk.ac.sussex.gdsc.smlm.ij.SeriesImageSource) ImageSource(uk.ac.sussex.gdsc.smlm.results.ImageSource) IJImageSource(uk.ac.sussex.gdsc.smlm.ij.IJImageSource) SeriesImageSource(uk.ac.sussex.gdsc.smlm.ij.SeriesImageSource) ImagePlus(ij.ImagePlus) File(java.io.File) TiffSeriesVirtualStack(uk.ac.sussex.gdsc.smlm.ij.plugins.TiffSeriesViewer.TiffSeriesVirtualStack)

Aggregations

ImagePlus (ij.ImagePlus)1 File (java.io.File)1 IJImageSource (uk.ac.sussex.gdsc.smlm.ij.IJImageSource)1 SeriesImageSource (uk.ac.sussex.gdsc.smlm.ij.SeriesImageSource)1 TiffSeriesVirtualStack (uk.ac.sussex.gdsc.smlm.ij.plugins.TiffSeriesViewer.TiffSeriesVirtualStack)1 ImageSource (uk.ac.sussex.gdsc.smlm.results.ImageSource)1