[vtkusers] programmable filter pipeline
Dean Inglis
dean.inglis at camris.ca
Fri Feb 4 09:04:44 EST 2011
Im inheriting from vtkProgrammableFilter to encapsulate pipeline
segments for doing curved planar reformats (simulated dental x-ray
panoramic ).
The first filter works perfectly: 2D polydata line input generates
3D polydata vertex sampling grid. The second filter sets up vtkProbeFilter
with the grid as input, and a 3D image as source. The trouble begins
when I pass the output as a 2D vtkImageData to a
vtkImageMapToWindowLevelColors
/ vtkImageActor downstream for visualization. I keep getting pixel index
out of range /not within extent errors. Within the filter's user supplied
execute method, I retrieve the filter's generated output which is a copy
of the input 3D vtkImageData by default, I then set it up to take
flattened geometry from the grid and the scalars generated by the probe
filter:
vtkImageData* image = this->GetOutput();
double origin[3] = {0,0,0};
image->Initialize();
image->SetScalarType(this->Image->GetScalarType()); // the type of the
input image
image->SetExtent(this->OutputExtent); // extent
defined by the grid
image->SetNumberOfScalarComponents(1);
image->SetOrigin(origin);
image->SetSpacing(this->OutputSpacing); // spacing
defined by the grid
image->AllocateScalars();
image->GetPointData()->GetScalars()->FillComponent(0,0); // just in case!
this->Probe->Update();
image->GetPointData()->GetScalars()->DeepCopy(
this->Probe->GetOutput()->GetPointData()->GetScalars());
image->Modified();
Since the upstream pipeline information seems to be based on the input
3D image, would I modify a vtkInformation object here to correctly prepare
the downstream filters' requests? Anyone know how to do this? There
is, AFAIK, no substantial/detailed documentation on the nuts and bolts of
the VTK
pipeline architecture. I think I need similar workings from
vtkImageChangeInformation
to accomplish this.
Dean
More information about the vtkusers
mailing list