[Insight-users] Fast marching to calculate distance map
siqi chen
siqichensc at gmail.com
Tue Dec 29 16:45:06 EST 2009
Hi, Kevin,
Thanks for your reply. However, I still can't get it to work. Here is my
simple code, where I want to calculate the distance map to point [50,50]. I
write the output of the FastMarching filter to .vtk file and open it in
Paraview.
typedef itk::Image<float,2> ImageType;
typedef itk::FastMarchingImageFilter<ImageType,ImageType
>FastMarchingFilterType;
FastMarchingFilterType::Pointer fastMarching =
FastMarchingFilterType::New();
typedef FastMarchingFilterType::NodeContainer NodeContainer;
typedef FastMarchingFilterType::NodeType NodeType;
/////// alive points
NodeContainer::Pointer alivePoints = NodeContainer::New();
alivePoints->Initialize();
NodeType nodeAlive;
ImageType::IndexType index; index[0]=50; index[1]=50;
nodeAlive.SetValue(0.0);
nodeAlive.SetIndex(index);
alivePoints->InsertElement(0,nodeAlive);
fastMarching->SetTrialPoints(alivePoints);
ImageType::IndexType start; start[0]=0; start[1]=0;
ImageType::SizeType size; size[0]=100; size[1]=100;
ImageType::RegionType region; region.SetSize(size);
region.SetIndex(start);
fastMarching->SetOutputRegion(region);
fastMarching->SetSpeedConstant(1.0);
fastMarching->SetStoppingValue(10);
typedef itk::ImageFileWriter<ImageType> WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetFileName("fastMarching.vtk");
writer->SetInput(fastMarching->GetOutput());
writer->Update();
Thank you for any input.
Siqi
On Tue, Dec 29, 2009 at 4:25 PM, Kevin H. Hobbs <hobbsk at ohiou.edu> wrote:
> On 12/29/2009 03:10 PM, siqi chen wrote:
> > Hi, ITKers,
> >
> > I have a simple question regarding how to use FastMarchingImageFilter to
> > calculate distance map.
> >
> > If I have a pointset P with integer coordinates, and I want to calculate
> a
> > distance map to P. What should I pass to FastMarchingImageFilter?
> >
> > What I did is:
> > 1. pass P to AlivePoints with value 0.0,
> > 2. pass all the 4 neighbors of P to TrialPoints with value 1.0
> > 3. set the speedconstant to 1.0
> > 4. set the outputregion, size, origin, ....
> >
> > Am I missing something?
> >
>
> 1. pass P to TrialPoints with value 0.0
> 2. set the speedconstant to 1.0
> 3. set the outputregion, size, origin, ....
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20091229/255f1c82/attachment.htm>
More information about the Insight-users
mailing list