[Insight-users] Using the Fast Marching filter from python

Mario Ceresa mario.ceresa at torrescalla.it
Wed Jul 1 07:06:22 EDT 2009


Hello Patrick,

please see the following example:

import itk
points = [(0,0,0),(0,1,0),(1,0,0)]
speed_image = itk.ImageFileReader.IF3.New(FileName='myimage')
NodeType = itk.LevelSetNode.F3
NodeContainer = itk.VectorContainer[itk.UI, NodeType]
container = NodeContainer.New()
container.Initialize()
for i,p in enumerate(points):
   node = NodeType()
   node.SetIndex( p )
   node.SetValue( 0.0 )
   container.InsertElement( i, node )

f =
itk.FastMarchingImageFilter.IF3IF3.New(speed_image,TrialPoints=container)

Hope this helps!

Cheers,

Mario

On Wed, Jul 1, 2009 at 11:08 AM, Patrick <jazzcat81 at hotmail.com> wrote:

> Hi all,
>
> I am completely new to ITK but rather impressed by the breadth of
> algorithms it contains. In my particular application I would like to apply a
> Fast Marching filter to calculate the arrival time of a wave at voxels in a
> 3d image starting from a user specified seed point. The ItkSoftwareGuide
> contains an excellent example of how to do this in C++, however, in Python I
> am not sure how to pass the seedpoints to the algorithm. In C++ the
> "NodeContainer" type of the FastMarchingFilter is used.
> My question is, how do I pass a numpy-array into this data structure from
> Python?
>
> Thanks!
>
> Regards,
>
> Patrick
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>



-- 
Mario Ceresa, MS.
Cancer Imaging Laboratory, Center for Applied Medical Research (CIMA),
University of Navarra, Avda Pio XII 55, 31008-Pamplona, SPAIN.
Phone:+34.948.194.700 ext 5021
Fax: +34.948.194.714
E-mail address: mceresa at unav.es
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090701/f2b934a0/attachment.htm>


More information about the Insight-users mailing list