<div dir="ltr">Use vtkImageReslice to rotate vtkImageData<br><br>This should help you going (though messy)<br><br> //convert angle from degree to radian<br> double angleInRads=vtkMath::RadiansFromDegrees(angle);<br> double cosAngle=cos(angleInRads);<br>
double sinAngle =sin(angleInRads);<br> qDebug()<<"cos & sin:"<<cosAngle<<sinAngle;<br><br> static double axialElements[16] = {<br> 1, 0, 0, 0, //1,0,0,0<br>
0,cosAngle,-sinAngle, 0, //0,-1,0,0<br> 0, sinAngle,cosAngle, 0, //0,0,-1,0<br> 0, 0, 0, 1 }; //0,0,0,1<br><br><br> // Set the slice orientation<br>
vtkSmartPointer<vtkMatrix4x4> resliceAxes =<br> vtkSmartPointer<vtkMatrix4x4>::New();<br> resliceAxes->DeepCopy(axialElements);<br> // Set the point through which to slice<br> resliceAxes->SetElement(0, 3,0);<br>
resliceAxes->SetElement(1, 3,0);<br> resliceAxes->SetElement(2, 3,0);<br><br><br> vtkSmartPointer<vtkImageReslice> res=<br> vtkSmartPointer<vtkImageReslice>::New();<br> res->SetInput( imgData);<br>
res->SetInformationInput( imgData);<br> res->SetResliceAxes(resliceAxes);<br> res->SetInterpolationModeToLinear();<br> res->Update();<br> this->rotatedImageData=res->GetOutput();<br><br><br>
Jothy<br><br><div class="gmail_quote">On Fri, Jun 29, 2012 at 3:48 PM, David Doria <span dir="ltr"><<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Fri, Jun 29, 2012 at 10:45 AM, Jonathan Ruiz Peinado<br>
<<a href="mailto:jonathan.ruiz3@gmail.com">jonathan.ruiz3@gmail.com</a>> wrote:<br>
> Hi, I need to apply some transformations to a vtkImageData, I though that I<br>
> could use vtkTransform or vtkTransformFilter to setup the trasnformation<br>
> put my imageData as input and get the result as the output of<br>
> vtkTransformFilter, but it's seems not that easy, there's some example about<br>
> it around or something I'm missing.<br>
><br>
> Thanks.<br>
<br>
</div></div>Can you tell us what isn't working? Compiler errors? Incorrect<br>
results? Also please show the code you are using in a very simple<br>
example case.<br>
<br>
David<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a 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 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 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><div dir="ltr">Jothybasu Selvaraj<br>PhD Student<br>University of Liverpool<br>UK<br></div><br>
</div>