[Insight-users] How to Convert ITK RGB Image to VTK Image

John Biddiscombe jbiddiscombe at skippingmouse.co.uk
Sun Jul 11 13:48:34 EDT 2004


I've been doing some tests and I seem to be getting
RGR instead of RGB, ie the red plane is being duplicated in the blue plane
by mistake. (I thought it was BGR but it was just because my R and B planes
were very similar).

Images are also flipped upside down.

JB
I'm trying to track down the problem but it looks like it might be inside
the TIFF utility code rather than the TiffImagIO code...

----- Original Message ----- 
From: "Luis Ibanez" <luis.ibanez at kitware.com>
To: "John Biddiscombe" <jbiddiscombe at skippingmouse.co.uk>
Cc: <peng-cheng at uiowa.edu>; "insight-users" <insight-users at itk.org>; "Julien
Jomier" <jjomier at cs.unc.edu>
Sent: Sunday, July 11, 2004 3:55 AM
Subject: Re: [Insight-users] How to Convert ITK RGB Image to VTK Image


> Hi John,
>
> Thanks for pointing this out.
>
> We were able to reproduce the problem you reported
> and we are looking for a source, but it doesn't seem
> to be just a simple bug for GBR. It looks like we
> are skipping ByteSwapping in some place where it
> must have been done.
>
> .... still looking for the real solution....
>
>
> Regards,
>
>
>     Luis
>
>
> --------------------
> John Biddiscombe wrote:
>
> > Go to itkVTKImageExport.txx in Code/BasicFilters
> >
> > at line 79 or nearby add the following lines
> >
> > else if(typeid(ScalarType) == typeid(itk::RGBPixel<unsigned char>))
> > {
> >     m_ScalarTypeName = "unsigned char";
> > }
> >
> > This will now work providing your image type is itk::RGBPixel<unsigned
char>
> > if you're using itk::RGBPixel<float> or <double>, then add the similar
lines
> > for those cases (return "float" or "double". It should still work. The
> > number of components is computed from
> > sizeof(pixeltype)/sizeof(primitivetype), which gives 3 in our case
> > (regaredless of which type, providing you get it right).
> >
> > This is how I'm converting TIFF images. Except that I've got RGB mixed
up
> > and I have GBR instead. I'll look at that today and see if the image
maper
> > is expecting components reversed etc.
> >
> > JB
> >
> >
> >
> > ----- Original Message ----- 
> > From: "Patrick (Peng) Cheng" <peng-cheng at uiowa.edu>
> > To: "insight-users" <insight-users at itk.org>
> > Sent: Thursday, July 08, 2004 10:34 PM
> > Subject: [Insight-users] How to Convert ITK RGB Image to VTK Image
> >
> >
> >
> >>Hi,
> >>I use the itkImageToVTKImageFilter, but there is an error when I new a
> >
> > instance of this filter. What's going wrong?
> >
> >>typedef itk::RGBPixel< float > RGBPixelType;
> >>typedef itk::Image<RGBPixelType,3> RGBImageType;
> >>typedef itk::ImageToVTKImageFilter< RGBImageType > RGB2VTK;
> >>RGBImageType::Pointer m_RGBImage = RGBImageType::New();    <-----
> >>---------------------------
> >>Peng (Patrick) Cheng
> >>Biomedical Engineering
> >>University of Iowa
> >>Tel:(319) 400-7442
> >>Email: peng-cheng at uiowa.edu
> >>
> >>
> >>
> >>
> >>_______________________________________________
> >>Insight-users mailing list
> >>Insight-users at itk.org
> >>http://www.itk.org/mailman/listinfo/insight-users
> >
> >
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
> >
>
>
>
>



More information about the Insight-users mailing list