[Insight-developers] itkVector and itkRGBPixel

Luis Ibanez luis.ibanez@kitware.com
Thu, 23 Jan 2003 19:54:35 -0500


Hi Josh,

Both RGBPixel and Vector derive from FixedArray
It could be relatively easy to write an ImageAdaptor
that will present a RGB image as a Vector<int,3> image
and the other way around.

On the other hand, we need anyways to enable reading
and writing of vector images.  A bit was added this
week for Offets. It requires some changes in the
ImageFileReader and ImageFileWriter. In that way
we could write a Gradient image, for example. Which
is a relatively common need.

I would rather not derive RGBPixel from Vector
since it will inherit all the geometric context.
You will endup with things like being able to add
an itk::RGBPixel to an itk::Point.

If some vector-like operations are commonly required
in RGB pixels maybe we should add them to the class.
Could you list some of the operations that you have
needed ?


Thanks


   Luis


------------------------------------------------------


Joshua Cates wrote:
> Hi,
> 
> Often I find myself in the situation of needing to read a color image and
> process it as a numerical vector.  The problem with this situation is that
> the itk file IO objects do not seem to handle reading data directly into
> vector images.  They do work with RGBPixel, but since RGBPixel is not a
> subclass of itkVector, it has no arithmetic operations defined and cannot
> be used as a numerical pixel type.  So I'm stuck with casting outside of
> the pipeline, which is not an ideal situation.
> 
> How do others handle this problem?  I propose either defining an
> appropriate functor for casting from RGBPixel<T> to Vector<T, 3> (is this
> even possible given the constraints imposed upon us by microsoft?), or
> making RGBPixel a subclass of Vector.
> 
> Thanks,
> 
> Josh.
> 
> 
> ______________________________
>  Josh Cates			
>  School of Computer Science	
>  University of Utah
>  Email: cates@sci.utah.edu
>  Phone: (801) 587-7697
>  URL:   http://www.sci.utah.edu/~cates
> 
> 
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
> 
>