[vtkusers] vtkTransform to transform vtkImageData

David Doria daviddoria at gmail.com
Fri Jun 29 11:12:24 EDT 2012


On Fri, Jun 29, 2012 at 11:10 AM, Jonathan Ruiz Peinado
<jonathan.ruiz3 at gmail.com> wrote:
> Sure,
>
> I think that I'm not getting the output from vtkTransformFilter correctly, I
> did it the simplest way I though to see if I was lucky but seems that is not
> that easy.
>
> Thinking a bit more I guess that vtkDataImage has to be built using the
> output , but not sure how.
>
> ---------------------------------------------------
>
> vtkTransform work_axis_transform = new vtkTransform();
> work_axis_transform.Translate(0,0,0);
>
> vtkTransformFilter work_axis = new vtkTransformFilter();
> work_axis.SetTransform(work_axis_transform);
>
> work_axis.SetInput(DicomStudio.dicomImage.getOutput());
> vtkimageData test = (vtkImageData) work_axis.GetOutputDataObject(0);
> test.GetSpacing();
> ----------------------------------------------------------------------------------------------------------
>
> test.getSpacing(); trying to access to a null pointer.
>
> Thanks.

Try calling work_axis.Update() before trying to use any of its outputs.

David



More information about the vtkusers mailing list