/** Fills pixels that are within roi and part of the mask. Does nothing if the mask is not the same as the the ROI. */ public void fill(ImageProcessor mask) { if (mask==null) {fill(); return;} int roiWidth=this.roiWidth, roiHeight=this.roiHeight; int roiX=this.roiX, roiY=this.roiY; if (mask.getWidth()!=roiWidth||mask.getHeight()!=roiHeight) return; byte[] mpixels = (byte[])mask.getPixels(); for (int y=roiY, my=0; y<(roiY+roiHeight); y++, my++) { int i = y * width + roiX; int mi = my * roiWidth; for (int x=roiX; x<(roiX+roiWidth); x++) { if (mpixels[mi++]!=0) pixels[i] = fgColor; i++; } } }
/** Fills pixels that are within roi and part of the mask. Does nothing if the mask is not the same as the the ROI. */ public void fill(ImageProcessor mask) { if (mask==null) {fill(); return;} int roiWidth=this.roiWidth, roiHeight=this.roiHeight; int roiX=this.roiX, roiY=this.roiY; if (mask.getWidth()!=roiWidth||mask.getHeight()!=roiHeight) return; byte[] mpixels = (byte[])mask.getPixels(); for (int y=roiY, my=0; y<(roiY+roiHeight); y++, my++) { int i = y * width + roiX; int mi = my * roiWidth; for (int x=roiX; x<(roiX+roiWidth); x++) { if (mpixels[mi++]!=0) pixels[i] = fgColor; i++; } } }
protected void discoverEnvironment() { if (! firstTime) { firstTime = true; imp = WindowManager.getCurrentImage(); int width = 100; int height = 100; if (imp instanceof ImagePlus && imp.getStackSize() > 1) { this.imp = imp; hasVolume = true; imp.setSlice(imp.getStackSize()/2); ImageStack stack = imp.getStack(); width = stack.getWidth(); height = stack.getHeight(); } ColorProcessor cp = new ColorProcessor(width, height, new int[width*height]); cp.setColor(new Color(0xffffff)); cp.fill(); setProcessor("2D Optical flow", cp); show(); } } /**
final Color c = IJ.getInstance().getForeground(); ipTable.setColor( Color.WHITE ); ipTable.fill( roi ); ipTable.setColor( c );
final Color c = IJ.getInstance().getForeground(); ipScale.setColor( Color.WHITE ); ipScale.fill(); ipScale.setColor( c ); mpicbg.ij.util.Util.colorCircle( ipScale );
cp.setColor(new Color(0xffffff)); cp.fill(); impViewer = new ImagePlus("VJViewerCanvas", cp); new ImageWindow(impViewer, new VJViewerCanvas(impViewer));