[vtkusers] Rotating ImageData from vti file

Cory Quammen cquammen at cs.unc.edu
Fri Apr 13 09:26:43 EDT 2012


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



More information about the vtkusers mailing list