[vtkusers] vtkImageReslice: what do I fill in for SetResliceAxesDirectionCosines.?
    Martin Gardner 
    mglistmail at totalise.co.uk
       
    Fri Apr 25 05:35:44 EDT 2003
    
    
  
Hi Nico
Nico Vermaas wrote:
> Hi,
> 
> I try to get a slice from my vtkImageData cube, but I do not understand the documentation of SetResliceAxesDirectionCosines. 
> 
> Q1:
> Say, my cube is: 0..100,0..100,0..100 and I want a slice that runs from 10..20,0..100,0.100. So a slice of 10 thick in the Y/Z plane. 
Well I would expect vtkExtractVOI to work for this. Perhaps my earlier 
advice was wrong.
> Q2: Why is vtkImageReslice better than vtkExtractVOI?
>
It can handle 0D, 1D or 2D slices of data better than vtkExtractVOI 
which in your earlier question vtk was complaining about one of the 
dimensions being zero
i.e.
 > vtkImageData (0x80957c8): Update extent is: 0, 63, 0, 90, 10, 10
						            ^^^^^^^
Z dimension is zero
 > vtkImageData (0x80957c8): Whole extent is: 0, 63, 10, 10, 0, 144
                                                     ^^^^^^
Y dimension is zero
vtkImageReslice would handle this without an error.
I think I assumed that this was what you wanted.
However if it is not then something could be messing up vtkExtractVOI so 
that one if its dimesions is zero.
Sorry for my previous advice
Martin
PS for reference I set it up using SetResliceAxes with a vtkMatrix4x4
In this code snippet I have specified the reslicing axes using two 
vecotrs v1 and v2 that lie on the reslicing plane, an origin for the 
plane (bottom left corner) and the normal of the plane.
   # axesTransform matrix to resample the volume
   #	based on the orientation of the sampling plane
   #
   # Homogonous(sic) matrix columns
   # |x axis vector|y axis vector|z axis vector |origin |
	#x axis column
	vtkMatrix4x4 axesTransform
	#Set inital state of matrix to identity
	axesTransform Identity
	#x axis column
	axesTransform SetElement 0 0 $v1_xn
	axesTransform SetElement 1 0 $v1_yn
	axesTransform SetElement 2 0 $v1_zn
	axesTransform SetElement 3 0 0.0
	#y axis column
	axesTransform SetElement 0 1 $v2_xn
	axesTransform SetElement 1 1 $v2_yn
	axesTransform SetElement 2 1 $v2_zn
	axesTransform SetElement 3 1 0.0
	#z axis column
	axesTransform SetElement 0 2 $norm_x
	axesTransform SetElement 1 2 $norm_y
	axesTransform SetElement 2 2 $norm_z
	axesTransform SetElement 3 2 0.0
	#origin column
	axesTransform SetElement 0 3 $origin_x
	axesTransform SetElement 1 3 $origin_y
	axesTransform SetElement 2 3 $origin_z
	axesTransform SetElement 3 3 1.0
	$slicer SetResliceAxes AxesTransform
    
    
More information about the vtkusers
mailing list