[vtkusers] Progress with my rotation problem.
Anja Ende
anja.ende at googlemail.com
Tue Sep 19 05:27:52 EDT 2006
Hi everyone,
I had posted yesterday about the rotation not being around the center of the
data slice, even after calling vtkImageChangeInformation.
http://public.kitware.com/pipermail/vtkusers/2006-September/087065.html
I figured out which call was causing that problem. However, I am still not
sure how to fix it.
I was calling AutoCropOutputOn() on the reslicer but it does not like that
when doing rotations it seems!!!
So, when I remove this call, it rotates fine but some other things mess up
now!!
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:
vtkImageChangeInformation * imageChangeInformation =
vtkImageChangeInformation::New();
imageChangeInformation->SetInput(readerG->GetOutput());
imageChangeInformation->CenterImageOn();
imageChangeInformation->Update();
vtkImageReslice * slicer = vtkImageReslice::New();
// TURNING THIS ON, will mess up rotations
//slicer->AutoCropOutputOn();
slicer->SetResliceAxesDirectionCosines(1, 0, 0, 0, 1, 0, 0, 0, 1);
slicer->SetOutputDimensionality(2);
vtkTransform * transform = vtkTransform::New();
slicer->SetResliceTransform(transform);
transform->RotateZ(30);
slicer->SetInput(imageChangeInformation->GetOutput());
double origin[3];
double spacing[3];
imageChangeInformation->GetOutput()->GetOrigin(origin);
imageChangeInformation->GetOutput()->GetSpacing(spacing);
slicer->SetResliceAxesOrigin(0, 0, origin[2] + 50 * spacing[2]);
viewer->SetInput(slicer->GetOutput()); // this is a vtkImageViewer
viewer->Render();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060919/6271e95c/attachment.htm>
More information about the vtkusers
mailing list