[vtkusers] Segmentation for 3D ultrasound data set

shinaji t_shinaji at chiba-u.jp
Wed Nov 28 11:58:45 EST 2012


Hi, 
I usually load CT data (dicom) to the vtkImageData.
Then take threshold it by vtkImageThreshold as a following example.

    reader = vtk.vtkDICOMImageReader()
    reader.SetFileName('IM-0013-0399.dcm')
    reader.Update();

    src = vtk.vtkImageData()
    src.DeepCopy(reader.GetOutput())

    thresh = vtk.vtkImageThreshold()
    thresh.SetInput(src)
    thresh.SetInValue(32768)
    thresh.ThresholdBetween(0, 200)

    bwLut = vtk.vtkLookupTable()
    bwLut.SetTableRange(0, 2000)
    bwLut.SetSaturationRange(0, 0)
    bwLut.SetHueRange(0, 0)
    bwLut.SetValueRange(0, 1)
    bwLut.Build()

    imageMapToColor = vtk.vtkImageMapToColors()
    imageMapToColor.SetInput(thresh.GetOutput())
    imageMapToColor.SetLookupTable(bwLut)
    imageMapToColor.Update()

    writer = vtk.vtkPNGWriter()
    writer.SetFileName('thresh.png')
    writer.SetInput(imageMapToColor.GetOutput())
    writer.Update()
    writer.Write()

Are these code giving you that you want to do?

Shinaji



--
View this message in context: http://vtk.1045678.n5.nabble.com/Segmentation-for-3D-ultrasound-data-set-tp5717312p5717329.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list