AW: [vtkusers] Correctly vtkImageBlend use?

Erbacher, Markus Markus.Erbacher at med.uni-heidelberg.de
Thu Feb 23 06:58:05 EST 2006


You need to do it like that:

Both inputs need to be on the same port.

vtkImageBlend* blend = vtkImageBlend::New();
blend->SetOpacity(0, 0.5);
blend->SetOpacity(1, 0.5);
blend->AddInput(0,connector1->GetOutput());  //Here is the change
blend->AddInput(0,connector->GetOutput());  //Here is the change




-----Ursprüngliche Nachricht-----
Von: Ana Sandro [mailto:garufa7000 at hotmail.com] 
Gesendet: Donnerstag, 23. Februar 2006 12:31
An: vtkusers at vtk.org
Betreff: [vtkusers] Correctly vtkImageBlend use?


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/

_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ Follow this link to subscribe/unsubscribe: http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list