public void setFunction(int function, double[] coefficients, String unit, boolean zeroClip) { if (function==NONE) {disableDensityCalibration(); return;} if (coefficients==null && function>=STRAIGHT_LINE && function<=EXP_RECOVERY) return; this.function = function; this.coefficients = coefficients; this.zeroClip = zeroClip; if (unit!=null) valueUnit = unit; cTable = null; }
public void setFunction(int function, double[] coefficients, String unit, boolean zeroClip) { if (function==NONE) {disableDensityCalibration(); return;} if (coefficients==null && function>=STRAIGHT_LINE && function<=EXP_RECOVERY) return; this.function = function; this.coefficients = coefficients; this.zeroClip = zeroClip; if (unit!=null) valueUnit = unit; cTable = null; }
/** Sets the calibration table. With 8-bit images, the table must have a length of 256. With 16-bit images, it must be 65536. */ public void setCTable(float[] table, String unit) { if (table==null) { disableDensityCalibration(); return; } if (bitDepth==UNKNOWN) { if (table.length==256) bitDepth = 8; else if (table.length==65536) bitDepth = 16; } if (bitDepth==16 && table.length!=65536) throw new IllegalArgumentException("Table.length!=65536"); cTable = table; function = CUSTOM; coefficients = null; zeroClip = false; if (unit!=null) valueUnit = unit; }
/** Sets the calibration table. With 8-bit images, the table must have a length of 256. With 16-bit images, it must be 65536. */ public void setCTable(float[] table, String unit) { if (table==null) { disableDensityCalibration(); return; } if (bitDepth==UNKNOWN) { if (table.length==256) bitDepth = 8; else if (table.length==65536) bitDepth = 16; } if (bitDepth==16 && table.length!=65536) throw new IllegalArgumentException("Table.length!=65536"); cTable = table; function = CUSTOM; coefficients = null; zeroClip = false; if (unit!=null) valueUnit = unit; }
/** Disables the density calibation if the specified image has a differenent bit depth. */ public void setImage(ImagePlus imp) { if (imp==null) return; int type = imp.getType(); int newBitDepth = imp.getBitDepth(); if (newBitDepth==16 && imp.getLocalCalibration().isSigned16Bit()) { double[] coeff = new double[2]; coeff[0] = -32768.0; coeff[1] = 1.0; setFunction(Calibration.STRAIGHT_LINE, coeff, DEFAULT_VALUE_UNIT); } else if ((newBitDepth!=bitDepth&&bitDepth!=UNKNOWN) || type==ImagePlus.GRAY32 || type==ImagePlus.COLOR_RGB) { String saveUnit = valueUnit; disableDensityCalibration(); if (type==ImagePlus.GRAY32) valueUnit = saveUnit; } bitDepth = newBitDepth; }
/** Disables the density calibation if the specified image has a differenent bit depth. */ public void setImage(ImagePlus imp) { if (imp==null) return; int type = imp.getType(); int newBitDepth = imp.getBitDepth(); if (newBitDepth==16 && imp.getLocalCalibration().isSigned16Bit()) { double[] coeff = new double[2]; coeff[0] = -32768.0; coeff[1] = 1.0; setFunction(Calibration.STRAIGHT_LINE, coeff, DEFAULT_VALUE_UNIT); } else if ((newBitDepth!=bitDepth&&bitDepth!=UNKNOWN) || type==ImagePlus.GRAY32 || type==ImagePlus.COLOR_RGB) { String saveUnit = valueUnit; disableDensityCalibration(); if (type==ImagePlus.GRAY32) valueUnit = saveUnit; } bitDepth = newBitDepth; }
void invert16BitStack(ImagePlus imp) { imp.deleteRoi(); imp.getCalibration().disableDensityCalibration(); ImageStatistics stats = new StackStatistics(imp); ImageStack stack = imp.getStack(); int nslices = stack.getSize(); int min=(int)stats.min, range=(int)(stats.max-stats.min); int n = imp.getWidth()*imp.getHeight(); for (int slice=1; slice<=nslices; slice++) { ImageProcessor ip = stack.getProcessor(slice); short[] pixels = (short[])ip.getPixels(); for (int i=0; i<n; i++) { int before = pixels[i]&0xffff; pixels[i] = (short)(range-((pixels[i]&0xffff)-min)); } } imp.setStack(null, stack); imp.setDisplayRange(0, range); imp.updateAndDraw(); }
void invert16BitStack(ImagePlus imp) { imp.deleteRoi(); imp.getCalibration().disableDensityCalibration(); ImageStatistics stats = new StackStatistics(imp); ImageStack stack = imp.getStack(); int nslices = stack.getSize(); int min=(int)stats.min, range=(int)(stats.max-stats.min); int n = imp.getWidth()*imp.getHeight(); for (int slice=1; slice<=nslices; slice++) { ImageProcessor ip = stack.getProcessor(slice); short[] pixels = (short[])ip.getPixels(); for (int i=0; i<n; i++) { int before = pixels[i]&0xffff; pixels[i] = (short)(range-((pixels[i]&0xffff)-min)); } } imp.setStack(null, stack); imp.setDisplayRange(0, range); imp.updateAndDraw(); }
ImagePlus maxImp = new ImagePlus(outname, outIp); Calibration cal = imp.getCalibration().copy(); cal.disableDensityCalibration();
ImagePlus maxImp = new ImagePlus(outname, outIp); Calibration cal = imp.getCalibration().copy(); cal.disableDensityCalibration();
ImagePlus maxImp = new ImagePlus(outname, outIp); Calibration cal = imp.getCalibration().copy(); cal.disableDensityCalibration();
} else if (lineWidth>1 && calibrated && limit!=0) { Calibration cal = imp2.getCalibration().copy(); imp2.getCalibration().disableDensityCalibration(); ip2 = (new Straightener()).straightenLine(imp2, lineWidth); imp2.setCalibration(cal); imp2.getCalibration().disableDensityCalibration(); ProfilePlot profile = new ProfilePlot(imp2); imp2.setCalibration(cal);
} else if (lineWidth>1 && calibrated && limit!=0) { Calibration cal = imp2.getCalibration().copy(); imp2.getCalibration().disableDensityCalibration(); ip2 = (new Straightener()).straightenLine(imp2, lineWidth); imp2.setCalibration(cal); imp2.getCalibration().disableDensityCalibration(); ProfilePlot profile = new ProfilePlot(imp2); imp2.setCalibration(cal);
cal3.disableDensityCalibration(); imp3.show(); IJ.showProgress(1.0);
cal3.disableDensityCalibration(); imp3.show(); IJ.showProgress(1.0);