[vtkusers] Correctly vtkImageBlend use?
Ana Sandro
garufa7000 at hotmail.com
Thu Feb 23 06:31:18 EST 2006
Hello everybody,
I want to visualize two images together like if they were only one.So I
read them with itk,I connect them to vtk and later I put them at the entries
of vtkImageBlend.( I adjunt this code below).This way I get an error because
I put vtkImageData into vtkImageBlend and it needs vtkImageStencilData.This
is the error I get:
ERROR: In D:\ana\Programas\VTK-5.0.0\Filtering\vtkDemandDrivenPipeline.cxx,
line 774
vtkStreamingDemandDrivenPipeline (0x02A79170): Input for connection index 0
on input port index 1 for algorithm vtkImageBlend(0x02A76480) is of type
vtkImageData, but a vtkImageStencilData is required.
I don't know how to get vtkImageData to be vtkImageStencilData.Maybe I have
to use another class instead of vtkImageBlend or use some filter before
using it.If someone could orientate me I'd thank it very much because I have
no idea of how to get it.
This is my code:
typedef itk::Image<signed short,2> ImageType1;
typedef itk::ImageFileReader<ImageType1> ReaderType1;
typedef itk::ImageToVTKImageFilter<ImageType1> ConnectorType1;
ReaderType1::Pointer reader1= ReaderType1::New();
ConnectorType1::Pointer connector1= ConnectorType1::New();
reader1->SetFileName("imagen1.dcm");
connector1->SetInput( reader1->GetOutput() );
//the same for the other image
typedef itk::Image<unsigned short,2> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
typedef itk::ImageToVTKImageFilter<ImageType> ConnectorType;
ReaderType::Pointer reader= ReaderType::New();
ConnectorType::Pointer connector= ConnectorType::New();
reader->SetFileName("imagen.dcm");
connector->SetInput( reader->GetOutput() );
vtkImageBlend* blend = vtkImageBlend::New();
blend->SetOpacity(0, 0.5);
blend->SetOpacity(1, 0.5);
blend->SetInput(0,connector1->GetOutput()); //that's the fail.
blend->SetInput(1,connector->GetOutput());
_________________________________________________________________
Dale rienda suelta a tu tiempo libre. Mil ideas para exprimir tu ocio con
MSN Entretenimiento. http://entretenimiento.msn.es/
More information about the vtkusers
mailing list