[Insight-users] Convert vector field from vtkUnstructuredGrid to itk::Image with interpolation

Luis Ibanez luis.ibanez at kitware.com
Fri Dec 11 11:38:33 EST 2009


Hi Dirk,

Two options:

     A) Use any of the KernelTranforms
http://www.itk.org/Doxygen/html/classitk_1_1KernelTransform.html
         for example the
http://www.itk.org/Doxygen/html/classitk_1_1ThinPlateSplineKernelTransform.html


or

    B) Use the itkBSplineScatteredDataPointSetToImageFilter.h


---

If you go for (A), you can set the Source Landmarks to the
positions of the tails of the vectors, and put the Target landmarks
to the positions of the heads of the vectors.

Then you can simply use the TransformPoint() method, to
evaluate the value of the Vector at every new point in space.
Note that the transform will give you the position of the head
of the vector, therefore, to get the actual vector you need to
do:

    VectorType v =  transform->TransformPoint( p )  -  p;

---

If you go for (B), please read the following paper in the
Insight Journal:

N-D C^k B-Spline Scattered Data Approximation
Tustison N.J., Gee J.C.
PICSL, University of Pennsylvania

http://hdl.handle.net/1926/140
http://www.insight-journal.org/browse/publication/57



Regards,


       Luis



------------------------------------------------------------
On Thu, Dec 10, 2009 at 5:47 AM, Dirk Boye <body at nabla.org> wrote:
> Dear list,
>
> Let's say I have a list of vectors in an vtkUnstructuredGrid like
> this:
>
> # vtk DataFile Version 3.0
> vtk output
> ASCII
> DATASET UNSTRUCTURED_GRID
> POINTS 5 float
> -2 2 0 2 2 0 0 0 0
> -2 -2 0 2 -2 0
> CELL_TYPES 0
>
> POINT_DATA 5
> VECTORS vectors float
> 1 -1 0 1 1 0 1 0 0
> 1 1 0 1 -1 0
>
>
> I'd like to create a continuous vector field 'image' of dimensions
> 4x4x1 with a spacing of 1.
>
> How can I read the vectors into a itk::Image and do an interpolation
> (BSpline for example) on the vectors?
> Usually one resamples an image and interpolates the new pixels... but
> with only some vectors given like above and given image dims/spacing
> I have no clue.
>
> Attached image is a sketch of what I'd like to do :)
>
> Are there any nice classes to do that?
>
> Thanks,
> Dirk
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list