MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / zScale

Method zScale

ij/src/main/java/ij/plugin/Resizer.java:222–256  ·  view source on GitHub ↗
(ImagePlus imp, int newDepth, int interpolationMethod)

Source from the content-addressed store, hash-verified

220 }
221
222 public ImagePlus zScale(ImagePlus imp, int newDepth, int interpolationMethod) {
223 ImagePlus imp2 = null;
224 if (imp.isHyperStack())
225 imp2 = zScaleHyperstack(imp, newDepth, interpolationMethod);
226 else {
227 boolean inPlace = (interpolationMethod&IN_PLACE)!=0;
228 interpolationMethod = interpolationMethod&15;
229 int stackSize = imp.getStackSize();
230 int bitDepth = imp.getBitDepth();
231 imp2 = resizeZ(imp, newDepth, interpolationMethod);
232 if (imp2==null)
233 return null;
234 double min = imp.getDisplayRangeMin();
235 double max = imp.getDisplayRangeMax();
236 imp2.setDisplayRange(min, max);
237 }
238 if (imp2==null)
239 return null;
240 if (imp2!=imp) {
241 if (imp.isComposite()) {
242 imp2 = new CompositeImage(imp2, ((CompositeImage)imp).getMode());
243 ((CompositeImage)imp2).copyLuts(imp);
244 } else
245 imp2.setLut(imp.getProcessor().getLut());
246 }
247 imp2.setCalibration(imp.getCalibration());
248 Calibration cal = imp2.getCalibration();
249 if (cal.scaled()) cal.pixelDepth *= (double)imp.getNSlices()/imp2.getNSlices();
250 Object info = imp.getProperty("Info");
251 if (info!=null) imp2.setProperty("Info", info);
252 imp2.setProperties(imp.getPropertiesAsArray());
253 if (imp.isHyperStack())
254 imp2.setOpenAsHyperStack(imp.isHyperStack());
255 return imp2;
256 }
257
258 private ImagePlus zScaleHyperstack(ImagePlus imp, int depth2, int interpolationMethod) {
259 boolean inPlace = (interpolationMethod&IN_PLACE)!=0;

Callers 2

runMethod · 0.95
createNewStackMethod · 0.95

Calls 15

zScaleHyperstackMethod · 0.95
resizeZMethod · 0.95
setDisplayRangeMethod · 0.95
setLutMethod · 0.95
setCalibrationMethod · 0.95
getCalibrationMethod · 0.95
scaledMethod · 0.95
getNSlicesMethod · 0.95
setPropertyMethod · 0.95
setPropertiesMethod · 0.95
setOpenAsHyperStackMethod · 0.95
isCompositeMethod · 0.80

Tested by

no test coverage detected