Class ImagePlusUtil

java.lang.Object
org.bonej.utilities.ImagePlusUtil

public final class ImagePlusUtil extends Object
Utility methods for checking ImagePlus properties
Author:
Richard Domander
  • Method Details

    • anisotropy

      public static double anisotropy(ij.ImagePlus image)
      Calculates the degree of spatial calibration anisotropy.

      Spatial calibration is anisotropic if pixel width, height and depth are not equal.

      Parameters:
      image - an ImageJ1 style ImagePlus.
      Returns:
      Percentage of anisotropy. An isotropic image returns 0.0
    • cleanDuplicate

      public static ij.ImagePlus cleanDuplicate(ij.ImagePlus image)
      Duplicates the image without changing the title of the copy, or cropping it to the ROI.

      Circumvents the default behaviour of ImagePlus.duplicate().

      Parameters:
      image - an ImageJ1 style ImagePlus.
      Returns:
      an unchanged copy of the image.
    • is3D

      public static boolean is3D(ij.ImagePlus image)
      Checks if the image is 3D.
      Parameters:
      image - an ImageJ1 style ImagePlus.
      Returns:
      true if the image has more than one slice.
    • isBinaryColour

      public static boolean isBinaryColour(ij.ImagePlus image)
      Checks if the image has only two different colours.
      Parameters:
      image - an ImageJ1 style ImagePlus.
      Returns:
      true if there are only two distinct pixel values present in the image, false if more.
    • isNativeStack

      public static boolean isNativeStack(ij.ImagePlus imp)
      Checks if the ImageStack contains native arrays that can be accessed directly from the heap. Returns true if safe to access directly without duplication. Returns false if the stack uses wrappers, VirtualStacks, or other non-native representations.
      Parameters:
      imp - ImagePlus to check
      Returns:
      true if safe to access imp directly without duplication or false if the stack uses wrappers, VirtualStacks, or other non-native representations, or if there was an exception.