MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / fill

Method fill

ij/src/main/java/ij/process/ByteProcessor.java:221–241  ·  view source on GitHub ↗

Sets pixels that are within roi and part of the mask to the foreground color. Does nothing if the mask is not the same size as the ROI.

(ImageProcessor mask)

Source from the content-addressed store, hash-verified

219 /** Sets pixels that are within roi and part of the mask to the foreground
220 color. Does nothing if the mask is not the same size as the ROI. */
221 public void fill(ImageProcessor mask) {
222 if (mask==null)
223 {fill(); return;}
224 int roiWidth=this.roiWidth, roiHeight=this.roiHeight;
225 int roiX=this.roiX, roiY=this.roiY;
226 if (mask.getWidth()!=roiWidth||mask.getHeight()!=roiHeight) {
227 mask = getMask();
228 if (mask==null||mask.getWidth()!=roiWidth||mask.getHeight()!=roiHeight)
229 return;
230 }
231 byte[] mpixels = (byte[])mask.getPixels();
232 for (int y=roiY, my=0; y<(roiY+roiHeight); y++, my++) {
233 int i = y * width + roiX;
234 int mi = my * roiWidth;
235 for (int x=roiX; x<(roiX+roiWidth); x++) {
236 if (mpixels[mi++]!=0)
237 pixels[i] = (byte)fgColor;
238 i++;
239 }
240 }
241 }
242
243 public int getPixel(int x, int y) {
244 if (x>=0 && x<width && y>=0 && y<height)

Callers 10

createRoiMaskMethod · 0.95
enlargeMethod · 0.95
shrinkMethod · 0.95
enlarge255Method · 0.95
shrink255Method · 0.95
plotLanesMethod · 0.95
makeSurfacePlotMethod · 0.95
drawStringMethod · 0.95
stringToPixelsMethod · 0.95
runMethod · 0.95

Calls 4

getWidthMethod · 0.45
getHeightMethod · 0.45
getMaskMethod · 0.45
getPixelsMethod · 0.45

Tested by

no test coverage detected