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

Method getFileInfo

ij/src/main/java/ij/ImagePlus.java:2492–2559  ·  view source on GitHub ↗

Returns a FileInfo object containing information, including the pixel array, needed to save this image. Use getOriginalFileInfo() to get a copy of the FileInfo object used to open the image. @see ij.io.FileInfo @see #getOriginalFileInfo @see #setFileInfo

()

Source from the content-addressed store, hash-verified

2490 @see #setFileInfo
2491 */
2492 public FileInfo getFileInfo() {
2493 FileInfo fi = new FileInfo();
2494 fi.width = width;
2495 fi.height = height;
2496 fi.nImages = getStackSize();
2497 if (compositeImage)
2498 fi.nImages = getImageStackSize();
2499 fi.whiteIsZero = isInvertedLut();
2500 fi.intelByteOrder = false;
2501 if (fi.nImages==1 && ip!=null)
2502 fi.pixels = ip.getPixels();
2503 else if (stack!=null)
2504 fi.pixels = stack.getImageArray();
2505 Calibration cal = getCalibration();
2506 if (cal.scaled()) {
2507 fi.pixelWidth = cal.pixelWidth;
2508 fi.pixelHeight = cal.pixelHeight;
2509 fi.unit = cal.getUnit();
2510 }
2511 if (fi.nImages>1)
2512 fi.pixelDepth = cal.pixelDepth;
2513 fi.frameInterval = cal.frameInterval;
2514 if (cal.calibrated()) {
2515 fi.calibrationFunction = cal.getFunction();
2516 fi.coefficients = cal.getCoefficients();
2517 fi.valueUnit = cal.getValueUnit();
2518 } else if (!Calibration.DEFAULT_VALUE_UNIT.equals(cal.getValueUnit()))
2519 fi.valueUnit = cal.getValueUnit();
2520
2521 switch (imageType) {
2522 case GRAY8: case COLOR_256:
2523 LookUpTable lut = createLut();
2524 boolean customLut = !lut.isGrayscale() || (ip!=null&&!ip.isDefaultLut());
2525 if (imageType==COLOR_256 || customLut)
2526 fi.fileType = FileInfo.COLOR8;
2527 else
2528 fi.fileType = FileInfo.GRAY8;
2529 addLut(lut, fi);
2530 break;
2531 case GRAY16:
2532 if (compositeImage && fi.nImages==3) {
2533 if ("Red".equals(getStack().getSliceLabel(1)))
2534 fi.fileType = fi.RGB48;
2535 else
2536 fi.fileType = fi.GRAY16_UNSIGNED;
2537 } else
2538 fi.fileType = fi.GRAY16_UNSIGNED;
2539 if (!compositeImage) {
2540 lut = createLut();
2541 if (!lut.isGrayscale() || (ip!=null&&!ip.isDefaultLut()))
2542 addLut(lut, fi);
2543 }
2544 break;
2545 case GRAY32:
2546 fi.fileType = fi.GRAY32_FLOAT;
2547 if (!compositeImage) {
2548 lut = createLut();
2549 if (!lut.isGrayscale() || (ip!=null&&!ip.isDefaultLut()))

Callers 8

actionPerformedMethod · 0.95
openDragAndDropFilesMethod · 0.95
runMethod · 0.45
processImageMethod · 0.45
processImageMethod · 0.45
replaceImageInWindowMethod · 0.45
solveMethod · 0.45
actionPerformedMethod · 0.45

Calls 15

getStackSizeMethod · 0.95
getImageStackSizeMethod · 0.95
isInvertedLutMethod · 0.95
getCalibrationMethod · 0.95
scaledMethod · 0.95
getUnitMethod · 0.95
calibratedMethod · 0.95
getFunctionMethod · 0.95
getCoefficientsMethod · 0.95
getValueUnitMethod · 0.95
createLutMethod · 0.95
isGrayscaleMethod · 0.95

Tested by

no test coverage detected