<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<blockquote type="cite">However, if you are looking to transform the
data itself, your only
option is to transform the imagedata to polys using
vtkImageDataGeometryFilter and then transforming this using
vtkTransformPolyDataFilter.</blockquote>
<br>
I have been able to accomplish what I think Richard original asked by
using<br>
<br>
vtkImageReslice *reslice;<br>
<br>
I put the transform on this and it transforms all my image data which
is not axis aligned into world<br>
coordinates correctly.<br>
<br>
Small snippet:<br>
-----------------------------------------------------------------------------------------------------------------------------<br>
volume_reader = vtkImageReader::New();<br>
volume_reader->SetFileName(data_filename);<br>
volume_reader->SetFileDimensionality(3);<br>
volume_reader->SetDataExtent(0,(int) xsize - 1,0,(int)ysize -
1,0,(int) zsize - 1);<br>
volume_reader->SetDataSpacing(voxel_size,voxel_size,voxel_size);<br>
volume_reader->FileLowerLeftOn();<br>
volume_reader->SetDataOrigin(origin);<br>
volume_reader->SetDataScalarTypeToUnsignedChar();<br>
volume_reader->SetDataByteOrderToBigEndian();<br>
<br>
/* You may or may not need a permutation matrix here to have your
volume put in */<br>
/* correctly. Mine starts at the upper left and not lower left */<br>
permutation_xform = vtkTransform::New();<br>
permutation_matrix = vtkMatrix4x4::New();<br>
permutation_matrix->Identity();<br>
permutation_matrix->SetElement(1,1,-1);<br>
permutation_matrix->SetElement(2,2,-1);<br>
permutation_xform->SetMatrix(permutation_matrix);<br>
volume_reader->SetTransform(permutation_xform);<br>
<br>
reslice_matrix = vtkMatrix4x4::New();<br>
/* stuff in your transform here */<br>
reslice_xform = vtkTransform::New();<br>
reslice_xform->SetMatrix(reslice_matrix);<br>
reslice = vtkImageReslice::New();<br>
reslice->SetInputConnection(volume_reader->GetOutputPort());<br>
reslice->SetResliceTransform(reslice_xform);<br>
<br>
image_volume = vtkVolume::New();<br>
volume_raycast_mapper = vtkFixedPointVolumeRayCastMapper::New();<br>
volume_raycast_mapper->SetInputConnection(reslice->GetOutputPort());<br>
image_volume->SetMapper(volume_raycast_mapper);<br>
renderer->AddVolume(image_volume);<br>
----------------------------------------------------------------------------------------------------------------------<br>
<br>
This works for me.<br>
<br>
Bruce<br>
<br>
<br>
Karthik Krishnan wrote:
<blockquote
cite="mid:9ddb27260902252028u34b4553j7e2992e0ba96bbb6@mail.gmail.com"
type="cite">
<div class="gmail_quote">On Wed, Feb 25, 2009 at 11:11 PM, Richard
Beare <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:richard.beare@gmail.com">richard.beare@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
I'm trying to track down appropriate vtk data representations for<br>
displaying multiple image data sets in correct relationships to one<br>
another. The source data is MRI slices.<br>
<br>
Does the vtkImageData type have the option of image axes not being<br>
aligned to world coordinates?</blockquote>
<div><br>
no<br>
<br>
</div>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Assuming
this isn't possible, what is the most appropriate data<br>
structure to use. The approach I'm thinking of is to iterate over the<br>
image in ITK, looking up world coordinates for each voxel, and<br>
building a large vtk data structure that I'd then save in a paraview<br>
compatible format.</blockquote>
<div><br>
We tend to keep the image data in its local (axis aligned) coordinate
system. You can manage local to world coordinate system mapping at the
actor level by setting a user transform (see SetUserTransform) on the
actor visualizing your data. <br>
<br>
However, if you are looking to transform the data itself, your only
option is to transform the imagedata to polys using
vtkImageDataGeometryFilter and then transforming this using
vtkTransformPolyDataFilter.<br>
<br>
</div>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
Any recommendations?<br>
_______________________________________________<br>
Powered by <a moz-do-not-send="true" href="http://www.kitware.com"
target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a moz-do-not-send="true"
href="http://www.kitware.com/opensource/opensource.html"
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a
moz-do-not-send="true" href="http://www.vtk.org/Wiki/VTK_FAQ"
target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a moz-do-not-send="true"
href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Karthik Krishnan<br>
R&D Engineer,<br>
Kitware Inc.<br>
Ph: 518 371 3971 x119<br>
Fax: 518 371 3971<br>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the VTK FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
</body>
</html>