@Override public void insert(ImageProcessor ip, int xloc, int yloc) { record("insert", new Object[] {ip, new Integer(xloc), new Integer(yloc)}, new Class[] {ImageProcessor.class, int.class, int.class}); proc.insert(ip, xloc, yloc); }
@Override public void insert(ImageProcessor ip, int xloc, int yloc) { record("insert", new Object[] {ip, new Integer(xloc), new Integer(yloc)}, new Class[] {ImageProcessor.class, int.class, int.class}); proc.insert(ip, xloc, yloc); }
private ImageProcessor pad(ImageProcessor ip, int width, int height) { // Make sure width and height are even width = width%2 == 0 ? width : width+1; height = height%2 == 0 ? height : height+1; if (ip.getWidth() != width || ip.getHeight() != height) { ImageProcessor ip2 = ip.createProcessor(width, height); ip2.insert(ip, 0, 0); ip = ip2; } return ip; }
ImageProcessor createNewImage(ImageProcessor ip1, ImageProcessor ip2) { int width = Math.min(ip1.getWidth(), ip2.getWidth()); int height = Math.min(ip1.getHeight(), ip2.getHeight()); ImageProcessor ip3 = ip1.createProcessor(width, height); if (floatResult) { ip1 = ip1.convertToFloat(); ip3 = ip3.convertToFloat(); } ip3.insert(ip1, 0, 0); return ip3; }
ImageProcessor createNewImage(ImageProcessor ip1, ImageProcessor ip2) { int width = Math.min(ip1.getWidth(), ip2.getWidth()); int height = Math.min(ip1.getHeight(), ip2.getHeight()); ImageProcessor ip3 = ip1.createProcessor(width, height); if (floatResult) { ip1 = ip1.convertToFloat(); ip3 = ip3.convertToFloat(); } ip3.insert(ip1, 0, 0); return ip3; }
ImageProcessor createNewImage(ImageProcessor ip1, ImageProcessor ip2) { int width = Math.min(ip1.getWidth(), ip2.getWidth()); int height = Math.min(ip1.getHeight(), ip2.getHeight()); ImageProcessor ip3 = ip1.createProcessor(width, height); if (floatResult) { ip1 = ip1.convertToFloat(); ip3 = ip3.convertToFloat(); } ip3.insert(ip1, 0, 0); return ip3; }
public ImageProcessor expandImage(ImageProcessor ipOld, int wNew, int hNew, int xOff, int yOff) { ImageProcessor ipNew = ipOld.createProcessor(wNew, hNew); if (zeroFill) ipNew.setValue(0.0); else ipNew.setColor(Toolbar.getBackgroundColor()); ipNew.fill(); ipNew.insert(ipOld, xOff, yOff); return ipNew; }
public ImageProcessor expandImage(ImageProcessor ipOld, int wNew, int hNew, int xOff, int yOff) { ImageProcessor ipNew = ipOld.createProcessor(wNew, hNew); if (zeroFill) ipNew.setValue(0.0); else ipNew.setColor(Toolbar.getBackgroundColor()); ipNew.fill(); ipNew.insert(ipOld, xOff, yOff); return ipNew; }
ImageProcessor expand(ImageProcessor ip, boolean hasEdgePixels) { if (hasEdgePixels) { ImageProcessor ip2 = ip.createProcessor(ip.getWidth()+2, ip.getHeight()+2); if (foreground==0) { ip2.setColor(255); ip2.fill(); } ip2.insert(ip, 1, 1); //new ImagePlus("ip2", ip2).show(); return ip2; } else return ip; }
ImageProcessor expand(ImageProcessor ip, boolean hasEdgePixels) { if (hasEdgePixels) { ImageProcessor ip2 = ip.createProcessor(ip.getWidth()+2, ip.getHeight()+2); if (foreground==0) { ip2.setColor(255); ip2.fill(); } ip2.insert(ip, 1, 1); //new ImagePlus("ip2", ip2).show(); return ip2; } else return ip; }
public void drawUnscaledColorBar(ImageProcessor ip, int x, int y, int width, int height) { ImageProcessor bar = null; if (ip instanceof ColorProcessor) bar = new ColorProcessor(width, height); else bar = new ByteProcessor(width, height); if (mapSize == 0) { //no color table; draw a grayscale bar for (int i = 0; i < 256; i++) { bar.setColor(new Color(i, i, i)); bar.moveTo(i, 0); bar.lineTo(i, height); } } else { for (int i = 0; i<mapSize; i++) { bar.setColor(new Color(rLUT[i]&0xff, gLUT[i]&0xff, bLUT[i]&0xff)); bar.moveTo(i, 0); bar.lineTo(i, height); } } ip.insert(bar, x,y); ip.setColor(Color.black); ip.drawRect(x-1, y, width+2, height); }
private ImageStatistics RGBHistogram(ImagePlus imp, int bins, double histMin, double histMax) { ImageProcessor ip = (ColorProcessor)imp.getProcessor(); ip = ip.crop(); int w = ip.getWidth(); int h = ip.getHeight(); ImageProcessor ip2 = new ByteProcessor(w*3, h); ByteProcessor temp = null; for (int i=0; i<3; i++) { temp = ((ColorProcessor)ip).getChannel(i+1,temp); ip2.insert(temp, i*w, 0); } ImagePlus imp2 = new ImagePlus("imp2", ip2); return imp2.getStatistics(AREA+MEAN+MODE+MIN_MAX, bins, histMin, histMax); }
private ImageStatistics RGBHistogram(ImagePlus imp, int bins, double histMin, double histMax) { ImageProcessor ip = (ColorProcessor)imp.getProcessor(); ip = ip.crop(); int w = ip.getWidth(); int h = ip.getHeight(); ImageProcessor ip2 = new ByteProcessor(w*3, h); ByteProcessor temp = null; for (int i=0; i<3; i++) { temp = ((ColorProcessor)ip).getChannel(i+1,temp); ip2.insert(temp, i*w, 0); } ImagePlus imp2 = new ImagePlus("imp2", ip2); return imp2.getStatistics(AREA+MEAN+MODE+MIN_MAX, bins, histMin, histMax); }
public void insert(ImagePlus imp1, ImagePlus imp2, int x, int y) { ImageStack stack1 = imp1.getStack(); ImageStack stack2 = imp2.getStack(); int size1 = stack1.getSize(); int size2 = stack2.getSize(); ImageProcessor ip1, ip2; for (int i=1; i<=size2; i++) { ip1 = stack1.getProcessor(i<=size1?i:size1); ip2 = stack2.getProcessor(i); ip2.insert(ip1, x, y); stack2.setPixels(ip2.getPixels(), i); } imp2.setStack(null, stack2); }
/** Converts the stack to 8-bits indexed color. 'nColors' must be greater than 1 and less than or equal to 256. */ public void convertToIndexedColor(int nColors) { if (type!=ImagePlus.COLOR_RGB) throw new IllegalArgumentException("RGB stack required"); ImageStack stack = imp.getStack(); int size = stack.getSize(); ImageProcessor montage = new ColorProcessor(width*size, height); for (int i=0; i<size; i++) montage.insert(stack.getProcessor(i+1), i*width, 0); MedianCut mc = new MedianCut((ColorProcessor)montage); montage = mc.convertToByte(nColors); ImageStack stack2 = new ImageStack(width, height); for (int i=0; i<size; i++) { montage.setRoi(i*width, 0, width, height); stack2.addSlice(null, montage.crop()); } imp.setStack(null, stack2); }
/** Converts the stack to 8-bits indexed color. 'nColors' must be greater than 1 and less than or equal to 256. */ public void convertToIndexedColor(int nColors) { if (type!=ImagePlus.COLOR_RGB) throw new IllegalArgumentException("RGB stack required"); ImageStack stack = imp.getStack(); int size = stack.getSize(); ImageProcessor montage = new ColorProcessor(width*size, height); for (int i=0; i<size; i++) montage.insert(stack.getProcessor(i+1), i*width, 0); MedianCut mc = new MedianCut((ColorProcessor)montage); montage = mc.convertToByte(nColors); ImageStack stack2 = new ImageStack(width, height); for (int i=0; i<size; i++) { montage.setRoi(i*width, 0, width, height); stack2.addSlice(null, montage.crop()); } imp.setStack(null, stack2); }
public void insert(ImagePlus imp1, ImagePlus imp2, int x, int y) { ImageStack stack1 = imp1.getStack(); ImageStack stack2 = imp2.getStack(); int size1 = stack1.getSize(); int size2 = stack2.getSize(); ImageProcessor ip1, ip2; for (int i=1; i<=size2; i++) { ip1 = stack1.getProcessor(i<=size1?i:size1); ip2 = stack2.getProcessor(i); ip2.insert(ip1, x, y); stack2.setPixels(ip2.getPixels(), i); } imp2.setStack(null, stack2); }
private void concat(ImageStack stack3, ImageStack stack1, boolean dup) { int slice = 1; int size = stack1.getSize(); for (int i = 1; i <= size; i++) { ImageProcessor ip = stack1.getProcessor(slice); String label = stack1.getSliceLabel(slice); if (dup) { ip = ip.duplicate(); slice++; } else stack1.deleteSlice(slice); ImageProcessor ip2 = ip; if (ip.getWidth()!=maxWidth || ip.getHeight()!=maxHeight) { ip2 = ip.createProcessor(maxWidth, maxHeight); ip2.insert(ip, (maxWidth-ip.getWidth())/2, (maxHeight-ip.getHeight())/2); } stack3.addSlice(label, ip2); } }
public ImageStack expandStack(ImageStack stackOld, int wNew, int hNew, int xOff, int yOff) { int nFrames = stackOld.getSize(); ImageProcessor ipOld = stackOld.getProcessor(1); java.awt.Color colorBack = Toolbar.getBackgroundColor(); ImageStack stackNew = new ImageStack(wNew, hNew, stackOld.getColorModel()); ImageProcessor ipNew; for (int i=1; i<=nFrames; i++) { IJ.showProgress((double)i/nFrames); ipNew = ipOld.createProcessor(wNew, hNew); if (zeroFill) ipNew.setValue(0.0); else ipNew.setColor(colorBack); ipNew.fill(); ipNew.insert(stackOld.getProcessor(i), xOff, yOff); stackNew.addSlice(stackOld.getSliceLabel(i), ipNew); } return stackNew; }
public ImageStack expandStack(ImageStack stackOld, int wNew, int hNew, int xOff, int yOff) { int nFrames = stackOld.getSize(); ImageProcessor ipOld = stackOld.getProcessor(1); java.awt.Color colorBack = Toolbar.getBackgroundColor(); ImageStack stackNew = new ImageStack(wNew, hNew, stackOld.getColorModel()); ImageProcessor ipNew; for (int i=1; i<=nFrames; i++) { IJ.showProgress((double)i/nFrames); ipNew = ipOld.createProcessor(wNew, hNew); if (zeroFill) ipNew.setValue(0.0); else ipNew.setColor(colorBack); ipNew.fill(); ipNew.insert(stackOld.getProcessor(i), xOff, yOff); stackNew.addSlice(stackOld.getSliceLabel(i), ipNew); } return stackNew; }