[Insight-users] Tif RGB wrong way around?

Lorensen, William E (Research) lorensen at crd.ge.com
Mon Jul 19 16:51:56 EDT 2004


We have found the problem. Nothing in the tiff stuff. It was a problem (a
couple actually) in the ConvertBuffer code. There still are some issues
regarding the handling of alpha channels, but I've checked in the changes to
fix the color problems.

Bill 

-----Original Message-----
From: John Biddiscombe [mailto:jbiddiscombe at skippingmouse.co.uk]
Sent: Friday, July 09, 2004 11:03 AM
To: John Biddiscombe; Julien Jomier; insight-users at itk.org
Subject: Re: [Insight-users] Tif RGB wrong way around?


After doing some digging I became convinced that there is nothing wrong with
the itk->vtk RGB pixels and so I tried exporting my TIFF as bmp using the
following code. The exported Bitmap has RGB components the wrong way around.

I'm therefore reasonably confident that the TIFF reader is messing about.

I'll modify my local version to give what I hope will be the correct images
and post a patch should anyone else have trouble.

JB


typedef itk::ImageFileReader< ImageTypeRGB2D > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
//
reader->SetFileName( filename );
//
try
{
reader->Update();
}
catch( itk::ExceptionObject & err )
{
std::cout << "ExceptionObject caught !" << std::endl;
std::cout << err << std::endl;
return NULL;
}
typedef itk::ImageFileWriter< ImageTypeRGB2D > WriterType;
WriterType::Pointer writer = WriterType::New();
//
writer->SetFileName("D:/Test.bmp");
writer->SetInput(reader->GetOutput());
writer->Update();
return reader->GetOutput();


----- Original Message ----- 
From: "John Biddiscombe" <jbiddiscombe at skippingmouse.co.uk>
To: "Julien Jomier" <jjomier at cs.unc.edu>; <insight-users at itk.org>
Sent: Thursday, July 08, 2004 6:59 PM
Subject: Re: [Insight-users] Tif RGB wrong way around?


> Thanks. I should have thought of trying that! I'll look for a mistake in
my
> code somewhere.
>
> JB
>
> ----- Original Message ----- 
> From: "Julien Jomier" <jjomier at cs.unc.edu>
> To: "'John Biddiscombe'" <jbiddiscombe at skippingmouse.co.uk>;
> <insight-users at itk.org>
> Sent: Thursday, July 08, 2004 6:47 PM
> Subject: RE: [Insight-users] Tif RGB wrong way around?
>
>
> Hi John,
>
> I just tried to read a RGB tiff image and write it as JPEG and BMP using
ITK
> and the resulting image appears to be valid so I guess the channels are in
> the correct order when reading the file.
>
> Hope this helps,
>
> Julien
>
> > -----Original Message-----
> > From: insight-users-bounces at itk.org
> > [mailto:insight-users-bounces at itk.org] On Behalf Of John Biddiscombe
> > Sent: Thursday, July 08, 2004 12:56 PM
> > To: insight-users at itk.org
> > Subject: [Insight-users] Tif RGB wrong way around?
> >
> >
> > I've connected itk::TiffImageIO to a vtk pipeline and found that when
> > reading RGB colour images the data looks as though its GBR
> > instead of RGB.
> > Red and blue channels swapped. I notice that the Tif test in
> > testing/code/io
> > uses a black and white image with R=G=B channels so this wouldn't be
> > spotted.
> >
> > Can anyone else easily check if TiffImageIO is getting R and
> > B the wrong way
> > around? It might be me passing the data into vtk, but since I'm using
> > SetImportVoidPointer directly and not modifying the actual
> > pixels, it should
> > be the same as when it was read.
> >
> > thanks
> >
> > JB
> >
> > _______________________________________________
> > 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
>
> _______________________________________________
> 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