[ITK] DOUBT USING RGB Image Color Space Transformations

JOSE ANTONIO PÉREZ CARRASCO jcarrasco79 at gmail.com
Fri Jan 23 07:29:47 EST 2015


Dear all,

I´m José Antonio Pérez, assistant professor in the Univ. of Seville.
Last week I downloaded the code provided by you from "
http://www.insight-journal.org/browse/publication/780" implementing RGB
Image Color Space Transformations.
The code separate an image into its three components in different color
spaces.

I have the following problem:

1.- I have tried to compose a 3D image using the three LAB components
obtained using the provided code. But I´ve been unable.
These are some lines of my code (not all of them):

   const   unsigned int   Dimension3 = 2;
   typedef itk::RGBPixel<unsigned char> RGBPixelType;
   typedef unsigned char  SimplePixelType3;

   typedef itk::Image< SimplePixelType3, Dimension3> CharImageType;
   typedef itk::Image<RGBPixelType, Dimension3> RGBImageType;


typedef itk::ComposeRGBImageFilter<CharImageType> ComposeRGBType15;
ComposeRGBType15::Pointer rgb16 = ComposeRGBType15::New();

typedef itk::VectorIndexSelectionCastImageFilter<RGBToLabAdaptorType10,
CharImageType> VectorCastFilterType12;

      VectorCastFilterType12::Pointer vectorCastFilter13 =
VectorCastFilterType12::New();

  vectorCastFilter13->SetIndex(0);

  vectorCastFilter13->SetInput(rgbToLabAdaptor10);



      vectorCastFilter13->SetInput(rgbToLabAdaptor10);



      vectorCastFilter13->SetIndex(0);

      rgb16->SetInput1(vectorCastFilter13->GetOutput());

      vectorCastFilter13->SetIndex(1);

      rgb16->SetInput2(vectorCastFilter13->GetOutput());

      vectorCastFilter13->SetIndex(2);

rgb16->SetInput3(vectorCastFilter13->GetOutput());


 RGBWriterType::Pointer writer15 = RGBWriterType::New();


 writer15->SetFileName(imageOutname);

 writer15->SetInput( rgb16->GetOutput() );

 writer15->Update();



The problem is that I get a 3D gray scale image with the gray image
contained in vectorCastFilter13->SetIndex(2);
Would you know how can I combine the three components LAB within a color
image? What am I doing wrong? The only way I managed to do it correctly was
creating three different vectorCastFilters and selecting a different index
for each one, and then combining them inside rgb16, but that implies three
computations of the LAB transformation.

I would very much appreciate your help.

Yours faithfully,
Jose-Antonio



-- 
------------------------------------------------------
JOSE ANTONIO PÉREZ CARRASCO
Dpto de Teoría de la Señal y Comunicaciones
Escuela Superior de Ingenieros
Universidad de Sevilla,
tfno: +34954487333
email: jperez2 at us.es
jcarrasco79 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20150123/4a26ad88/attachment-0001.html>


More information about the Community mailing list