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

Method getProcessor

ij/src/main/java/ij/plugin/AVI_Reader.java:452–481  ·  view source on GitHub ↗

Returns an ImageProcessor for the specified slice of this virtual stack (if it is one) where {@literal 1<=n<=nslices}. Returns null if no virtual stack or no slices or error reading the frame.

(int n)

Source from the content-addressed store, hash-verified

450 * where {@literal 1<=n<=nslices}. Returns null if no virtual stack or no slices or error reading the frame.
451 */
452 public synchronized ImageProcessor getProcessor(int n) {
453 if (frameInfos==null || frameInfos.size()==0 || raFilePath==null)
454 return null;
455 n = translate(n); // update n for hyperstacks not in default CZT order
456 if (n<1 || n>frameInfos.size())
457 throw new IllegalArgumentException("Argument out of range: "+n);
458 Object pixels = null;
459 RandomAccessFile rFile = null;
460 try {
461 rFile = new RandomAccessFile(new File(raFilePath), "r");
462 long[] frameInfo = (long[])(frameInfos.get(n-1));
463 pixels = readFrame(rFile, frameInfo[0], (int)frameInfo[1]);
464 } catch (Exception e) {
465 error(exceptionMessage(e));
466 return null;
467 } finally {
468 closeFile(rFile);
469 }
470 if (pixels == null) return null; //failed
471 ImageProcessor ip = null;
472 if (pixels instanceof byte[])
473 ip = new ByteProcessor(dwWidth, biHeight, (byte[])pixels, cm);
474 else if (pixels instanceof short[])
475 ip = new ShortProcessor(dwWidth, biHeight, (short[])pixels, cm);
476 else
477 ip = new ColorProcessor(dwWidth, biHeight, (int[])pixels);
478 if (ip!=null)
479 ip.setSliceNumber(n);
480 return ip;
481 }
482
483 /** Returns the image width of the virtual stack */
484 public int getWidth() {

Callers 15

reduceMethod · 0.45
convertMethod · 0.45
findMinMaxSizeMethod · 0.45
mergeHyperstacksMethod · 0.45
mergeStacksMethod · 0.45
getPixelsMethod · 0.45
runMethod · 0.45
doStackOperationMethod · 0.45
doOperationMethod · 0.45
stretchHistogramMethod · 0.45

Calls 8

readFrameMethod · 0.95
errorMethod · 0.95
exceptionMessageMethod · 0.95
closeFileMethod · 0.95
setSliceNumberMethod · 0.95
sizeMethod · 0.45
translateMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected