Search in sources :

Example 16 with ImagePlus

use of ij.ImagePlus in project GDSC-SMLM by aherbert.

the class ConfigurationTemplate method displayTemplate.

/**
	 * Display the template image in an image window with the specified title. If the window exists it will be reused
	 * and the appropriate properties updated.
	 *
	 * @param title
	 *            the title
	 * @param templateImp
	 *            the template image
	 * @return the image plus
	 */
public static ImagePlus displayTemplate(String title, ImagePlus templateImp) {
    ImagePlus imp = Utils.display(title, templateImp.getStack());
    imp.setOverlay(templateImp.getOverlay());
    imp.setProperty("Info", templateImp.getProperty("Info"));
    imp.setCalibration(templateImp.getCalibration());
    return imp;
}
Also used : ImagePlus(ij.ImagePlus)

Example 17 with ImagePlus

use of ij.ImagePlus in project GDSC-SMLM by aherbert.

the class BenchmarkFilterAnalysis method createBounds.

private synchronized int[] createBounds() {
    if (bounds == null) {
        ImagePlus imp = CreateData.getImage();
        if (imp != null) {
            return new int[] { imp.getWidth(), imp.getHeight() };
        }
        Rectangle bounds = results.getBounds(true);
        int maxx = bounds.x + bounds.width;
        int maxy = bounds.y + bounds.height;
        return new int[] { maxx, maxy };
    }
    return bounds;
}
Also used : Rectangle(java.awt.Rectangle) ImagePlus(ij.ImagePlus)

Example 18 with ImagePlus

use of ij.ImagePlus in project GDSC-SMLM by aherbert.

the class SeriesImageSource method getFrame.

/*
	 * (non-Javadoc)
	 * 
	 * @see gdsc.smlm.results.ImageSource#getFrame(int, java.awt.Rectangle)
	 */
@Override
protected float[] getFrame(int frame, Rectangle bounds) {
    if (maxz == 0 || frame < 1)
        return null;
    // Calculate the required image and slice
    int image = (frame - 1) / maxz;
    int slice = (frame - 1) % maxz;
    // Return from the cache if it exists
    if (image != lastImage || lastImageArray == null) {
        lastImageArray = null;
        lastImageSize = 0;
        if (image < images.size()) {
            ImagePlus imp = IJ.openImage(images.get(image++));
            if (imp != null) {
                lastImageArray = imp.getImageStack().getImageArray();
                lastImageSize = imp.getStackSize();
            }
        }
    }
    lastImage = image;
    if (lastImageArray != null) {
        if (slice < lastImageSize) {
            return ImageConverter.getData(lastImageArray[slice], width, height, bounds, null);
        }
    }
    return null;
}
Also used : ImagePlus(ij.ImagePlus)

Example 19 with ImagePlus

use of ij.ImagePlus in project GDSC-SMLM by aherbert.

the class PSFDrift method createImageList.

public static List<String> createImageList() {
    List<String> titles = new LinkedList<String>();
    int[] ids = WindowManager.getIDList();
    if (ids != null) {
        for (int id : ids) {
            ImagePlus imp = WindowManager.getImage(id);
            if (imp != null) {
                // Image must be greyscale
                if (imp.getType() == ImagePlus.GRAY8 || imp.getType() == ImagePlus.GRAY16 || imp.getType() == ImagePlus.GRAY32) {
                    // Image must be square and a stack of a single channel
                    if (imp.getWidth() == imp.getHeight() && imp.getNChannels() == 1) {
                        // Check if these are PSF images created by the SMLM plugins
                        PSFSettings psfSettings = getPSFSettings(imp);
                        if (psfSettings != null) {
                            if (psfSettings.zCentre <= 0) {
                                Utils.log(TITLE + ": Unknown PSF z-centre setting for image: " + imp.getTitle());
                                continue;
                            }
                            if (psfSettings.nmPerPixel <= 0) {
                                Utils.log(TITLE + ": Unknown PSF nm/pixel setting for image: " + imp.getTitle());
                                continue;
                            }
                            if (psfSettings.nmPerSlice <= 0) {
                                Utils.log(TITLE + ": Unknown PSF nm/slice setting for image: " + imp.getTitle());
                                continue;
                            }
                            if (psfSettings.fwhm <= 0) {
                                Utils.log(TITLE + ": Unknown PSF FWHM setting for image: " + imp.getTitle());
                                continue;
                            }
                            titles.add(imp.getTitle());
                        }
                    }
                }
            }
        }
    }
    return titles;
}
Also used : ImagePlus(ij.ImagePlus) PSFSettings(gdsc.smlm.ij.settings.PSFSettings) LinkedList(java.util.LinkedList)

Example 20 with ImagePlus

use of ij.ImagePlus in project GDSC-SMLM by aherbert.

the class PSFCombiner method createImageList.

public static List<String> createImageList() {
    List<String> titles = new LinkedList<String>();
    int[] ids = WindowManager.getIDList();
    if (ids != null) {
        for (int id : ids) {
            ImagePlus imp = WindowManager.getImage(id);
            if (imp != null) {
                // Image must be greyscale
                if (imp.getType() == ImagePlus.GRAY8 || imp.getType() == ImagePlus.GRAY16 || imp.getType() == ImagePlus.GRAY32) {
                    // Image must be square and a stack of a single channel
                    if (imp.getWidth() == imp.getHeight() && imp.getNChannels() == 1) {
                        // Check if these are PSF images created by the SMLM plugins
                        if (containsPSF(imp))
                            titles.add(imp.getTitle());
                    }
                }
            }
        }
    }
    return titles;
}
Also used : ImagePlus(ij.ImagePlus) LinkedList(java.util.LinkedList)

Aggregations

ImagePlus (ij.ImagePlus)66 ImageStack (ij.ImageStack)13 Rectangle (java.awt.Rectangle)13 MemoryPeakResults (gdsc.smlm.results.MemoryPeakResults)11 ExtendedGenericDialog (ij.gui.ExtendedGenericDialog)11 LinkedList (java.util.LinkedList)10 PeakResult (gdsc.smlm.results.PeakResult)9 Point (java.awt.Point)9 ImageProcessor (ij.process.ImageProcessor)8 ArrayList (java.util.ArrayList)7 Overlay (ij.gui.Overlay)6 PointRoi (ij.gui.PointRoi)6 IJImageSource (gdsc.smlm.ij.IJImageSource)5 GenericDialog (ij.gui.GenericDialog)5 ExecutorService (java.util.concurrent.ExecutorService)5 Future (java.util.concurrent.Future)5 PSFSettings (gdsc.smlm.ij.settings.PSFSettings)4 Calibration (gdsc.smlm.results.Calibration)4 ImageWindow (ij.gui.ImageWindow)4 File (java.io.File)4