protected void transferImpSettings( final ImagePlus imp, final SetupAssignments setupAssignments ) { final ConverterSetup setup = setupAssignments.getConverterSetups().get( 0 ); setup.setDisplayRange( imp.getDisplayRangeMin(), imp.getDisplayRangeMax() ); } }
protected SetupImgLoader( final BasicSetupImgLoader< S > loader ) { this.loader = loader; }
/** Tester for vanilla (single-channel) images. */ private void test(int pixelType, boolean autoscale, boolean crop, double calib, double min, double max) { final ImagePlus imp = setup(pixelType, autoscale, crop, calib, 1); final double actualMin = imp.getDisplayRangeMin(); final double actualMax = imp.getDisplayRangeMax(); assertEquals(min - calib, actualMin, 0.0); assertEquals(max - calib, actualMax, 0.0); }
void getMinAndMax() { Variable min = getFirstVariable(); Variable max = getLastVariable(); ImagePlus imp = getImage(); double v1 = imp.getDisplayRangeMin(); double v2 = imp.getDisplayRangeMax(); Calibration cal = imp.getCalibration(); v1 = cal.getCValue(v1); v2 = cal.getCValue(v2); min.setValue(v1); max.setValue(v2); }
void reset(ImagePlus imp, ImageProcessor ip) { if (RGBImage) ip.reset(); int bitDepth = imp.getBitDepth(); if (bitDepth==16 || bitDepth==32) { imp.resetDisplayRange(); defaultMin = imp.getDisplayRangeMin(); defaultMax = imp.getDisplayRangeMax(); plot.defaultMin = defaultMin; plot.defaultMax = defaultMax; } min = defaultMin; max = defaultMax; setMinAndMax(imp, min, max); updateScrollBars(null, false); plotHistogram(imp); autoThreshold = 0; }
void reset(ImagePlus imp, ImageProcessor ip) { if (RGBImage) ip.reset(); int bitDepth = imp.getBitDepth(); if (bitDepth==16 || bitDepth==32) { imp.resetDisplayRange(); defaultMin = imp.getDisplayRangeMin(); defaultMax = imp.getDisplayRangeMax(); plot.defaultMin = defaultMin; plot.defaultMax = defaultMax; } min = defaultMin; max = defaultMax; setMinAndMax(imp, min, max); updateScrollBars(null, false); plotHistogram(imp); autoThreshold = 0; }
void getMinAndMax() { Variable min = getFirstVariable(); Variable max = getLastVariable(); ImagePlus imp = getImage(); double v1 = imp.getDisplayRangeMin(); double v2 = imp.getDisplayRangeMax(); Calibration cal = imp.getCalibration(); v1 = cal.getCValue(v1); v2 = cal.getCValue(v2); min.setValue(v1); max.setValue(v2); }
static void transfer(final ImagePlus src, final ImagePlus dst) { // Calibration: dst.setCalibration(src.getCalibration()); // Color model: final ColorModel cm = src.getProcessor().getColorModel(); dst.getProcessor().setColorModel(cm); dst.getStack().setColorModel(cm); // Min and max displaying: dst.setDisplayRange(src.getDisplayRangeMin(),src.getDisplayRangeMax()); }
public Stack( final Project project, final String title, final double x, final double y, final Layer initial_layer, final String file_path ) { super( project, title, x, y ); this.file_path = file_path; // ct ==> initial_layer; final ImagePlus imp = project.getLoader().fetchImagePlus( this ); /* TODO scale regarding the Calibration and shift regarding x, y and the initial_layer */ depth = imp.getNSlices(); width = imp.getWidth(); height = imp.getHeight(); min = imp.getDisplayRangeMin(); max = imp.getDisplayRangeMax(); //at.translate( x, y ); // No need: the call to the super constructor already translated the affine transform. boundsMin[ 0 ] = 0; boundsMin[ 1 ] = 0; boundsMin[ 2 ] = initial_layer.getZ(); boundsMax[ 0 ] = width; boundsMax[ 1 ] = height; boundsMax[ 2 ] = boundsMin[ 2 ] + depth; addToDatabase(); }
/** Converts this ImagePlus to 32-bit grayscale. */ public void convertToGray32() { if (type==ImagePlus.GRAY32) return; if (!(type==ImagePlus.GRAY8||type==ImagePlus.GRAY16||type==ImagePlus.COLOR_RGB)) throw new IllegalArgumentException("Unsupported conversion"); Calibration cal = imp.getCalibration(); double min = cal.getCValue(imp.getDisplayRangeMin()); double max = cal.getCValue(imp.getDisplayRangeMax()); if (imp.getStackSize()>1) { new StackConverter(imp).convertToGray32(); IJ.setMinAndMax(imp, min, max); return; } ImageProcessor ip = imp.getProcessor(); imp.trimProcessor(); imp.setProcessor(null, ip.convertToFloat()); imp.setCalibration(cal); //update calibration IJ.setMinAndMax(imp, min, max); }
/** Converts this ImagePlus to 32-bit grayscale. */ public void convertToGray32() { if (type==ImagePlus.GRAY32) return; if (!(type==ImagePlus.GRAY8||type==ImagePlus.GRAY16||type==ImagePlus.COLOR_RGB)) throw new IllegalArgumentException("Unsupported conversion"); Calibration cal = imp.getCalibration(); double min = cal.getCValue(imp.getDisplayRangeMin()); double max = cal.getCValue(imp.getDisplayRangeMax()); if (imp.getStackSize()>1) { new StackConverter(imp).convertToGray32(); IJ.setMinAndMax(imp, min, max); return; } ImageProcessor ip = imp.getProcessor(); imp.trimProcessor(); imp.setProcessor(null, ip.convertToFloat()); imp.setCalibration(cal); //update calibration IJ.setMinAndMax(imp, min, max); }
void applyRGB(ImagePlus imp, ImageProcessor ip) { double min = imp.getDisplayRangeMin(); double max = imp.getDisplayRangeMax(); ip.setRoi(imp.getRoi()); ip.reset(); if (channels!=7) ((ColorProcessor)ip).setMinAndMax(min, max, channels); else ip.setMinAndMax(min, max); ip.reset(ip.getMask()); imp.changes = true; previousImageID = 0; ((ColorProcessor)ip).caSnapshot(false); setup(); if (Recorder.record) { if (Recorder.scriptMode()) Recorder.recordCall("IJ.run(imp, \"Apply LUT\", \"\");"); else Recorder.record("run", "Apply LUT"); } }
void applyRGB(ImagePlus imp, ImageProcessor ip) { double min = imp.getDisplayRangeMin(); double max = imp.getDisplayRangeMax(); ip.setRoi(imp.getRoi()); ip.reset(); if (channels!=7) ((ColorProcessor)ip).setMinAndMax(min, max, channels); else ip.setMinAndMax(min, max); ip.reset(ip.getMask()); imp.changes = true; previousImageID = 0; ((ColorProcessor)ip).caSnapshot(false); setup(); if (Recorder.record) { if (Recorder.scriptMode()) Recorder.recordCall("IJ.run(imp, \"Apply LUT\", \"\");"); else Recorder.record("run", "Apply LUT"); } }
public void flipStack(ImagePlus imp) { ImageStack stack = imp.getStack(); int n = stack.getSize(); if (n==1) return; Calibration cal = imp.getCalibration(); double min = cal.getCValue(imp.getDisplayRangeMin()); double max = cal.getCValue(imp.getDisplayRangeMax()); ImageStack stack2 = new ImageStack(imp.getWidth(), imp.getHeight(), n); for (int i=1; i<=n; i++) { stack2.setPixels(stack.getPixels(i), n-i+1); stack2.setSliceLabel(stack.getSliceLabel(i), n-i+1); } stack2.setColorModel(stack.getColorModel()); imp.setStack(stack2); if (imp.isComposite()) { ((CompositeImage)imp).reset(); imp.updateAndDraw(); } IJ.setMinAndMax(imp, min, max); }
public void flipStack(ImagePlus imp) { ImageStack stack = imp.getStack(); int n = stack.getSize(); if (n==1) return; Calibration cal = imp.getCalibration(); double min = cal.getCValue(imp.getDisplayRangeMin()); double max = cal.getCValue(imp.getDisplayRangeMax()); ImageStack stack2 = new ImageStack(imp.getWidth(), imp.getHeight(), n); for (int i=1; i<=n; i++) { stack2.setPixels(stack.getPixels(i), n-i+1); stack2.setSliceLabel(stack.getSliceLabel(i), n-i+1); } stack2.setColorModel(stack.getColorModel()); imp.setStack(stack2); if (imp.isComposite()) { ((CompositeImage)imp).reset(); imp.updateAndDraw(); } IJ.setMinAndMax(imp, min, max); }
selectedPlus.setDisplayRange(imagePlus.getDisplayRangeMin(), imagePlus.getDisplayRangeMax()); selectedPlus.setLut( imagePlus.getProcessor().getLut() );
boolean virtualStack = stack.isVirtual(); double min = imp.getDisplayRangeMin(); double max = imp.getDisplayRangeMax(); Roi roi = imp.getRoi(); for (int i=0, j=0; i<count; i++) {
boolean virtualStack = stack.isVirtual(); double min = imp.getDisplayRangeMin(); double max = imp.getDisplayRangeMax(); Roi roi = imp.getRoi(); boolean showProgress = stack.getSize()>400 || stack.isVirtual();
private void applyRGBStack(ImagePlus imp) { double min = imp.getDisplayRangeMin(); double max = imp.getDisplayRangeMax(); if (IJ.debugMode) IJ.log("applyRGBStack: "+min+"-"+max); int current = imp.getCurrentSlice();
return null; double min = imp.getDisplayRangeMin(); double max = imp.getDisplayRangeMax(); imp2.setDisplayRange(min, max);