[vtkusers] VTK shifts CT data

Peter Halverson halverson at byu.edu
Thu Apr 30 16:59:14 EDT 2009


VTK users,

I am struggling with the two issues.  The first issue is that when I
read in my CT data the image is shifted left. Meaning that the patients
left hand appears disembodied and floating on his right side.  I believe
the shift is ~50 pixels.  (It did this in MatLab too, but not when using
Dicomworks or pydicom).  Is there a way to shift the data back or reset
the origin?

My input code is 

import vtk
from vtk.util.misc import vtkGetDataRoot
from vtk.util.colors import *
VTK_DATA_ROOT = vtkGetDataRoot()
import dicom
filename="./SE1/IM50"
info=dicom.ReadFile(filename)

aRenderer = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(aRenderer)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

v16 = vtk.vtkVolume16Reader()
v16.SetDataDimensions(info.Rows, info.Columns)
v16.SetDataByteOrderToLittleEndian()
v16.SetFilePrefix("./SE1/IM")
#v16.SetFilePrefix("Z:/COM and COR/PA3/ST1/SE1/IM")
v16.SetFilePattern('%s%d')
v16.SetImageRange(3, 60)
v16.SetDataSpacing(info.PixelSpacing[0], info.PixelSpacing[1],
info.SliceThickness)


The second issue is that after reading the file in I use
vtkContourFilter in order to extract the skin.  After extracting the
skin I would like to use it as a mask and then import the pixel
intensity values back into python for data manipulation.  Does anyone
know of a way to do this?




More information about the vtkusers mailing list