[vtkusers] vtkDataArray - SetPointData??

Christian Werner christian.werner at rwth-aachen.de
Mon Feb 15 07:27:09 EST 2010


Hello!

I am desperately trying to write a VTK-ITK-VTK filter for the 
VTK-Pipeline. The idea is to have a basis class that manages all the 
conversion stuff and has some templated function ApplyITKFilter(...) 
function that allows direct ITK access on an image, so the users can 
instantly start with some myItkFilter->SetInput(vtkPipelineOutput). This 
class could then be derived and the user would just have to override the 
ApplyITKFilter function and don't even care about any vtkImageData and 
such...

I implemented something that perfectly works outside the pipeline. It is 
some sort of a "sandbox" pipeline and allows such data flow:

 vtkImageData=>itk::Image<foo,x>=>ITKFilter=>vtkImporter=>vtkImageData*.

This is templated so the user does not have to care about what image 
type he is handling. Unfortunately, that returned vtkImageData* is not 
easily integrated into the VTK pipeline. I have seen an example which 
uses the vtkSimpleImageToImageFilter class to create a new filter:

void vtkDislev::SimpleExecute(vtkImageData* input, vtkImageData* output)
{
    int dim[3];
    input->GetDimensions(dim);
    int numvox  = dim[0]*dim[1]*dim[2];
    int numcomp = input->GetNumberOfScalarComponents();
    
    vtkDataArray* inarray  = input->GetPointData()->GetScalars();
    vtkDataArray* outarray = output->GetPointData()->GetScalars();

        ...write data into outarray
}


I do not see any point here where I could make the output be my 
vtkImageData* that I obtain from my sandbox pipeline.

What seems to be a good idea is if I could just set the DataArray of the 
output to what I get from my setup, like a 
output->SetPointData(myVtkImageData->GetPointData()), but unfortunately 
there is no function to set the point data.

I am lost on that and would appreciate any help.


Best regards,
Christian



More information about the vtkusers mailing list