<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> </DIV>
<DIV>Thanks!</DIV>
<DIV> </DIV>
<DIV>Hi all,</DIV>
<DIV> </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 the image. Do you have any idea why this happened? </DIV>
<DIV> </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 we need to use adaptors?</DIV>
<DIV> </DIV>
<DIV>And below is the code....</DIV>
<DIV> </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 & output, const ExternalType & input)<BR>{<BR>output = static_cast<InternalType>( input );<BR>}<BR>static ExternalType Get( const InternalType & input )<BR>{<BR>return static_cast<ExternalType>( input );<BR>}<BR>};</DIV>
<DIV> </DIV>
<DIV>int main( int argc, char * argv[] )<BR>{</DIV>
<DIV> </DIV>
<DIV>....</DIV>
<DIV>....</DIV>
<DIV> </DIV>
<DIV>typedef itk::Image< unsigned char, 2 > ImageType;</DIV>
<DIV>ImageType::Pointer deformableImage = ImageType::New();</DIV>
<DIV>.....</DIV>
<DIV>....<BR> deformableImage->SetRegions( region );<BR> deformableImage->Allocate();<BR> deformableImage->FillBuffer(0);<BR> deformableImage->Update();<BR> </DIV>
<DIV> </DIV>
<DIV> float Radius = 20;<BR> typedef itk::FastMarchingImageFilter<ImageType,ImageType> FastMarchingFilterType;<BR> <BR> FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New();</DIV>
<DIV> typedef FastMarchingFilterType::NodeContainer NodeContainer;<BR> typedef FastMarchingFilterType::NodeType NodeType;<BR> <BR> NodeType node1;<BR> NodeType node2;<BR> NodeType node3;<BR> <BR> node1.SetValue(0.0);<BR> node2.SetValue(0.0);<BR> node3.SetValue(0.0);</DIV>
<DIV> </DIV>
<DIV> NodeContainer::Pointer seeds = NodeContainer::New();</DIV>
<DIV> ImageType::IndexType seed1 = {89,128};<BR> ImageType::IndexType seed2 = {91,305};<BR> ImageType::IndexType seed3 = {253,80};</DIV>
<DIV> node1.SetIndex(seed1);<BR> node2.SetIndex(seed2);<BR> node3.SetIndex(seed3);</DIV>
<DIV> seeds->InsertElement(0, node1);<BR> seeds->InsertElement(1, node2);<BR> seeds->InsertElement(2, node3);</DIV>
<DIV> fastMarching->SetTrialPoints(seeds);<BR> fastMarching->SetSpeedConstant(1.0);<BR></DIV>
<DIV></DIV>
<DIV>//define an adaptor<BR> typedef itk::ImageAdaptor< ImageType, CastPixelAccessor > ImageAdaptorType;<BR> ImageAdaptorType::Pointer adaptor = ImageAdaptorType::New();<BR> adaptor->SetImage( deformableImage);<BR><BR> fastMarching->SetOutputSize(adaptor->GetBufferedRegion().GetSize());</DIV>
<DIV> fastMarching->SetStoppingValue(Radius);<BR> fastMarching->Update();</DIV>
<DIV> </DIV>
<DIV><BR> //test if the image is working<BR> //typedef unsigned char WritePixelType;<BR> typedef itk::Image< WritePixelType, 2 > WriteImageType;<BR> typedef itk::ImageFileWriter< WriteImageType > WriterType;</DIV>
<DIV> writer->SetFileName("userInitialization.png" );<BR> writer->SetInput( fastMarching->GetOutput() );<BR> writer->Update();</DIV>
<DIV> </DIV>
<DIV> return 0;<BR>}<BR></DIV>
<DIV> </DIV>
<DIV>-----------------------------------------------------------------------------------</DIV>
<DIV> </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> </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.