[Insight-users] multiple seed points in fast marching filter
Dan Mueller
dan.muel at gmail.com
Mon Feb 28 12:41:22 EST 2011
Hi,
Fast Marching already supports multiple seed points.
You simply need to insert more nodes. For example:
IndexType seedPosition1;
seedPosition1[0] = 10;
seedPosition1[1] = 10;
IndexType seedPosition2;
seedPosition2[0] = 20;
seedPosition2[1] = 20;
const double seedValue = 0.0;
NodeType node1;
node1.SetValue( seedValue );
node1.SetIndex( seedPosition1 );
NodeType node2;
node2.SetValue( seedValue );
node2.SetIndex( seedPosition2 );
seeds->Initialize();
seeds->InsertElement( 0, node1 );
seeds->InsertElement( 1, node2 );
fastMarching->SetTrialPoints( seeds );
Alternatively, here is a code snippet which sets trial points from a
binary image (may require some refactoring for your own purposes):
template <class TLevelSet, class TSpeedImage>
void
FastMarchingImageFilter<TLevelSet,TSpeedImage>
::SetTrialPointsFromImage( LabelImagePointer image )
{
// Setup
typedef ImageRegionConstIteratorWithIndex< LabelImageType > IteratorType;
NodeContainer::Pointer nodes = NodeContainer::New();
nodes->Initialize();
IteratorType it( image, image->GetLargestPossibleRegion() );
// Walk image
unsigned int count = 0;
for (it.GoToBegin(); !it.IsAtEnd(); ++it)
{
if (it.Get() > NumericTraits< LabelPixelType >::Zero)
{
NodeType node;
node.SetIndex( it.GetIndex() );
nodes->InsertElement( count, node );
count++;
}
}
// Set nodes
this->SetTrialPoints( nodes );
this->Modified();
}
HTH
Cheers, Dan
On 28 February 2011 18:32, Dhananjay244 <dhananjay.shah244 at gmail.com> wrote:
>
> hi,
> i am implementing the fastmarching algorithm as defined in itk:segmentation
> to extract the vertebral boundary in a X-ray. to successfully extract the
> vertebrae completely i need to mention multiple seed points to the filter,
> but the syntax for defining multiple seed points is not clear.
>
> if we cannot use multiple seeds points in the filter, then can anyone help
> me in modifying the code so as to read multiple seed points and perform
> fastmarching operation.
>
> thank you.
> --
> View this message in context: http://old.nabble.com/multiple-seed-points-in-fast-marching-filter-tp31031981p31031981.html
> Sent from the ITK - Users mailing list archive at Nabble.com.
More information about the Insight-users
mailing list