/** Sets the X length unit. */ public void setXUnit(String unit) { setUnit(unit); }
/** Sets the X length unit. */ public void setXUnit(String unit) { setUnit(unit); }
double mmPerPixelX = 5.2; double mmPerPixelY = 6.3; double mmOriginX = -200.0; double mmOriginY = 200.0; ImagePlus imp = IJ.getImage(); Calibration cal = imp.getCalibration(); cal.setUnit("mm"); cal.pixelWidth = mmPerPixelX; cal.pixelHeight = mmPerPixelY; cal.xOrigin = -mmOriginX / mmPerPixelX; cal.yOrigin = -mmOriginY / mmPerPixelY;
private Calibration guessCalibrationFromHeading(final String colHeading) { if (colHeading == null) return null; final String[] tokens = colHeading.toLowerCase().split("\\W"); final String[] knownUnits = "\u00B5 um micron mm cm pixels".split(" "); for (final String token : tokens) { for (final String unit : knownUnits) { if (token.contains(unit)) { final Calibration cal = new Calibration(); cal.setUnit(unit); return cal; } } } return null; }
calibration.setTimeUnit(value); } else if (key.equals("unit")) { calibration.setUnit(value);
public void setProperties(final Properties properties) { this.properties = properties; // Center center = UPoint.fromString(properties.getProperty(KEY_CENTER, UNSET)); // Calibration final String[] calLines = properties.getProperty(KEY_CALIBRATION, UNSET).split(","); final Double vx = Double.parseDouble(getCalibrationValue(calLines, "w=")); final Double vy = Double.parseDouble(getCalibrationValue(calLines, "h=")); final Double vz = Double.parseDouble(getCalibrationValue(calLines, "d=")); final String unit = getCalibrationValue(calLines, "unit="); cal = new Calibration(); cal.setUnit(unit); cal.pixelWidth = vx; cal.pixelHeight = vy; cal.pixelDepth = vz; }
private void calibrate() { String unit=cal.getUnit(); double o_depth=cal.pixelDepth; double o_height=cal.pixelHeight; double o_width=cal.pixelWidth; cal_yz.setUnit(unit); if (rotateYZ) { cal_yz.pixelHeight=o_depth/az; cal_yz.pixelWidth=o_height; } else { cal_yz.pixelWidth=o_depth/az; cal_yz.pixelHeight=o_height; } if (flipXZ) cal_yz.setInvertY(true); yz_image.setCalibration(cal_yz); yz_image.setIJMenuBar(false); cal_xz.setUnit(unit); cal_xz.pixelWidth=o_width; cal_xz.pixelHeight=o_depth/az; if (flipXZ) cal_xz.setInvertY(true); xz_image.setCalibration(cal_xz); xz_image.setIJMenuBar(false); }
private void calibrate() { String unit=cal.getUnit(); double o_depth=cal.pixelDepth; double o_height=cal.pixelHeight; double o_width=cal.pixelWidth; cal_yz.setUnit(unit); if (rotateYZ) { cal_yz.pixelHeight=o_depth/az; cal_yz.pixelWidth=o_height; } else { cal_yz.pixelWidth=o_depth/az; cal_yz.pixelHeight=o_height; } if (flipXZ) cal_yz.setInvertY(true); yz_image.setCalibration(cal_yz); yz_image.setIJMenuBar(false); cal_xz.setUnit(unit); cal_xz.pixelWidth=o_width; cal_xz.pixelHeight=o_depth/az; if (flipXZ) cal_xz.setInvertY(true); xz_image.setCalibration(cal_xz); xz_image.setIJMenuBar(false); }
public static void setCalibration( final ImagePlus imp, final Interval bb, final double downsampling, final double anisoF, final double cal, final String unit ) { final double ds = Double.isNaN( downsampling ) ? 1.0 : downsampling; final double ai = Double.isNaN( anisoF ) ? 1.0 : anisoF; if ( bb != null ) { imp.getCalibration().xOrigin = -(bb.min( 0 ) / ds) * cal; imp.getCalibration().yOrigin = -(bb.min( 1 ) / ds) * cal; imp.getCalibration().zOrigin = -(bb.min( 2 ) / ds) * cal; imp.getCalibration().pixelWidth = imp.getCalibration().pixelHeight = ds * cal; imp.getCalibration().pixelDepth = ds * ai * cal; } imp.getCalibration().setUnit( unit ); }
imp.getCalibration().setUnit(model.getSpaceUnits()); imp.getCalibration().setTimeUnit(model.getTimeUnits()); return imp;
imp.getCalibration().setUnit(model.getSpaceUnits()); imp.getCalibration().setTimeUnit(model.getTimeUnits()); return imp;
void setVoxelSize() { double width = getFirstArg(); double height = getNextArg(); double depth = getNextArg(); String unit = getLastString(); ImagePlus imp = getImage(); Calibration cal = imp.getCalibration(); cal.pixelWidth = width; cal.pixelHeight = height; cal.pixelDepth = depth; cal.setUnit(unit); imp.repaintWindow(); }
void setVoxelSize() { double width = getFirstArg(); double height = getNextArg(); double depth = getNextArg(); String unit = getLastString(); ImagePlus imp = getImage(); Calibration cal = imp.getCalibration(); cal.pixelWidth = width; cal.pixelHeight = height; cal.pixelDepth = depth; cal.setUnit(unit); imp.repaintWindow(); }
if (hasSpatial) cal.setUnit("micron"); if (xcalPresent) cal.pixelWidth = xcal == 0 ? 1 : xcal; if (ycalPresent) cal.pixelHeight = ycal == 0 ? 1 : ycal;
/** * Transfers the calibration of an {@link ImagePlus} to another one, * generated from a capture of the first one. Pixels sizes are adapter * depending on the zoom level during capture. * * @param from * the imp to copy from. * @param to * the imp to copy to. */ private void transferCalibration( final ImagePlus from, final ImagePlus to ) { final Calibration fc = from.getCalibration(); final Calibration tc = to.getCalibration(); tc.setUnit( fc.getUnit() ); tc.setTimeUnit( fc.getTimeUnit() ); tc.frameInterval = fc.frameInterval; final double mag = from.getCanvas().getMagnification(); tc.pixelWidth = fc.pixelWidth / mag; tc.pixelHeight = fc.pixelHeight / mag; tc.pixelDepth = fc.pixelDepth; }
} else { cal.pixelWidth = cal.pixelHeight = cal.pixelDepth = 1.0; cal.setUnit("pixel");
cal.setUnit("um"); cal.pixelWidth = cal.pixelHeight = CameraSetupPlugIn.getPixelSize() / 1000.0; getFirstPlaneStack().setCalibration(cal);
calibration.pixelDepth = zStep / 1000; calibration.setUnit("um"); image.setCalibration(calibration); if(colorize) {
cal2.pixelWidth = cal.pixelWidth; cal2.pixelHeight = cal.pixelHeight; cal2.setUnit(cal.getUnit());
cal2.pixelWidth = cal.pixelWidth; cal2.pixelHeight = cal.pixelHeight; cal2.setUnit(cal.getUnit());