Class StackWriteAttributes

Object
StackWriteAttributes

public class StackWriteAttributes extends Object
Attributes describing stack which may determine which writer is used.

This class is immutable.

Author:
Owen Feehan
  • Constructor Details

    • StackWriteAttributes

      public StackWriteAttributes(boolean always2D, boolean singleChannel, boolean threeChannels, StackRGBState rgb, boolean binary)
      Alternative constructor that assumes each channel is 8-bits.
      Parameters:
      always2D - whether the output is guaranteed to only ever 2D i.e. maximally one z-slice?
      singleChannel - the number of channels is guaranteed to be 1 in the output.
      threeChannels - the number of channels is guaranteed to be 3 in the output.
      rgb - whether it's an RGB or RGBA image when it has three/four channels respectively.
      binary - whether all channels represent a binary image.
  • Method Details

    • always2D

      public StackWriteAttributes always2D(boolean binary)
      Derives a StackWriteAttributes that will always be 2D, but is otherwise unchanged.
      Parameters:
      binary - whether all channels are binary (only two allowed states: the max intensity value and the minimum intensity value.)
      Returns:
      a newly created StackWriteAttributes derived from the existing object.
    • rgb

      public StackWriteAttributes rgb(boolean plusAlpha)
      Derives a StackWriteAttributes that will be RGB or RGB-A, but is otherwise unchanged.
      Parameters:
      plusAlpha - when true, RGBA is used. when false, RGB.
      Returns:
      a newly created StackWriteAttributes derived from the existing object.
    • and

      Combines with another StackWriteAttributes by performing a logical and on each field.
      Parameters:
      other - the other StackWriteAttributes to combine with.
      Returns:
      a newly created StackWriteAttributes where each field is the logical and of the two inputs
    • or

      Combines with another StackWriteAttributes by performing a logical or on each field.
      Parameters:
      other - the other StackWriteAttributes to combine with.
      Returns:
      a newly created StackWriteAttributes where each field is the logical or of the two inputs
    • writeAsRGB

      public boolean writeAsRGB(Stack stack)
      Whether to write a stack in RGB mode?
      Parameters:
      stack - the stack to query whether it should be written in RGB mode.
      Returns:
      true if the stack should be written as RGB, false otherwise.
    • allChannelsEightBit

      public StackWriteAttributes allChannelsEightBit()
      Mark the attributes to indicate that channels are no longer guaranteed to be 8-bit.
      Returns:
      a newly-created StackWriteAttributes that has eightBit=false but is otherwise duplicated.
    • toString

      public String toString()
      A user-friendly description of the stack-type to include in error and warning messages.
      Overrides:
      toString in class Object
    • isAlways2D

      public boolean isAlways2D()
      Whether the output is guaranteed to only ever 2D i.e. maximally one z-slice?
    • isSingleChannel

      public boolean isSingleChannel()
      The number of channels is guaranteed to be 1 in the output.
    • isThreeChannels

      public boolean isThreeChannels()
      The number of channels is guaranteed to be 3 in the output.
    • getRgb

      public StackRGBState getRgb()
      Whether it's an RGB or RGBA image when it has three/four channels respectively.

      This flag should only be set when alwaysOneOrThreChannels is true.

      This flag is ignored, when the number of channels is not three.

    • isBinary

      public boolean isBinary()
      Whether all channels represent a binary image.

      This implies each channel has only two allowed states: the max intensity value and the minimum intensity value.

    • isEightBitChannels

      public boolean isEightBitChannels()
      Whether each channel is 8 bits.