[Insight-developers] How to support vector of complex as a pixel type in ImageIOBase?

Jim Miller millerjv at gmail.com
Sat Jul 8 08:38:32 EDT 2006


Uggh.

I'm not seeing a clean solution that we will not eventually outgrow.

I suppose a general solution would be to have a third enum. Something so
that you can have a
PixelType of VECTOR, a ComponentType of COMPLEX, a SubComponentType of
DOUBLE. But someday, someone is going to want a vector of vectors of vectors
of vectors of complex of doubles.

If COMPLEX is added as a ComponentType, then we'd have to prescribe whether
that is a complex<float>
or complex<double>.  I don't think this will work since these types are used
in mapping the types as one disk to the types as in memory.

So perhaps the only solution is to have COMPLEXVECTOR as a PixelType and use
the ComponentType to indicate whether the components of the complex vector
are double or float.  This still does not feel quite right because in this
case the component type is the type of the component in the complex value in
the vector.  But I would still lean towards this solution.

Jim


On 7/7/06, Kent Williams <kent at psychiatry.uiowa.edu> wrote:
>
>  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.
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20060708/92cb613d/attachment.html


More information about the Insight-developers mailing list