[vtkusers] problem with vtkGridTransform
Pallavi Joshi
pallavi.joshi at vanderbilt.edu
Wed Jul 7 12:40:33 EDT 2004
Hi All,
I have a C array pointer with 3 displacement fields dx,dy,dz for each voxel of my image volume. I import this pointer using vtkImageImport by using the following piece of code:
vtkImageImport *importer = vtkImageImport::New();
importer->SetWholeExtent(0,255,0,255,0,255);
importer->SetDataExtentToWholeExtent();
importer->SetDataScalarTypeToUnsignedShort();
importer->SetDataSpacing(1,1,1);
importer->SetImportVoidPointer(dr);
where, 'dr' is my array pointer. The dimensions of my image volume are 256x256x256 with voxel dimensions of 1mmx1mmx1mm. Hence I have created a vtkImageData with the extent of 0,255,0,255,0,255 as done above. Does this mean that I create a grid of dimensions 256x256x256 and spacing of 1x1x1 and each grid element will carry my 3 displacement vector values dx,dy,dz. ? I am using the following piece of code for transformation:
vtkGridTransform *nrtransf = vtkGridTransform::New();
nrtransf->SetDisplacementGrid(importer->GetOutput());
nrtransf->SetInterpolationModeToCubic();
vtkPolyDataReader *reader = vtkPolyDataReader::New();
reader->SetFileName("//isotropic/brainstem.vtk");
vtkTransformPolyDataFilter *def = vtkTransformPolyDataFilter::New();
def->SetInput( reader->GetOutput() );
def->SetTransform( nrtransf );
Is this code correct ? I am getting some error in vtkGridTransform. I am not able to figure out how to fix it.
Could anyone please help me and guide me in the right direction ?
Thank You very much,
Pallavi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040707/605eef5f/attachment.htm>
More information about the vtkusers
mailing list