[Insight-users] how to use fasrmarching initkshapedetectionlevelsetimagefilter

Ivan Macia imacia at vicomtech.es
Tue Jul 27 02:40:54 EDT 2004


Hi xu

You need to update your files itkFastMarchingImageFilter.h to version 1.28
and itkFastMarchingImageFilter.txx to version 1.45 from the itk CVS. A bug
was fixed to set the origin and spacing for the output images of the
itkFastMarchingImageFilter

http://www.itk.org/cgi-bin/viewcvs.cgi/Code/Algorithms/?root=Insight

Later

Iván


-----Mensaje original-----
De: xujf [mailto:xujf at sjtu.edu.cn]
Enviado el: lunes, 26 de julio de 2004 16:27
Para: insight-users at itk.org
CC: xujf at sjtu.edu.cn
Asunto: [Insight-users] how to use fasrmarching
initkshapedetectionlevelsetimagefilter


Hi,everyone:
   I want to employ itkShapeDetectionLevelSetImageFilter to realize 3D Level
set Segmentation in Python.
   The ShapeDetectionLevelSetImageFilter expects two inputs, the first being
an initial Level Set in the form of an itk::Image, and the second being a
feature image.I use an FastMarchingImageFilter to produce the initial level
set as the distance function to a set of user-provided seeds.The code
referred to FastMarchingImageFilter  is described as below:

itkfastmarchingfilter=itk.itkFastMarchingImageFilterF3F3_New()
seeds=itk.itkNodeContainerF3_New()

seedPosition=itk.itkIndex3()
seedPosition.SetElement(0,80)
seedPosition.SetElement(1,100)
seedPosition.SetElement(2,80)

node=itk.itkLevelSetNodeF3()
node.SetValue(0)
node.SetIndex(seedPosition)
seeds.Initialize()
seeds.InsertElement(0,node)

itkfastmarchingfilter.SetTrialPoints(seeds.GetPointer())
itkfastmarchingfilter.SetSpeedConstant(1.0)
itkfastmarchingfilter.SetStoppingValue(100.0)

itkfastmarchingfilter.SetOutputSize(itkgradfilter.GetOutput().GetBufferedReg
ion().GetSize())  ##  line 15

itkcurfilter.SetInput(itkimport.GetOutput())
#itkCurvatureAnisotropicDiffusionImageFilter
itkgradfilter.SetInput(itkimport.GetOutput())
#itkGradientMagnitudeRecursiveGaussianImageFilter
itksigfilter.SetInput(itkgradfilter.GetOutput())  #itkSigmoidImageFilter
itkshapedetectionfilter.SetInput(itkfastmarchingfilter.GetOutput())
#itkShapeDetectionLevelSetImageFilter
itkshapedetectionfilter.SetFeatureImage(itksigfilter.GetOutput())

..............

when I ran the code, an error appeared:
ERROR: In F:\\VTK\\Common\\vtkImageData.cxx, line 541
vtkImageData (06B79008): Requesting a point from an empty image.

After I deleted the line 15:itkfastmarchingfilter.SetOutputSize(),this error
disappeared.
however,the segmented result is not correct. the extention of the segmented
image is (0,15,0,15,0,15)
,which is different from the origin image\'s extention (0,180,0,180,0,180)

It makes me puzzled. what is the matter with my code?  the whole code is in
the attachment.(not long)

Best Regards!

Jianfeng




More information about the Insight-users mailing list