[vtkusers] vtkDICOMImageReader (VTK 4.4)

Yoan BLANC greut.lists at dosimple.ch
Wed Nov 2 05:22:30 EST 2005


Hi,

I've to visualize DICOM files, but my Renderer still black. Is there 
special things to do with DICOM files ? There is my code :

_data = "leila" # a directory containing dicom files

app = wx.PySimpleApp()
frame = wx.Frame(None, -1, _data, size=wx.Size(500,400))

ren = vtkRenderer()
renWin = wxVTKRenderWindow(frame, -1)
renWin.GetRenderWindow().AddRenderer(ren)

reader = vtkDICOMImageReader()
reader.SetDirectoryName(_data)
reader.UpdateWholeExtent();

print reader.GetWidth() # 448
print reader.GetHeight() # 512
print reader.GetOutput().GetScalarRange() # (0.0, 232.0)

viewer = vtkImageViewer()
viewer.SetInput(reader.GetOutput())
max, min = reader.GetOutput().GetScalarRange();
viewer.SetZSlice(viewer.GetWholeZMax() / 2);
viewer.SetColorWindow(max - min)
viewer.SetColorLevel((max - min) / 2.)

ren.AddActor(viewer.GetActor2D())

frame.Show(1)

app.MainLoop()

Using dicom2, I've generated the PNG and my files contains something.

Cheers.

--
Yoan



More information about the vtkusers mailing list