[Insight-users] Trying to monitor progression of fast march operation

Rick Giuly rgiuly at gmail.com
Wed Apr 22 09:56:14 EDT 2009


Hello All,

The FastMarchingUpwindGradientImageFilter stopping points don't seem to 
be working for me.

Just to check with you guys that I'm interpreting the output right, 
here's how I'm looking at it:
I'm looking at the 3D volume that the filter produces assuming that it 
is initialized to a very large value (1.70141e+38) and then where the 
march has happened the values are more on the order of 0.5 or so.

I've tried setting the stopping point to points very close to the 
seed-point (1 pixel away or so) and the march seems to be going far 
beyond, like 100's of pixels beyond. I also tried setting the stopping 
point to the seed point and that gives a result that looks the same 
(seems like that should cause it to terminate almost immediately).

So, I'm not sure what's going on.

Here are the parts of my code that deal with the filter. I'm also 
attaching the file with the complete code.

   
    FastMarchingFilterType = itk.FastMarchingUpwindGradientImageFilter[ 
InternalImageType,
                                InternalImageType ]

    NodeType = itk.LevelSetNode[InternalPixelType, Dimension]
    NodeContainer = itk.VectorContainer[itk.UI, NodeType]

    numpyStopPointList = [array(seedPosition) + array([1,0,0])]
    print numpyStopPointList
   
    stopPoints = NodeContainer.New()
    for numpyPoint in numpyStopPointList:
        stopPointNode = NodeType()
        stopPointNode.SetValue(0)
        stopPointNode.SetIndex(numpyPoint)
        stopPoints.InsertElement(0, stopPointNode)
   
    fastMarching = FastMarchingFilterType.New()
    fastMarching.SetTargetReachedModeToOneTarget()
    fastMarching.SetTargetPoints(stopPoints)

   
    seeds = NodeContainer.New()
   
   
   
    node = NodeType()
    seedValue = 0.0
   
    node.SetValue( seedValue )
    node.SetIndex( seedPosition )
    print "fastmarch seed position", seedPosition
   
    seeds.Initialize();
    seeds.InsertElement( 0, node )
   
    fastMarching.SetTrialPoints(  seeds  );
   
   
    fastMarching.SetOutputSize(
            reader.GetOutput().GetBufferedRegion().GetSize() )
   


Dan Mueller wrote:
> Hi Rick,
>
> You may want to investigate FastMarchingUpwindGradientImageFilter:
>     http://www.itk.org/Doxygen/html/classitk_1_1FastMarchingUpwindGradientImageFilter.html
>
> This is a subclass of the normal fast marching filter which allows you
> to set the "target reached mode". By default all of the gradient
> "stuff" is turned off, so you can treat the filter as you would the
> parent class. For example, just add these lines:
>     filter->SetTargetReachedModeToAllTargets(); // Other options exist also
>     filter->SetTargetPoints( targetPoints ); // You need to create these
>
> (An aside: it is a shame this functionality was added to the subclass,
> not the parent filter.)
>
> Hope this helps.
>
> Cheers, Dan
>
> 2009/4/14 Rick Giuly <rgiuly at gmail.com>:
>   
>> Hello All,
>>
>> I'm trying to monitor progression of fast march operation so I can stop it
>> when it has spread to a certain volume. I figured that AddObserver might be
>> a way to do this... but it seems that the callback is not called. Is there
>> some other way to monitor the fast march progression?
>>
>>
>> Here is the test that I used (in python):
>>
>> fastMarching = FastMarchingFilterType.New()
>>
>> iterationCommand = itk.PyCommand.New()
>> iterationCommand.SetCommandCallable(fastMarchIterationUpdate)
>> fastMarching.AddObserver(itk.IterationEvent(),
>> iterationCommand.GetPointer())
>>
>>
>>
>> -rick
>> _____________________________________
>> 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
>>
>>     

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fastmarch.py
Type: text/x-python
Size: 6791 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090422/92c3306b/attachment.py>


More information about the Insight-users mailing list