java.lang.Object
org.bonej.wrapperPlugins.wrapperUtils.ResultUtils

public final class ResultUtils extends Object
Static utility methods that help display results to the user
Author:
Richard Domander
  • Method Details

    • getExponent

      public static <S extends net.imagej.space.AnnotatedSpace<A>, A extends net.imagej.axis.TypedAxis> char getExponent(S space)
      Returns the exponent character of the elements in this space, e.g. '³' for a spatial 3D space.
      Type Parameters:
      S - type of the space.
      A - type of the axes.
      Parameters:
      space - an N-dimensional space.
      Returns:
      the exponent character if the space has 2 - 9 spatial dimensions. An empty character otherwise.
    • getSizeDescription

      public static <S extends net.imagej.space.AnnotatedSpace<A>, A extends net.imagej.axis.TypedAxis> String getSizeDescription(S space)
      Returns a verbal description of the size of the elements in the given space, e.g. "A" for 2D images and "V" for 3D images.
      Type Parameters:
      S - type of the space.
      A - type of the axes.
      Parameters:
      space - an N-dimensional space.
      Returns:
      the noun for the size of the elements.
    • getUnitHeader

      public static <S extends net.imagej.space.AnnotatedSpace<net.imagej.axis.CalibratedAxis>> String getUnitHeader(S space, net.imagej.units.UnitService unitService, String exponent)
      Returns the common unit string, e.g. "mm3" that describes the elements in the space.

      The common unit is the unit of the first spatial axis if it can be converted to the units of the other axes.

      Type Parameters:
      S - type of the space.
      Parameters:
      space - an N-dimensional space.
      unitService - an UnitService to convert axis calibrations.
      exponent - an exponent to be added to the unit, e.g. '³'.
      Returns:
      the unit string with the exponent.
    • getUnitHeader

      public static String getUnitHeader(ij.ImagePlus imagePlus)
      Gets the unit of the image calibration, which can be displayed to the user.
      Parameters:
      imagePlus - a ImageJ1 style ImagePlus.
      Returns:
      calibration unit, or empty string if there's no unit.
    • getUnitHeader

      public static String getUnitHeader(net.imagej.Dataset ds)
      Get a formatted unit string for use in the result table header. Consider using AxisUtils.getSpatialUnit() instead.
      Parameters:
      ds - image dataset
      Returns:
      a formatted unit string like (mm). The unit of the lowest ordered spatial axis is used.
    • toConventionalIndex

      public static long toConventionalIndex(net.imagej.axis.AxisType type, long index)
      If needed, converts the given index to the ImageJ1 convention where Z, Channel and Time axes start from 1.
      Parameters:
      type - type of the axis's dimension.
      index - the index in the axis.
      Returns:
      index + 1 if type is Z, Channel or Time. Index otherwise.