[vtkusers] Apply a transform to an image

David Gobbi david.gobbi at gmail.com
Thu Jul 24 17:06:16 EDT 2008


Hello anonymous poster,

There are ways of applying a transform to a vtkImageData.  Trying to
convert the image to a polydata first would be the wrong thing to do.

Take a look at these examples in the "Hybrid" directory:

Hybrid/Testing/Tcl/TestThinPlateWarp3D.tcl
Hybrid/Testing/Tcl/TestGridWarp3D.tcl

   David



On Thu, Jul 24, 2008 at 4:58 PM, P B <chose29 at hotmail.com> wrote:
> Hi,
>
>    I am new to vtk and struggling with conversions of images. I need to
> transform a volume (MRI dataset) using the thin plate spline algorithm.
>
> The volume is read from vtkDICOMImageReader and I have access to a
> vtkImageData structure. I want to apply the transformation with
> vtkTransformPolyDataFilter, unfortunatly, I get a message specifying I need
> to give a PolyData structure instead of an image. Does anyone have a
> solution? Is there a conversion available in vtk? or I am using the
> transforms in a wrong way?
>
> Thanks in advance for your help!
>
>
>
> here is the code, if it might be usefull to understand my problem:
>
> ____________________________________________________________________________
> vtkTransformPolyDataFilter *f11 = vtkTransformPolyDataFilter::New ();
> vtkGeneralTransform *t1 = vtkGeneralTransform::New ();
>
> t1->SetInput (TPSTransfo); // TPSTransfo is of type
> vtkThinPlateSplineTransform
>
> // reading a dicom series
> vtkDICOMImageReader *Reader = vtkDICOMImageReader::New();
> Reader->SetDirectoryName(mDicomFile.getString());
> Reader->Update();
> const char * Name = Reader->GetPatientName();
> SoDebugError::post( __FILE__, "Patient name is : %s", Name );
>
>
>
> f11->SetInput ((vtkDataObject*)Reader->GetOutput()); // <- error comes from
> here. "GetOutput" gives a structure of type vtkImageData
> f11->SetTransform (t1);
> f11->Update ();
>
>
>
>
>
> ________________________________
> _______________________________________________
> 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