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

Method getProcessor

ij/src/main/java/ij/ImageStack.java:315–343  ·  view source on GitHub ↗

Returns an ImageProcessor for the specified slice, where {@literal 1<=n<=nslices}. Returns null if the stack is empty.

(int n)

Source from the content-addressed store, hash-verified

313 * Returns null if the stack is empty.
314 */
315 public ImageProcessor getProcessor(int n) {
316 ImageProcessor ip;
317 if (n<1 || n>nSlices)
318 throw new IllegalArgumentException(outOfRange+n);
319 if (nSlices==0)
320 return null;
321 if (stack[n-1]==null)
322 throw new IllegalArgumentException("Pixel array is null");
323 if (stack[n-1] instanceof byte[])
324 ip = new ByteProcessor(width, height, null, cm);
325 else if (stack[n-1] instanceof short[])
326 ip = new ShortProcessor(width, height, null, cm);
327 else if (stack[n-1] instanceof int[]) {
328 if (signedInt)
329 ip = new IntProcessor(width, height);
330 else
331 ip = new ColorProcessor(width, height, null);
332 } else if (stack[n-1] instanceof float[])
333 ip = new FloatProcessor(width, height, null, cm);
334 else
335 throw new IllegalArgumentException("Unknown stack type");
336 ip.setPixels(stack[n-1]);
337 if (min!=Double.MAX_VALUE && ip!=null && !(ip instanceof ColorProcessor))
338 ip.setMinAndMax(min, max);
339 if (cTable!=null)
340 ip.setCalibrationTable(cTable);
341 ip.setSliceNumber(n);
342 return ip;
343 }
344
345 /** Assigns the pixel array of an ImageProcessor to the specified slice,
346 * where {@literal 1<=n<=nslices}.

Callers 15

updateVirtualSliceMethod · 0.95
invertLookupTableMethod · 0.95
resetDisplayRangesMethod · 0.95
cropMethod · 0.95
convertToFloatMethod · 0.95
setZCoordinateMethod · 0.95
reduceMethod · 0.95
reduceStackMethod · 0.95
reduceHyperstackMethod · 0.95
runMethod · 0.95
duplicateStackMethod · 0.95
stretchHistogramMethod · 0.95

Calls 4

setPixelsMethod · 0.95
setMinAndMaxMethod · 0.95
setCalibrationTableMethod · 0.95
setSliceNumberMethod · 0.95

Tested by

no test coverage detected