[vtkusers] Problem in VTKImageReslicer

David Gobbi dgobbi at imaging.robarts.ca
Mon Nov 25 00:44:39 EST 2002


Hi Sateesh,

To extract just a slice, you should set the OutputExtent to a
single slice & appropriately set the OutputOrigin and OutputSpacing

reslice->SetOutputExtent(0,xMax,0,yMax,0,0)
reslice->SetOutputSpacing(1,1,1)
reslice->SetOutputOrigin(-0.5*xMax,-0.5*yMax,zSlice)

This specifies that your output slice is a cut plane
at z=0 and with its center at (0,0,0) and with sides
of length xMax and yMax.  Of course, a transformation
is applied to this slice before it is used to 'cut' the
input volume.

Borrowing a bit from a private email from Dan Blezek, here is
an explanation of transforms & axes & direction cosines in
vtkImageReslice:

If the ResliceTransform is set to T and the ResliceAxes are set to A,
the values of the output image I' are computed from the input image I
like this (given the correct interpolation mode):

 foreach pixel in I':
   I'[pixel] = I[ A * T * pixel ]

where pixel is the (x,y,z) pixel/voxel location in data coordinates.
(note that the 'data coordinates' are not the same thing as the
'structured coordinates' (i,j,k) unless the origin is (0,0,0) and
the spacing is (1,1,1) for both the input & the output).

So it is fine to use either the ResliceAxes A or the
ResliceTransform T to specify the orientation of the slice, or a
combination of the two can be used since they are simply multiplied
together.

The ResliceAxesDirectionCosines are the 9 elements of the
upper-left 3x3 submatrix of the 4x4 ResliceAxes matrix A.
They are just a rotation matrix that is applied after the
ResliceTransform.

I hope this helps more than it confuses...

 - David

-- 
  David Gobbi, MSc                dgobbi at imaging.robarts.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario

On Mon, 25 Nov 2002, cspl wrote:

> Hi all,
>
>    I have a problem in vtkImageReslice class. I want to get a slice from a volume after rotating the volume using given rotation angles. I could solve my problem using setResliceTransform function by passing the object of vtkTransform class to it. This works fine. But i want to use SetResliceAxisDirectionCosines function to get the required slice in given angles. How to give parameters to this function. Is there any other function which should be used in conjunction with this function. Documentation on this functions tell that this function is used to specify the orientation of the slice, but how get the values for the parameters for this function.
>
>    I would be greatful if u send some sample code for this.
>
>    Thanks in advance.
>
> -Cheers,
>     Sateesh.
>








More information about the vtkusers mailing list