[vtkusers] Image blending using a lookup table
"Tim Hütz (VTK)"
vtk at huetz.biz
Wed Mar 3 03:53:27 EST 2010
Hey everybody,
I'm trying to create a image fusion using the vtkImageBlend class. For doing this, I'm using the following source code:
> vtkPNGReader *imgReader = vtkPNGReader::New();
> imgReader->SetFileName( "reference.png" );
>
> vtkPNGReader *imgReaderMoving = vtkPNGReader::New();
> imgReaderMoving->SetFileName( "moving.png" );
>
> vtkImageBlend *imgBlender = vtkImageBlend::New();
> imgBlender->SetOpacity( 0, 0.5 );
> imgBlender->SetOpacity( 1, 0.5 );
> imgBlender->SetInput( 0, imgReader->GetOutput() );
> imgBlender->SetInput( 1, imgReaderMoving->GetOutput() );
>
> vtkDataSetMapper *imgDataSetMapper = vtkDataSetMapper::New();
> imgDataSetMapper->SetInput( reinterpret_cast< vtkDataSet* >( imgBlender->GetOutput() ) );
>
> vtkActor *imgActor = vtkActor::New();
> imgActor->SetMapper( imgDataSetMapper );
>
> vtkRenderer *imgRenderer = vtkRenderer::New();
> imgRenderer->AddActor( imgActor );
>
> vtkRenderWindow *imgRenderWindow = vtkRenderWindow::New();
> imgRenderWindow->AddRenderer( imgRenderer );
>
> vtkRenderWindowInteractor *imgInteractor = vtkRenderWindowInteractor::New();
> imgInteractor->SetRenderWindow( imgRenderWindow );
> imgInteractor->Initialize();
> imgInteractor->Start();
If I now assign a vtkLookupTable to the 'imgDataSetMapper' object, the blending will disappear in favorite to the
color map.
> vtkLookupTable * imgFirstColorMap = vtkLookupTable::New();
> imgFirstColorMap->SetRange( 0, 255 );
> imgFirstColorMap->SetNumberOfColors( 256 );
>
> imgDataSetMapper->SetLookupTable( imgFirstColorMap );
> imgDataSetMapper->SetColorModeToMapScalars();
Can anybody give me a advice, how I can use VTK to create a image fusion of two images each with its separate lookup table?
Thanks in advance and best regards,
Tim
More information about the vtkusers
mailing list