Class StackWriteAttributes
Object
StackWriteAttributes
Attributes describing stack which may determine which writer is used.
This class is immutable.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionStackWriteAttributes
(boolean always2D, boolean singleChannel, boolean threeChannels, StackRGBState rgb, boolean binary) Alternative constructor that assumes each channel is 8-bits. -
Method Summary
Modifier and TypeMethodDescriptionMark the attributes to indicate that channels are no longer guaranteed to be 8-bit.always2D
(boolean binary) Derives aStackWriteAttributes
that will always be 2D, but is otherwise unchanged.and
(StackWriteAttributes other) Combines with anotherStackWriteAttributes
by performing a logical and on each field.getRgb()
Whether it's an RGB or RGBA image when it has three/four channels respectively.boolean
Whether the output is guaranteed to only ever 2D i.e. maximally one z-slice?boolean
isBinary()
Whether all channels represent a binary image.boolean
Whether each channel is 8 bits.boolean
The number of channels is guaranteed to be 1 in the output.boolean
The number of channels is guaranteed to be 3 in the output.or
(StackWriteAttributes other) Combines with anotherStackWriteAttributes
by performing a logical or on each field.rgb
(boolean plusAlpha) Derives aStackWriteAttributes
that will be RGB or RGB-A, but is otherwise unchanged.toString()
A user-friendly description of the stack-type to include in error and warning messages.boolean
writeAsRGB
(Stack stack) Whether to write a stack in RGB mode?
-
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
Derives aStackWriteAttributes
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
Derives aStackWriteAttributes
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 anotherStackWriteAttributes
by performing a logical and on each field.- Parameters:
other
- the otherStackWriteAttributes
to combine with.- Returns:
- a newly created
StackWriteAttributes
where each field is the logical and of the two inputs
-
or
Combines with anotherStackWriteAttributes
by performing a logical or on each field.- Parameters:
other
- the otherStackWriteAttributes
to combine with.- Returns:
- a newly created
StackWriteAttributes
where each field is the logical or of the two inputs
-
writeAsRGB
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
Mark the attributes to indicate that channels are no longer guaranteed to be 8-bit.- Returns:
- a newly-created
StackWriteAttributes
that haseightBit=false
but is otherwise duplicated.
-
toString
A user-friendly description of the stack-type to include in error and warning messages. -
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
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.
-