[vtkusers] vtkTransform to transform vtkImageData

Jonathan Ruiz Peinado jonathan.ruiz3 at gmail.com
Fri Jun 29 11:23:50 EDT 2012


Ok, but I'll need vtkImageData to use it as input of another object, how
could I get vtkTransformFilter output to build and imagedata object ?

thanks
2012/6/29 David E DeMarle <dave.demarle at kitware.com>

> vtkImageData is defined to be axis aligned so it can not be
> arbitrarily transformed. Thus the cast in:
>   vtkimageData test = (vtkImageData) work_axis.GetOutputDataObject(0);
> can not work.
>
> Try:
>  vtkStructuredGrid test = (vtkStructuredGrid)
> work_axis.GetOutputDataObject(0);
> instead.
>
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-4909
>
>
> On Fri, Jun 29, 2012 at 11:12 AM, David Doria <daviddoria at gmail.com>
> wrote:
> > 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
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120629/f5077315/attachment.htm>


More information about the vtkusers mailing list