/** Fills pixels that are within roi and part of the mask. Does nothing if the mask is not the same as 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] = (short)fgColor; i++; } } }
/** Fills pixels that are within roi and part of the mask. Does nothing if the mask is not the same as 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] = (short)fgColor; i++; } } }
private ShortProcessor initialize(ImageProcessor marker) { // size of image sizeX = marker.getWidth(); sizeY = marker.getHeight(); ShortProcessor distMap = new ShortProcessor(sizeX, sizeY); distMap.setValue(0); distMap.fill(); // initialize empty image with either 0 (foreground) or Inf (background) for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int val = marker.get(x, y) & 0x00ff; distMap.set(x, y, val == 0 ? Short.MAX_VALUE : 0); } } return distMap; }
private ShortProcessor initialize(ImageProcessor marker) { // size of image sizeX = marker.getWidth(); sizeY = marker.getHeight(); ShortProcessor distMap = new ShortProcessor(sizeX, sizeY); distMap.setValue(0); distMap.fill(); // initialize empty image with either 0 (foreground) or Inf (background) for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int val = marker.get(x, y) & 0x00ff; distMap.set(x, y, val == 0 ? Short.MAX_VALUE : 0); } } return distMap; }
sp.setValue(backgroundValue); sp.setRoi(0, 0, roi.width, roi.height); sp.fill();
private ShortProcessor initializeResult(ImageProcessor labelImage) { this.fireStatusChanged(new AlgoEvent(this, "Initialization")); // size of image int sizeX = labelImage.getWidth(); int sizeY = labelImage.getHeight(); // create new empty image, and fill it with black ShortProcessor distMap = new ShortProcessor(sizeX, sizeY); distMap.setValue(0); distMap.fill(); // initialize empty image with either 0 (background) or Inf (foreground) for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int label = (int) labelImage.getf(x, y); distMap.set(x, y, label == 0 ? 0 : Short.MAX_VALUE); } } return distMap; }
private ShortProcessor initializeResult(ImageProcessor labelImage) { this.fireStatusChanged(new AlgoEvent(this, "Initialization")); // size of image int sizeX = labelImage.getWidth(); int sizeY = labelImage.getHeight(); // create new empty image, and fill it with black ShortProcessor distMap = new ShortProcessor(sizeX, sizeY); distMap.setValue(0); distMap.fill(); // initialize empty image with either 0 (background) or Inf (foreground) for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int label = (int) labelImage.getf(x, y); distMap.set(x, y, label == 0 ? 0 : Short.MAX_VALUE); } } return distMap; }