For images with irregular ROIs, returns a byte mask, otherwise, returns null. Mask pixels have a non-zero value.and the dimensions of the mask are equal to the width and height of the ROI. @see ij.ImagePlus#createRoiMask @see ij.ImagePlus#createThresholdMask
()
| 1119 | * @see ij.ImagePlus#createThresholdMask |
| 1120 | */ |
| 1121 | public ImageProcessor getMask() { |
| 1122 | if (roi==null) { |
| 1123 | if (ip!=null) ip.resetRoi(); |
| 1124 | return null; |
| 1125 | } |
| 1126 | ImageProcessor mask = roi.getMask(); |
| 1127 | if (mask==null) |
| 1128 | return null; |
| 1129 | if (ip!=null && roi!=null) { |
| 1130 | ip.setMask(mask); |
| 1131 | ip.setRoi(roi.getBounds()); |
| 1132 | } |
| 1133 | return mask; |
| 1134 | } |
| 1135 | |
| 1136 | /** Returns an 8-bit binary (foreground=255, background=0) |
| 1137 | * ROI or overlay mask that has the same dimensions |