/** Returns 'true' if this image is thresholded. */ public boolean isThreshold() { return ip!=null && ip.getMinThreshold()!=ImageProcessor.NO_THRESHOLD; }
/** Returns 'true' if this image is thresholded. */ public boolean isThreshold() { return ip!=null && ip.getMinThreshold()!=ImageProcessor.NO_THRESHOLD; }
@Override public double getMinThreshold() { record("getMinThreshold"); return proc.getMinThreshold(); }
@Override public double getMinThreshold() { record("getMinThreshold"); return proc.getMinThreshold(); }
void updatePlot(ImageProcessor ip) { int min = (int)Math.round(minThreshold); if (min<0) min=0; if (min>255) min=255; if (ip.getMinThreshold()==ImageProcessor.NO_THRESHOLD) min = -1; int max = (int)Math.round(maxThreshold); if (max<0) max=0; if (max>255) max=255; plot.lowerThreshold = min; plot.upperThreshold = max; plot.mode = mode; plot.repaint(); }
void updatePlot(ImageProcessor ip) { int min = (int)Math.round(minThreshold); if (min<0) min=0; if (min>255) min=255; if (ip.getMinThreshold()==ImageProcessor.NO_THRESHOLD) min = -1; int max = (int)Math.round(maxThreshold); if (max<0) max=0; if (max>255) max=255; plot.lowerThreshold = min; plot.upperThreshold = max; plot.mode = mode; plot.repaint(); }
/** Returns an 8-bit binary (0 and 255) threshold mask * that has the same dimensions as this image. * @see ij.process.ImageProcessor#createMask * @see ij.ImagePlus#createThresholdMask * @see ij.ImagePlus#createRoiMask */ public static ByteProcessor createMask(ImagePlus imp) { ImageProcessor ip = imp.getProcessor(); if (ip instanceof ColorProcessor) throw new IllegalArgumentException("Non-RGB image requires"); if (ip.getMinThreshold()==ImageProcessor.NO_THRESHOLD) throw new IllegalArgumentException("Image must be thresholded"); return ip.createMask(); }
/** * Fill the text fields with parameters grabbed from stored ImagePlus. */ private void refresh() { if ( null == imp ) { return; } double threshold = imp.getProcessor().getMinThreshold(); if ( threshold < 0 ) { threshold = 0; } jTextFieldThreshold.setText( String.format( "%.0f", threshold ) ); sliderChannel.setValue( imp.getC() ); }
/** Returns an 8-bit binary (0 and 255) threshold mask * that has the same dimensions as this image. * @see ij.process.ImageProcessor#createMask * @see ij.ImagePlus#createThresholdMask * @see ij.ImagePlus#createRoiMask */ public static ByteProcessor createMask(ImagePlus imp) { ImageProcessor ip = imp.getProcessor(); if (ip instanceof ColorProcessor) throw new IllegalArgumentException("Non-RGB image requires"); if (ip.getMinThreshold()==ImageProcessor.NO_THRESHOLD) throw new IllegalArgumentException("Image must be thresholded"); return ip.createMask(); }
void autoThreshold(ImageProcessor ip) { ip.setAutoThreshold(ImageProcessor.ISODATA2, ImageProcessor.NO_LUT_UPDATE); minThreshold = ip.getMinThreshold(); maxThreshold = ip.getMaxThreshold(); if (IJ.debugMode) IJ.log("Thresholder (auto): "+minThreshold+"-"+maxThreshold); }
void autoThreshold(ImageProcessor ip) { ip.setAutoThreshold(ImageProcessor.ISODATA2, ImageProcessor.NO_LUT_UPDATE); minThreshold = ip.getMinThreshold(); maxThreshold = ip.getMaxThreshold(); if (IJ.debugMode) IJ.log("Thresholder (auto): "+minThreshold+"-"+maxThreshold); }
/** Returns a selection created from the thresholded pixels in the specified image, or null if there are no thresholded pixels. */ public Roi convert(ImageProcessor ip) { this.ip = ip; min = (float)ip.getMinThreshold(); max = (float)ip.getMaxThreshold(); w = ip.getWidth(); h = ip.getHeight(); return getRoi(); }
/** Returns a selection created from the thresholded pixels in the specified image, or null if there are no thresholded pixels. */ public Roi convert(ImageProcessor ip) { this.ip = ip; min = (float)ip.getMinThreshold(); max = (float)ip.getMaxThreshold(); w = ip.getWidth(); h = ip.getHeight(); return getRoi(); }
public void assignImage(final ImagePlus imp) { if (imp == null) return; setSpatialCalibration(imp.getCalibration()); setIdentifier(imp.getTitle()); setNDimensions(imp.getNDimensions()); if (imp.getProcessor().isBinary()) properties.setProperty(KEY_SOURCE, SRC_IMG_BINARY); else if (imp.getProcessor().getMinThreshold() != ImageProcessor.NO_THRESHOLD) properties.setProperty(KEY_SOURCE, SRC_IMG_THRESH); else properties.setProperty(KEY_SOURCE, SRC_IMG); }
float[] getZAxisProfile(){ Roi roi = imp.getRoi(); if (roi!=null && roi.isLine()) { IJ.error("ZAxisProfiler", "This command does not work with line selections."); return null; } ImageProcessor ip = imp.getProcessor(); double minThreshold = ip.getMinThreshold(); double maxThreshold = ip.getMaxThreshold(); return getZAxisProfile(roi, minThreshold, maxThreshold); } //Adapted from ImageJ code by Wayne Rasband
private void setModernThreshold(ImageDisplay display, ImagePlus imp) { ImageProcessor proc = imp.getProcessor(); double threshMin = proc.getMinThreshold(); double threshMax = proc.getMaxThreshold(); if (threshMin == ImageProcessor.NO_THRESHOLD) { if (thresholdService.hasThreshold(display)) { thresholdService.removeThreshold(display); } } else { // an IJ1 thresh exists ThresholdOverlay thresh = thresholdService.getThreshold(display); thresh.setRange(threshMin, threshMax); } }
private boolean readThresholdFromImp() { boolean successfulRead = true; final double minT = imp.getProcessor().getMinThreshold(); final double maxT = imp.getProcessor().getMaxThreshold(); if (imp.getProcessor().isBinary()) { lowerT = 1; upperT = 255; } else if (imp.isThreshold()) { lowerT = minT; upperT = maxT; } else { successfulRead = false; } return successfulRead; }
void createMaskFromThreshold(ImagePlus imp) { ImageProcessor ip = imp.getProcessor(); if (ip.getMinThreshold()==ImageProcessor.NO_THRESHOLD) { IJ.error("Create Mask", "Area selection, overlay or thresholded image required"); return; } ByteProcessor mask = imp.createThresholdMask(); if (!Prefs.blackBackground) mask.invertLut(); new ImagePlus("mask",mask).show(); Recorder.recordCall("mask = imp.createThresholdMask();"); }
void createMaskFromThreshold(ImagePlus imp) { ImageProcessor ip = imp.getProcessor(); if (ip.getMinThreshold()==ImageProcessor.NO_THRESHOLD) { IJ.error("Create Mask", "Area selection, overlay or thresholded image required"); return; } ByteProcessor mask = imp.createThresholdMask(); if (!Prefs.blackBackground) mask.invertLut(); new ImagePlus("mask",mask).show(); Recorder.recordCall("mask = imp.createThresholdMask();"); }
public void storeChannelProperties(final int channel) { checkChannel(channel); final ChannelDisplayProperties props = chDisplayProps[channel - 1]; final ImageProcessor channelIP = channelIPs[channel - 1]; // Display properties if (!props.isDisplayedGray() && !displayAllGray) { props.setColorModel(channelIP.getColorModel()); } props.setMinValue(channelIP.getMin()); props.setMaxValue(channelIP.getMax()); props.setMinThreshold(channelIP.getMinThreshold()); props.setMaxThreshold(channelIP.getMaxThreshold()); props.setLutUpdateMode(channelIP.getLutUpdateMode()); // TODO: handling of calibration function? }