public class DisplayStack extends Object
A converter is optionally associated with each channel, used to convert the source images into unsigned 8-bit.
When only two channels are present, one particular channel (with index=) is left blank.
Modifier and Type | Field and Description |
---|---|
static int |
CHANNEL_TO_SKIP_WHEN_TWO
Index of channel to leave blank when there are only two channels.
|
Modifier and Type | Method and Description |
---|---|
void |
copyPixelsTo(int channelIndex,
BoundingBox sourceBox,
Voxels<UnsignedByteBuffer> destinationVoxels,
BoundingBox destinationBox)
Copies pixels from a particular channel to an output buffer.
|
static DisplayStack |
create(Channel channel)
Creates from a
Channel . |
static DisplayStack |
create(RGBStack rgbStack)
Creates from a
RGBStack . |
static DisplayStack |
create(Stack stack)
Creates from a
RGBStack . |
Channel |
createChannel(int index,
boolean alwaysNew)
Create
Channel for a particular index after applying conversion. |
Stack |
deriveStack(boolean alwaysNew)
Derives a
Stack from the display-stack that will be converted to 8-bit if necessary. |
Dimensions |
dimensions()
The dimensions of all channels in the stack.
|
Extent |
extent()
The width and height and depth of all channels in the
Stack . |
Channel |
extractChannelForBoundingBox(int index,
BoundingBox box)
|
DisplayStack |
extractSlice(int z)
Extract a particular z-slice from the
DisplayStack as a new stack, applying any
applicable conversion. |
List<Optional<ChannelConverterAttached<Channel,UnsignedByteBuffer>>> |
getConverters()
A list of optional converters that will be applied to the respective channel in
stack
if they exist. |
int |
getNumberChannels()
The number of channels in the stack.
|
Stack |
getStack()
The underlying stack that will be displayed, possibly after conversion.
|
int |
getUnconvertedVoxelAt(int channelIndex,
Point3i point)
Retrieve the intensity of a voxel at a particular point, before any conversion is applied.
|
boolean |
isRGB()
Does the display-stack contain an RGB image?
|
DisplayStack |
projectMax()
Creates a Maximum
Intensity Projection of each channel.
|
Optional<Resolution> |
resolution()
Resolution of voxels to physical measurements.
|
Optional<VoxelDataType> |
unconvertedDataType()
The data-type of the underlying voxels before they are converted to 8-bit.
|
public static final int CHANNEL_TO_SKIP_WHEN_TWO
public static DisplayStack create(Channel channel) throws CreateException
Channel
.channel
- the stack to create from.DisplayStack
, after applying any applicable conversion.CreateException
- if a converter cannot be associated with a particular channel.public static DisplayStack create(Stack stack) throws CreateException
RGBStack
.stack
- the stack to create from, which should have either 1 or 3 channels
(corresponding to RGB).DisplayStack
, after applying any applicable conversion.CreateException
- with an incorrect number of channels, or if a converter cannot be
associated with a particular channel.public static DisplayStack create(RGBStack rgbStack) throws CreateException
RGBStack
.rgbStack
- the stack to create from.DisplayStack
, after applying any applicable conversion.CreateException
- if a converter cannot be associated with a particular channel.public boolean isRGB()
public Dimensions dimensions()
public Extent extent()
Stack
.
i.e. the size of each of the three possible dimensions.
public final int getNumberChannels()
public Optional<Resolution> resolution()
e.g. physical size of each voxel in a particular dimension.
public Channel createChannel(int index, boolean alwaysNew)
Channel
for a particular index
after applying conversion.public Channel extractChannelForBoundingBox(int index, BoundingBox box)
Channel
that refers to only a BoundingBox
portion of the DisplayStack
.
Existing voxels are always duplicated, and never reused.
index
- the index of the channel.box
- the bounding-box portion to extract.Channel
containing extracted voxels, corresponding to box
.public Stack deriveStack(boolean alwaysNew)
Stack
from the display-stack that will be converted to 8-bit if necessary.alwaysNew
- iff true channels are always created new during conversion, otherwise only
if needed.public void copyPixelsTo(int channelIndex, BoundingBox sourceBox, Voxels<UnsignedByteBuffer> destinationVoxels, BoundingBox destinationBox)
channelIndex
- the index of the source channel to copy from.sourceBox
- the bounding-box in the source channel to copy from.destinationVoxels
- where to copy the pixels to.destinationBox
- the bounding-box in the destination channel to copy to.public Optional<VoxelDataType> unconvertedDataType()
Optional.empty()
if
they vary.public int getUnconvertedVoxelAt(int channelIndex, Point3i point)
channelIndex
- the index of the channel in which the voxel resides.point
- the point in the channel corresponding to the voxel.public DisplayStack projectMax()
Note that if the channels do not need projections, the existing Channel
is reused
in the newly created Stack
. But if a projection is needed, it is always freshly
created as a new channel.
public DisplayStack extractSlice(int z) throws CreateException
DisplayStack
as a new stack, applying any
applicable conversion.
The existing voxels may be reused, if no conversion needs to be applied.
z
- the index in the Z-dimension of the slice to extract.DisplayStack
after any applicable conversion.CreateException
- if a channel cannot be attached to a converter.public Stack getStack()
public List<Optional<ChannelConverterAttached<Channel,UnsignedByteBuffer>>> getConverters()
stack
if they exist.Copyright © 2010–2022 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.