1 #ifndef ITKVTKCOLORTRANSFERFUNCTION_TXX
2 #define ITKVTKCOLORTRANSFERFUNCTION_TXX
7 template< class TypeImage>
8 VTKColorTransferFunction<TypeImage>::VTKColorTransferFunction()
13 template< class TypeImage>
14 VTKColorTransferFunction<TypeImage>::~VTKColorTransferFunction()
19 template< class TypeImage>
20 void VTKColorTransferFunction<TypeImage>::Update(){
21 GenerateOutputInformation();
25 template< class TypeImage>
26 void VTKColorTransferFunction<TypeImage>::GenerateOutputInformation(){
27 m_Output = vtkColorTransferFunction::New();
32 template< class TypeImage>
33 void VTKColorTransferFunction<TypeImage>::GenerateData(){
37 InputImagePointerType imagergb = this->GetInput();
40 itkExceptionMacro(<<"Set the image first!");
44 typedef itk::ImageRegionConstIterator< InputImageType > rgbiteratorType;
45 rgbiteratorType rgbit(imagergb, imagergb->GetLargestPossibleRegion());
51 m_Output->RemoveAllPoints ();
54 while(!rgbit.IsAtEnd()){
57 typename InputImageType::PixelType::ComponentType lum = 0.299*rgbit.Get()[0] + 0.587*rgbit.Get()[1] + 0.114*rgbit.Get()[2];
59 m_Output->AddRGBPoint(lum, rgbit.Get()[0]/255.0, rgbit.Get()[1]/255.0, rgbit.Get()[2]/255.0);