[vtkusers] Color compositions

John Biddiscombe jbiddiscombe at skippingmouse.co.uk
Wed Mar 21 13:53:07 EST 2001


see docs...

vtkImageAppendComponents takes the components from two inputs and merges 
them into one output. If Input1 has M components, and Input2 has N 
components, the output will have M+N components with input1 components 
coming first.

JB
(Use two of them!)


At 18:49 21/03/2001, Jordi Inglada wrote:

>Hi all,
>
>Is there an easy way to create an RGB (and/or HSV) image from 3 grey-scale
>images?
>
>By now, I have done this:
>
>   sum2 = vtkImageMathematics::New();
>   sum1 = vtkImageMathematics::New();
>   R = vtkImageConstantPad::New();
>   G = vtkImageExtractComponents::New();
>   B = vtkImageExtractComponents::New();
>
>
>   R->SetInput(input1);
>   R->SetOutputNumberOfScalarComponents(3);
>   R->SetConstant(0);
>
>   vtkImageConstantPad* padG = vtkImageConstantPad::New();
>   padG->SetInput(input2);
>   padG->SetOutputNumberOfScalarComponents(3);
>   padG->SetConstant(0);
>
>
>   G->SetInput(padG->GetOutput());
>   G->SetComponents(1,0,2);
>
>
>   vtkImageConstantPad* padB = vtkImageConstantPad::New();
>   padB->SetInput(input3);
>   padB->SetOutputNumberOfScalarComponents(3);
>   padB->SetConstant(0);
>
>
>    B->SetInput(padB->GetOutput());
>    B->SetComponents(1,2,0);
>
>   sum1->SetInput2(G->GetOutput());
>   sum1->SetOperationToAdd();
>
>   sum2->SetInput1(sum1->GetOutput());
>   sum2->SetInput2(B->GetOutput());
>   sum2->SetOperationToAdd();
>
>   return sum2->GetOutput();
>
>But I guess there must be an easier way. I have found the classes
>vtkImageRGBToHSV and its inverse, but my problem is building a 3-channel
>image from 3 1-channel images. From there I can use these classes for
>colorspace transformations.
>
>Thanks.
>
>--
>Jordi Inglada
>CNES - Centre Spatial de Toulouse
>DSO/OT/QTIS/SR - BPI 811
>18, avenue Edouard Belin
>31401 Toulouse Cedex 04 - France
>Tel. +33.(0)5.61.27.33.97 - Fax. +33.(0)5.61.28.31.09
>GSM: +33.(0)6.89.32.92.94
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers





More information about the vtkusers mailing list