<DIV>
<DIV>
<DIV>I received my email back only as an attachment, so I am sending the text part again. And the attachment is at</DIV>
<DIV><A href="http://public.kitware.com/pipermail/insight-users/attachments/20051006/686a1039/userInitialization.bin" target=_blank><U><FONT color=#003399 size=3>http://public.kitware.com/pipermail/insight-users/attachments/20051006/686a1039/userInitialization.bin</FONT></U></A></DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks!</DIV>
<DIV>&nbsp;</DIV>
<DIV>Hi all,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I am trying to make 3 user defined circles ( filled black on white background), so I defined an image and let a fastmarchingfilter grow on the 3 seeds with speed 1 and stopping time = radius. However, the outcome is not 3 spheres but 3 squares (somewhat) -- I am attaching&nbsp;the image. Do you&nbsp;have any idea why this happened? </DIV>
<DIV>&nbsp;</DIV>
<DIV>A second question is, I added an adaptor into this function but it doesn't seem to make any difference. Could you please inform me more on where&nbsp;we need to use adaptors?</DIV>
<DIV>&nbsp;</DIV>
<DIV>And below is the code....</DIV>
<DIV>&nbsp;</DIV>
<DIV>#include "itkImage.h"<BR>#include "itkImageFileReader.h"<BR>#include "itkImageFileWriter.h"<BR>#include "itkRescaleIntensityImageFilter.h"<BR>#include "itkGradientAnisotropicDiffusionImageFilter.h"<BR>#include "iostream.h"<BR>#include "itkFastMarchingImageFilter.h"<BR>#include "itkImageAdaptor.h"</DIV>
<DIV>class CastPixelAccessor<BR>{<BR>public:<BR>typedef unsigned char InternalType;<BR>typedef float ExternalType;<BR>static void Set(InternalType &amp; output, const ExternalType &amp; input)<BR>{<BR>output = static_cast&lt;InternalType&gt;( input );<BR>}<BR>static ExternalType Get( const InternalType &amp; input )<BR>{<BR>return static_cast&lt;ExternalType&gt;( input );<BR>}<BR>};</DIV>
<DIV>&nbsp;</DIV>
<DIV>int main( int argc, char * argv[] )<BR>{</DIV>
<DIV>&nbsp;</DIV>
<DIV>....</DIV>
<DIV>....</DIV>
<DIV>&nbsp;</DIV>
<DIV>typedef itk::Image&lt; unsigned char, 2 &gt; ImageType;</DIV>
<DIV>ImageType::Pointer deformableImage = ImageType::New();</DIV>
<DIV>.....</DIV>
<DIV>....<BR>&nbsp; deformableImage-&gt;SetRegions( region );<BR>&nbsp; deformableImage-&gt;Allocate();<BR>&nbsp; deformableImage-&gt;FillBuffer(0);<BR>&nbsp; deformableImage-&gt;Update();<BR>&nbsp; </DIV>
<DIV>&nbsp;&nbsp;</DIV>
<DIV>&nbsp;&nbsp;float Radius = 20;<BR>&nbsp; typedef itk::FastMarchingImageFilter&lt;ImageType,ImageType&gt; FastMarchingFilterType;<BR>&nbsp;<BR>&nbsp; FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New();</DIV>
<DIV>&nbsp; typedef FastMarchingFilterType::NodeContainer NodeContainer;<BR>&nbsp; typedef FastMarchingFilterType::NodeType NodeType;<BR>&nbsp;&nbsp;<BR>&nbsp; NodeType node1;<BR>&nbsp; NodeType node2;<BR>&nbsp; NodeType node3;<BR>&nbsp; <BR>&nbsp; node1.SetValue(0.0);<BR>&nbsp; node2.SetValue(0.0);<BR>&nbsp; node3.SetValue(0.0);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; NodeContainer::Pointer seeds = NodeContainer::New();</DIV>
<DIV>&nbsp; ImageType::IndexType seed1&nbsp; = {89,128};<BR>&nbsp; ImageType::IndexType seed2 = {91,305};<BR>&nbsp; ImageType::IndexType seed3 = {253,80};</DIV>
<DIV>&nbsp; node1.SetIndex(seed1);<BR>&nbsp; node2.SetIndex(seed2);<BR>&nbsp; node3.SetIndex(seed3);</DIV>
<DIV>&nbsp; seeds-&gt;InsertElement(0, node1);<BR>&nbsp; seeds-&gt;InsertElement(1, node2);<BR>&nbsp; seeds-&gt;InsertElement(2, node3);</DIV>
<DIV>&nbsp; fastMarching-&gt;SetTrialPoints(seeds);<BR>&nbsp; fastMarching-&gt;SetSpeedConstant(1.0);<BR></DIV>
<DIV></DIV>
<DIV>//define an adaptor<BR>&nbsp; typedef itk::ImageAdaptor&lt; ImageType, CastPixelAccessor &gt; ImageAdaptorType;<BR>&nbsp; ImageAdaptorType::Pointer adaptor = ImageAdaptorType::New();<BR>&nbsp; adaptor-&gt;SetImage( deformableImage);<BR><BR>&nbsp;fastMarching-&gt;SetOutputSize(adaptor-&gt;GetBufferedRegion().GetSize());</DIV>
<DIV>&nbsp;fastMarching-&gt;SetStoppingValue(Radius);<BR>&nbsp;fastMarching-&gt;Update();</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>&nbsp; //test if the image is working<BR>&nbsp; //typedef unsigned char WritePixelType;<BR>&nbsp; typedef itk::Image&lt; WritePixelType, 2 &gt; WriteImageType;<BR>&nbsp; typedef itk::ImageFileWriter&lt; WriteImageType &gt;&nbsp; WriterType;</DIV>
<DIV>&nbsp; writer-&gt;SetFileName("userInitialization.png" );<BR>&nbsp; writer-&gt;SetInput( fastMarching-&gt;GetOutput() );<BR>&nbsp; writer-&gt;Update();</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; return 0;<BR>}<BR></DIV>
<DIV>&nbsp;</DIV>
<DIV>-----------------------------------------------------------------------------------</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thank you very much for all your answers up until now and for all the coming ones. I really appreciate your help a lot. </DIV>
<DIV>&nbsp;</DIV>
<DIV>Seniha</DIV></DIV></DIV><BR><BR><DIV>Seniha Esen Yuksel <BR>Research Assistant <BR>Computer Vision and Image Processing Lab, <BR>Lutz Hall Rm 414, <BR>University of Louisville, <BR>Louisville, KY <BR>work ph: 502- 8521528 <BR>home ph: 502- 8549856 <BR>email: esen@cvip.uofl.edu // esenyuksel@ieee.org <BR>web: <A href="http://www.cvip.louisville.edu/~esen/">http://www.cvip.louisville.edu/~esen/</A></DIV><p>
                <hr size=1>Yahoo! for Good<br> 
<a href="http://store.yahoo.com/redcross-donate3/">Click here to donate</a> to the Hurricane Katrina relief effort.