Currently, I am not operating on XYZTC in SimpleITK. I use the ImageIO’s region of interest mechanism to set an extract region to read into 3d. For example if the file image is of size [100,100,100,60,21], I can specify a size of [100,100,100,0,0], and it will collapse the T,C dimension. I also join the series of processed channel for an XYZC image.
When the first dimension is C, an “itk::VectorImage” or vector pixel type can be used. Then a 5D Image could be represented in SimpleITK as a XYZT 4D image with a vector pixel type. However, if you want to do operation on channel independently this does not have an efficient memory lay out. Say for example, you want to do Gaussian blurring for each channel independently, this is not an efficient memory layout because of the increased data needed for each neighbor would would decrease cache efficiency. But if you want to display an RGB image the vector image or CXYZ then the channel first memory layout is sensible.
My Plan would be to start experimenting with instantiating SimpleITK in 5D similar to the limited support for 4D. This would be basic classes like
Image, and IO along with some grid manipulation like the
SlicerImageFilter, and the
JoinSeriesImageFilter. When that works with my microscopy test case we would then issue a RFC and get further ideas and use cases.
@jrojasUNC It looks like you are doing two steps. Both converting from Numpy to SimpleITK, then writing from SimpleITK to NRRD. Let us go back to your original post:
So… I don’t know of a filter in ITK which can do this directly. There is the ComposeImageFilter, which allows you to join several images into a
VectorImage a.k.a a
sitk::Image with vector pixel type. There is the PermuteImageFilter which could allow you to change XYZC into CXYZ 4D scalar image ( note: currently SimpleITK only have this instantiated upto 3D Image ).
The conversion to a vector image could be done with the ImportImageFilter, which would be very similar to using
GetArrayViewFromImage followed by a
Perhaps there is a need to add this ability to change the fast axis into a
VectorImage's channel component to an existing filter or even a new filter.