[vtkusers] Rotating ImageData from vti file

Christoffer Green christoffer.green at gmail.com
Fri Apr 13 09:50:23 EDT 2012


Thank you for the suggestion.

The reason for needing rotated data is that we have one application that
handles images from magnetic resonance cameras, these images come in the
form of 3d (and time resolved) volumes and 2d planes. We also have another
application (based on paraview) that is used to display these types of
images and do things such things as create streamline visualizations with
them.
The problem then is to get data from one application to the other,
preferably in a format that supports volume rendering in paraview.
Currently it appears that we will need to set a limit on one volume for
export and then reorient every 2d imageplane object to that volumes
orientation. This way we can get everything in the right position and also
get volume rendering of the volume data. But it is a bit less then pretty.

The idea of using state files is interesting, thank you for suggesting it,
I shall give it consideration. I have previously looked at the orientation
attribute and it appears to be locked to a 3d view, add the object to
another 3d view and the orientation is reset, this would be quite bad. But
perhaps I have just misunderstood it.


BR/ Christoffer

On Fri, Apr 13, 2012 at 3:26 PM, Cory Quammen <cquammen at cs.unc.edu> wrote:

> Christopher,
>
> You didn't say exactly what you want to do with such rotated data, so
> I'll make a leap and assume you just want to display it in ParaView.
>
> If that's the case, then within ParaView, you can set a transform on a
> data object by selecting the object in the pipeline browser, selecting
> the Display tab, and scrolling down to the bottom until you see the
> Transformation section. Here you can apply a rotation by changing the
> orientation.
>
> You can define this rotation in an XML state file that you can then
> import into ParaView. To generate an example, try loading an image in
> ParaView, applying a transformation, selecting File->Save State, and
> then examine the contents of the state file. Look for a Property
> element with a name attribute "Orientation".
>
> Hope that helps,
> Cory
>
> On Fri, Apr 13, 2012 at 5:18 AM, Christoffer Green
> <christoffer.green at gmail.com> wrote:
> > Thank you for the reply.
> >
> > Interesting, I had not realized that vtk cannot handle rotated image data
> > (without conversion/interpolation), that explains why there are no such
> > properties in the xml file.
> >
> > Well, that throws quite the wrench in my plans, but thanks for letting me
> > know :)
> >
> > BR/ Christoffer
> >
> >
> > On Thu, Apr 12, 2012 at 3:53 PM, David E DeMarle <
> dave.demarle at kitware.com>
> > wrote:
> >>
> >> No, vtk's image data is defined to be axis aligned.
> >> You have to apply filters to transform them (and change type to
> >> structuredgrid in the process), so the image data file formats are not
> >> the place to specify the transformation you want.
> >>
> >> David E DeMarle
> >> Kitware, Inc.
> >> R&D Engineer
> >> 21 Corporate Drive
> >> Clifton Park, NY 12065-8662
> >> Phone: 518-881-4909
> >>
> >>
> >>
> >> On Wed, Apr 11, 2012 at 12:54 PM, Christoffer Green
> >> <christoffer.green at gmail.com> wrote:
> >> > My question was if it is possible to define this within the xml file
> >> > itself.
> >> >
> >> > Thanks.
> >> >
> >> > BR/ Christoffer
> >> >
> >> >
> >> > On Wed, Apr 11, 2012 at 4:20 PM, Jothybasu Selvaraj
> >> > <jothybasu at gmail.com>
> >> > wrote:
> >> >>
> >> >> Using vtkImageReslice you could rotate the vtkImageData.
> >> >>
> >> >>
> >> >> You need to create a vtkMatrix4x4 for the rotation nad pass this
> matrix
> >> >> to
> >> >> vtkImageReslice::
> >> >> SetReSliceAxes
> >> >>
> >> >> Jothy
> >> >>
> >> >>
> >> >> On Wed, Apr 11, 2012 at 3:17 PM, Jothybasu Selvaraj
> >> >> <jothybasu at gmail.com>
> >> >> wrote:
> >> >>>
> >> >>> Using vtkImageReslice you could rotate the vtkImageData?
> >> >>>
> >> >>> You need to create a vtkMatrix4x4 for the rotation nad pass this
> >> >>> matrix
> >> >>> to vtkImageReslice::SetReSliceAxes
> >> >>>
> >> >>> Jothy
> >> >>>
> >> >>> On Wed, Apr 11, 2012 at 3:10 PM, Christoffer Green
> >> >>> <christoffer.green at gmail.com> wrote:
> >> >>>>
> >> >>>> Hello!
> >> >>>>
> >> >>>> I have been trying to figure out if it is possible to rotate data
> >> >>>> directly from a imagedata xml file. Can anyone lend me a hand on
> how
> >> >>>> to do
> >> >>>> that?
> >> >>>>
> >> >>>> I am currently exporting data from matlab to a .vti imagedata xml
> >> >>>> file
> >> >>>> and importing it to paraview (that is I am writing the file without
> >> >>>> using
> >> >>>> vtk classes) but I
> >> >>>> do not know how to rotate the data. According to
> >> >>>> the www.vtk.org/VTK/img/file-formats.pdf file there is a
> Coordinate
> >> >>>> tag
> >> >>>> but it does not appear to have an effect when importing, but on the
> >> >>>> other hand its barely documented and I am really just guessing on
> how
> >> >>>> to use
> >> >>>> it.
> >> >>>>
> >> >>>> Currently I am testing with this data (but my actual data is much
> >> >>>> larger):
> >> >>>>
> >> >>>> <?xml version="1.0"?>
> >> >>>> <VTKFile type="ImageData" version="0.1" byte_order="LittleEndian">
> >> >>>> <ImageData WholeExtent="0 1 0 1 0 0" Origin="0.0 0.0 0.0"
> >> >>>> Spacing="0.4
> >> >>>> 0.4 0.4">
> >> >>>> <Piece Extent="0 1 0 1 0 0">
> >> >>>> <Coordinates>
> >> >>>> <DataArray type="Float32" Name="x_coordinate" format="ascii">0.0
> 0.3
> >> >>>> 0.0</DataArray>
> >> >>>> <DataArray type="Float32" Name="y_coordinate" format="ascii">0.5
> 0.2
> >> >>>> 0.0</DataArray>
> >> >>>> <DataArray type="Float32" Name="z_coordinate" format="ascii">1.0
> 0.0
> >> >>>> 0.0</DataArray>
> >> >>>> </Coordinates>
> >> >>>> <PointData>
> >> >>>> <DataArray type="Float32" Name="MagnitudeArray" format="ascii">0.1
> >> >>>>  0.3
> >> >>>>  0.5  0.8</DataArray>
> >> >>>> </PointData>
> >> >>>> </Piece>
> >> >>>> </ImageData>
> >> >>>> </VTKFile>
> >> >>>>
> >> >>>> Thanks
> >> >>>>
> >> >>>> BR/ Christoffer
> >> >>>>
> >> >>>> _______________________________________________
> >> >>>> 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
> >> >>>>
> >> >>>
> >> >>>
> >> >>>
> >> >>> --
> >> >>> Jothy
> >> >>>
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Jothy
> >> >>
> >> >
> >> >
> >> > _______________________________________________
> >> > 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
> >> >
> >
> >
> >
> > _______________________________________________
> > 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
> >
>
>
>
> --
> Cory Quammen
> Research Associate
> Department of Computer Science
> The University of North Carolina at Chapel Hill
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120413/a3867eb7/attachment.htm>


More information about the vtkusers mailing list