Hi, Kevin,<br><br>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.<br>
<br> typedef itk::Image<float,2> ImageType;<br> typedef itk::FastMarchingImageFilter<ImageType,ImageType >FastMarchingFilterType;<br> FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New();<br>
typedef FastMarchingFilterType::NodeContainer NodeContainer;<br> typedef FastMarchingFilterType::NodeType NodeType;<br> /////// alive points<br> NodeContainer::Pointer alivePoints = NodeContainer::New();<br>
alivePoints->Initialize();<br> NodeType nodeAlive;<br> ImageType::IndexType index; index[0]=50; index[1]=50;<br> nodeAlive.SetValue(0.0);<br> nodeAlive.SetIndex(index); <br> alivePoints->InsertElement(0,nodeAlive);<br>
fastMarching->SetTrialPoints(alivePoints);<br><br> ImageType::IndexType start; start[0]=0; start[1]=0;<br> ImageType::SizeType size; size[0]=100; size[1]=100;<br> ImageType::RegionType region; region.SetSize(size); region.SetIndex(start);<br>
fastMarching->SetOutputRegion(region);<br> fastMarching->SetSpeedConstant(1.0); <br> fastMarching->SetStoppingValue(10);<br> typedef itk::ImageFileWriter<ImageType> WriterType;<br> WriterType::Pointer writer = WriterType::New();<br>
writer->SetFileName("fastMarching.vtk");<br> writer->SetInput(fastMarching->GetOutput());<br> writer->Update();<br><br>Thank you for any input.<br>Siqi<br><br><br><div class="gmail_quote">On Tue, Dec 29, 2009 at 4:25 PM, Kevin H. Hobbs <span dir="ltr"><<a href="mailto:hobbsk@ohiou.edu">hobbsk@ohiou.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">On 12/29/2009 03:10 PM, siqi chen wrote:<br>
> Hi, ITKers,<br>
><br>
> I have a simple question regarding how to use FastMarchingImageFilter to<br>
> calculate distance map.<br>
><br>
> If I have a pointset P with integer coordinates, and I want to calculate a<br>
> distance map to P. What should I pass to FastMarchingImageFilter?<br>
><br>
> What I did is:<br>
> 1. pass P to AlivePoints with value 0.0,<br>
> 2. pass all the 4 neighbors of P to TrialPoints with value 1.0<br>
> 3. set the speedconstant to 1.0<br>
> 4. set the outputregion, size, origin, ....<br>
><br>
> Am I missing something?<br>
><br>
<br>
</div></div>1. pass P to TrialPoints with value 0.0<br>
<div><div></div><div class="h5">2. set the speedconstant to 1.0<br>
3. set the outputregion, size, origin, ....<br>
<br>
</div></div></blockquote></div><br>