[Insight-developers] How to support vector of complex as a pixel
type in ImageIOBase?
Kent Williams
kent at psychiatry.uiowa.edu
Fri Jul 7 15:28:58 EDT 2006
This is all about being able to read and write images with a vector type
of itk::Vector<std::complex<float>,N>.
NIfTI supports A) vectors of components per pixel and B) Complex types
as components. Currently, the itk::NiftiImageIO doesn't support the
complex component types, but could be extended to support them.
Except for this: itk::ImageIOBase doesn't understand a vector of
complex. You can create an image with a pixel type of
itk::Vector<std::complex<float>,3> but when
itk::ImageIOBase::SetPixelTypeInfo is called, it fails.
The problem stems from the supported types of pixel types in ImageIOBase:
/** Enums used to manipulate the pixel type. The pixel type provides
* context for automatic data conversions (for instance, RGB to
* SCALAR, VECTOR to SCALAR). */
typedef enum {UNKNOWNPIXELTYPE,SCALAR,RGB,RGBA,OFFSET,VECTOR,
POINT,COVARIANTVECTOR,SYMMETRICSECONDRANKTENSOR,
DIFFUSIONTENSOR3D,COMPLEX,FIXEDARRAY} IOPixelType;
/** Enums used to manipulate the component type. The component type
* refers to the actual storage class associated with either a
* SCALAR pixel type or elements of a compound pixel.
*/
typedef enum {UNKNOWNCOMPONENTTYPE,UCHAR,CHAR,USHORT,SHORT,UINT,INT,
ULONG,LONG, FLOAT,DOUBLE} IOComponentType;
You can have a Vector of any type mentioned in the IOComponentType, but
there's no COMPLEX in IOComponentType.
There are two things I could do to address this: 1) Add a VECTORCOMPLEX
type to IOPixelType -- in which case the IOComponentType will refer to
the scalar type of the Complex number's real and imaginary type. Or 2)
Add COMPLEX types to IOComponentType.
The first seems less than general, the second is stylistically confusing
because COMPLEX could be the IOPixelType or the IOComponentType.
NIfTI files supports Complex pixel component types (complex<float>,
complex<double> and complex<long double>), and it supports vectors of
any of the component types. It can even support an NxM Matrix of
Complex. But for itk::NiftiImageIO to take advantage of that support,
itk::ImageIOBase needs to address the Complex pixel component type.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20060707/f0a0fb35/attachment.htm
More information about the Insight-developers
mailing list