[vtkusers] question regarding vtkImageReslice

Fabian Gutierrez fagossa at gmail.com
Mon Apr 23 11:48:09 EDT 2012


Hi guys,

I'm planing to use vtkImageReslice to get a slice from an 3D vtkImageData
in two different ways:

- the first one based on rotation matrices
i just used the rotation angles as the directions cosines and it works as
expected.  In this implementation i'm using

SetResliceAxesDirectionCosines(...); //rotation matrix
SetResliceAxesOrigin(...); // rotation point

- the second one is based on the normal to a plane
a have two points (in world coordinates) and i want to get the a plane that
is orthogonal to that vector. I've made some calculations and I got the
plane, the normal and two other points inside that plane. As far a i know,
i must use the same methods to get the slice

slicer->SetResliceAxesDirectionCosines(...);
slicer->SetResliceAxesOrigin(...);

plus the following:

slicer->SetOutputDimensionality(2);
slicer->SetOutputSpacing(...);
slicer->SetOutputExtent(...);

The result slice seems to have the correct pixels, however the data is
skewed 45 degrees!! http://tinypic.com/r/qpj6kz/5.

So my questions are:
- what are the actual parameters of 'SetResliceAxesDirectionCosines'?

- this post: http://www.vtk.org/pipermail/vtkusers/2004-May/074177.html,
depicts that the best example to look at is 'vtkImagePlaneWidget', however
after making those changes i'm getting a completely black image. So i think
the problem must be the parameters to SetResliceAxesDirectionCosines that
I'm invoquing in this way:

SetResliceAxesDirectionCosines (
      v1[0], v1[1], v1[2], //based on the first point in the plane
      v2[0], v2[1], v2[2], //based on the second point in the plane
      normal[0], normal[1], normal[2]
);
<http://www.vtk.org/pipermail/vtkusers/2004-May/074177.html><http://web.archiveorange.com/archive/v/50zHjsWfslvTDBylAOk7>
Apart from normalization, what else must be done to the vectors that
represent the plane? do they must the something in particular, like the
corners? or can be just anywhere in the plane?

I'am also aware that for images with different scales a workaround could be
using a ImageChangeInformation as a wrapper:

vtkSmartPointer<itkImageChangeInformation> change =
vtkImageChangeInformation::New();
change->SetInput(reader->GetOutput());
change->SetOutputSpacing(1,1,1);
change->Update();

but i still get the same results. Thanks for your help.

Best regards,

Fabian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120423/3ee1f84c/attachment.htm>


More information about the vtkusers mailing list