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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations