[vtkusers] Why isn't OutputOrigin being set in vtkResliceImage

Elvis Chen elvis.chen at gmail.com
Fri Apr 9 12:05:45 EDT 2010


hi all,

I have correctly resliced a 3D CT volume by an oblique plane using the
following code in python:

CTReslice = vtk.vtkImageReslice()
CTReslice.SetInputConnection( CTReader.GetOutputPort() )
CTReslice.SetOutputDimensionality( 2 )
CTReslice.SetInterpolationModeToLinear()
CTReslice.SetOutputSpacing( math.fabs( ImageSpacing[0] ),
                            math.fabs( ImageSpacing[1] ),
                            math.fabs( ImageSpacing[2] ) )

CTReslice.SetResliceAxesOrigin( Transform.GetPosition() )
CTReslice.SetResliceAxesDirectionCosines( xdir[0], xdir[1], xdir[2],
                                          ydir[0], ydir[1], ydir[2],
                                          zdir[0], zdir[1], zdir[2] )
CTReslice.Update()
print CTReslice
print CTReslice.GetResliceAxes()



However, when I take a look at the OutputOrigin and OutputExtent they are
set to some default INT/FLOAT_MAX value instead of, according to the
class documentation, "The default output origin/extent is the input
origin/extent permuted through the ResliceAxes" :

vtkImageReslice (02532CD8)
  Debug: Off
  Modified Time: 316
  Reference Count: 2
  Registered Events: (none)
  Executive: 03137A00
  ErrorCode: No error
  Information: 0252BA70
  AbortExecute: Off
  Progress: 1
  Progress Text: (None)
  NumberOfThreads: 8
  ResliceAxes: 0253AE68
    Debug: Off
    Modified Time: 316
    Reference Count: 1
    Registered Events: (none)
    Elements:
        0.656103 0.461 0.597502 121.967
        -0.325707 -0.541228 0.775234 181.053
        0.680768 -0.703243 -0.204951 270.487
        0 0 0 1
  ResliceAxesDirectionCosines: 0.656103 -0.325707 0.680768
                               0.461 -0.541228 -0.703243
                               0.597502 0.775234 -0.204951
  ResliceAxesOrigin: 121.967 181.053 270.487
  ResliceTransform: 00000000
  InformationInput: 00000000
  TransformInputSampling: On
  AutoCropOutput: Off
  OutputSpacing: 0.2631 0.2631 1
  OutputOrigin: 1e+299 1e+299 1e+299
  OutputExtent: -2147483648 2147483647 -2147483648 2147483647 -2147483648
2147483647
  OutputDimensionality: 2
  Wrap: Off
  Mirror: Off
  Border: On
  InterpolationMode: Linear
  Optimization: On
  BackgroundColor: 0 0 0 0
  BackgroundLevel: 0
  Stencil: 00000000


vtkMatrix4x4 (0253AE68)
  Debug: Off
  Modified Time: 316
  Reference Count: 2
  Registered Events: (none)
  Elements:
    0.656103 0.461 0.597502 121.967
    -0.325707 -0.541228 0.775234 181.053
    0.680768 -0.703243 -0.204951 270.487
    0 0 0 1


Moreoever, if I specify my own OutputOrigin/OutputExtent, the image I get is
not where I think it should be.

What I would like to get as output is a sub-image of the original
CTReslice.GetOutput().  I thought I could accomplish this by setting the
OutputOrigin (bottom-left corner of the output 2D image) and OutputExtent
(number of pixels in the (x,y,z) direction).  Is this the right way to
extract a sub-image from CTReslice.GetOutput()?

any help is very much appreciated,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100409/76f21f18/attachment.htm>


More information about the vtkusers mailing list