Hi everyone,<br><br>I had posted yesterday about the rotation not being around the center of the data slice, even after calling vtkImageChangeInformation.<br><br><a href="http://public.kitware.com/pipermail/vtkusers/2006-September/087065.html">
http://public.kitware.com/pipermail/vtkusers/2006-September/087065.html</a><br><br>I figured out which call was causing that problem. However, I am still not sure how to fix it.<br><br>I was calling AutoCropOutputOn() on the reslicer but it does not like that when doing rotations it seems!!!
<br><br>So, when I remove this call, it rotates fine but some other things mess up now!!<br><br>Anyways, if someone wants to reproduce the problem and maybe help me in the process (shameless, I know), here is some code that will reproduce this:
<br><br>vtkImageChangeInformation * imageChangeInformation = vtkImageChangeInformation::New();<br>imageChangeInformation->SetInput(readerG->GetOutput());<br>imageChangeInformation->CenterImageOn();<br>imageChangeInformation->Update();
<br><br>vtkImageReslice * slicer = vtkImageReslice::New();<br>// TURNING THIS ON, will mess up rotations<br>//slicer->AutoCropOutputOn();<br>slicer->SetResliceAxesDirectionCosines(1, 0, 0, 0, 1, 0, 0, 0, 1);<br>slicer->SetOutputDimensionality(2);
<br> <br>vtkTransform * transform = vtkTransform::New();<br>slicer->SetResliceTransform(transform);<br><br>transform->RotateZ(30);<br> <br>slicer->SetInput(imageChangeInformation->GetOutput());<br>
<br>double origin[3];<br>double spacing[3];<br>imageChangeInformation->GetOutput()->GetOrigin(origin);<br>imageChangeInformation->GetOutput()->GetSpacing(spacing);<br><br>slicer->SetResliceAxesOrigin(0, 0, origin[2] + 50 * spacing[2]);
<br><br>viewer->SetInput(slicer->GetOutput()); // this is a vtkImageViewer<br>viewer->Render();<br>