/** Creates a new image. * @param title image name * @param width image width in pixels * @param height image height in pixels * @param depth number of stack images * @param bitdepth 8, 16, 32 (float) or 24 (RGB) */ public static ImagePlus createImage(String title, int width, int height, int depth, int bitdepth) { return NewImage.createImage(title, width, height, depth, bitdepth, NewImage.FILL_BLACK); }
/** Creates a new image. * @param title image name * @param width image width in pixels * @param height image height in pixels * @param depth number of stack images * @param bitdepth 8, 16, 32 (float) or 24 (RGB) */ public static ImagePlus createImage(String title, int width, int height, int depth, int bitdepth) { return NewImage.createImage(title, width, height, depth, bitdepth, NewImage.FILL_BLACK); }
/** Creates a new imagePlus. <code>Type</code> should contain "8-bit", "16-bit", "32-bit" or "RGB". In addition, it can contain "white", "black" or "ramp". <code>Width</code> and <code>height</code> specify the width and height of the image in pixels. <code>Depth</code> specifies the number of stack slices. */ public static ImagePlus createImage(String title, String type, int width, int height, int depth) { type = type.toLowerCase(Locale.US); int bitDepth = 8; if (type.contains("16")) bitDepth = 16; if (type.contains("24")||type.contains("rgb")) bitDepth = 24; if (type.contains("32")) bitDepth = 32; int options = NewImage.FILL_WHITE; if (bitDepth==16 || bitDepth==32) options = NewImage.FILL_BLACK; if (type.contains("white")) options = NewImage.FILL_WHITE; else if (type.contains("black")) options = NewImage.FILL_BLACK; else if (type.contains("ramp")) options = NewImage.FILL_RAMP; else if (type.contains("noise") || type.contains("random")) options = NewImage.FILL_NOISE; options += NewImage.CHECK_AVAILABLE_MEMORY; return NewImage.createImage(title, width, height, depth, bitDepth, options); }
/** Creates a new imagePlus. <code>Type</code> should contain "8-bit", "16-bit", "32-bit" or "RGB". In addition, it can contain "white", "black" or "ramp". <code>Width</code> and <code>height</code> specify the width and height of the image in pixels. <code>Depth</code> specifies the number of stack slices. */ public static ImagePlus createImage(String title, String type, int width, int height, int depth) { type = type.toLowerCase(Locale.US); int bitDepth = 8; if (type.contains("16")) bitDepth = 16; if (type.contains("24")||type.contains("rgb")) bitDepth = 24; if (type.contains("32")) bitDepth = 32; int options = NewImage.FILL_WHITE; if (bitDepth==16 || bitDepth==32) options = NewImage.FILL_BLACK; if (type.contains("white")) options = NewImage.FILL_WHITE; else if (type.contains("black")) options = NewImage.FILL_BLACK; else if (type.contains("ramp")) options = NewImage.FILL_RAMP; else if (type.contains("noise") || type.contains("random")) options = NewImage.FILL_NOISE; options += NewImage.CHECK_AVAILABLE_MEMORY; return NewImage.createImage(title, width, height, depth, bitDepth, options); }
public static void open(String title, int width, int height, int nSlices, int type, int options) { int bitDepth = 8; if (type==GRAY16) bitDepth = 16; else if (type==GRAY32) bitDepth = 32; else if (type==RGB) bitDepth = 24; long startTime = System.currentTimeMillis(); ImagePlus imp = createImage(title, width, height, nSlices, bitDepth, options); if (imp!=null) { WindowManager.checkForDuplicateName = true; imp.show(); IJ.showStatus(IJ.d2s(((System.currentTimeMillis()-startTime)/1000.0),2)+" seconds"); } }
public static void open(String title, int width, int height, int nSlices, int type, int options) { int bitDepth = 8; if (type==GRAY16) bitDepth = 16; else if (type==GRAY32) bitDepth = 32; else if (type==RGB) bitDepth = 24; long startTime = System.currentTimeMillis(); ImagePlus imp = createImage(title, width, height, nSlices, bitDepth, options); if (imp!=null) { WindowManager.checkForDuplicateName = true; imp.show(); IJ.showStatus(IJ.d2s(((System.currentTimeMillis()-startTime)/1000.0),2)+" seconds"); } }
for (int f = 1; f <= nFrames; f++) { final ImagePlus imp = NewImage.createImage(title, width, height, 1, bitDepth, options); i5d.setPixels(imp.getProcessor().getPixels(), c, s, f); NewImage.createImage(title, width, height, 1, bitDepth, options); for (int c = 1; c <= nChannels; c++) { for (int s = 1; s <= nSlices; s++) {
ImageStack createOutputStack(ImagePlus imp, ImageProcessor ip) { int bitDepth = imp.getBitDepth(); int w2=ip.getWidth(), h2=ip.getHeight(), d2=outputSlices; int flags = NewImage.FILL_BLACK + NewImage.CHECK_AVAILABLE_MEMORY; ImagePlus imp2 = NewImage.createImage("temp", w2, h2, d2, bitDepth, flags); if (imp2!=null && imp2.getStackSize()==d2) IJ.showStatus("Reslice... (press 'Esc' to abort)"); if (imp2==null) return null; else { ImageStack stack2 = imp2.getStack(); stack2.setColorModel(ip.getColorModel()); return stack2; } }
ImageStack createOutputStack(ImagePlus imp, ImageProcessor ip) { int bitDepth = imp.getBitDepth(); int w2=ip.getWidth(), h2=ip.getHeight(), d2=outputSlices; int flags = NewImage.FILL_BLACK + NewImage.CHECK_AVAILABLE_MEMORY; ImagePlus imp2 = NewImage.createImage("temp", w2, h2, d2, bitDepth, flags); if (imp2!=null && imp2.getStackSize()==d2) IJ.showStatus("Reslice... (press 'Esc' to abort)"); if (imp2==null) return null; else { ImageStack stack2 = imp2.getStack(); stack2.setColorModel(ip.getColorModel()); return stack2; } }
ImageStack createOutputStack(ImagePlus imp, ImageProcessor ip) { int bitDepth = imp.getBitDepth(); int w2=ip.getWidth(), h2=ip.getHeight(), d2=outputSlices; int flags = NewImage.FILL_BLACK + NewImage.CHECK_AVAILABLE_MEMORY; ImagePlus imp2 = NewImage.createImage("temp", w2, h2, d2, bitDepth, flags); if (imp2!=null && imp2.getStackSize()==d2) IJ.showStatus("Reslice... (press 'Esc' to abort)"); if (imp2==null) return null; else { ImageStack stack2 = imp2.getStack(); stack2.setColorModel(ip.getColorModel()); return stack2; } }
throw new Exception("Unexpected value for bytes-per-pixel: " + bytesPerPixel + ", only value of 1 acceptable."); rtnVal = NewImage.createImage(
ImagePlus img=NewImage.createImage(title, width, height, nbSlices, imgDepth, 1);
int height2 = r.height; int depth2 = (int)(stack1.getSize()*sliceInterval+0.5); imp2 = NewImage.createImage(title, width2, height2, depth2, isRGB?24:8, NewImage.FILL_BLACK); if (imp2==null || depth2!=imp2.getStackSize()) return null; ImageStack stack2 = imp2.getStack();
int height2 = r.height; int depth2 = (int)(stack1.getSize()*sliceInterval+0.5); imp2 = NewImage.createImage(title, width2, height2, depth2, isRGB?24:8, NewImage.FILL_BLACK); if (imp2==null || depth2!=imp2.getStackSize()) return null; ImageStack stack2 = imp2.getStack();