<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></DIV>
<DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Dear Luis, </SPAN></DIV>
<DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I would like to thank you and all the other itk members who have replied me regarding my question.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></DIV>
<DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I have gave a try with your code. my CPU is Intel core 2, 2.41 Ghz and 2 Gb of Ram. it takes nearly 34 minutes. So I have tried my code, its working and it takes also nearly 34 minutes. </SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I used 0.001 for threshold and 0.1 for the level parameter.</SPAN></DIV>
<DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Sara</SPAN></DIV>
<DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Best regards </SPAN></DIV>
<DIV><BR><BR>--- En date de : <B>Ven 22.8.08, Luis Ibanez <I><luis.ibanez@kitware.com></I></B> a écrit :<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid">De: Luis Ibanez <luis.ibanez@kitware.com><BR>Objet: Re: [Insight-users] nobody could answer me ? Fw : Please help:problem with wathershed segmentation applied to 3D grayscale Image<BR>À: sara_meghellati@yahoo.fr<BR>Cc: "insight itk" <insight-users@itk.org><BR>Date: Vendredi 22 Août 2008, 18h59<BR><BR>
<DIV id=yiv1072800816>
<DIV dir=ltr><BR>Hi Sara,<BR><BR>Thanks for your detailed question regarding Watersheds.<BR><BR><BR>Please take a look at the attached code.<BR><BR>It process the image "Patient01" from <BR><BR> <SPAN style="COLOR: rgb(163,21,21)"><A href="http://public.kitware.com/pub/itk/Data/LiverTumor/" target=_blank rel=nofollow><FONT color=#800080>http://public.kitware.com/pub/itk/Data/LiverTumor/</FONT></A>.</SPAN><BR> <BR>in a time of<BR><BR> 4 minutes 38 seconds.<BR><BR>This was profiled in an QuadCore Intel Xeon 2.66 Ghz. (with 16Gb RAM).<BR>(although the process uses only one of the cores)<BR><BR>Note that the process peaks 1Gb of memory allocation when it is running.<BR><BR>Depending on the configuration of your system, it may be that the program<BR>started swapping memory at some point.<BR><BR>Please give a try at the attached code and let us know what
you find.<BR><BR><BR> Regards,<BR><BR><BR> Luis<BR><BR><BR>-----------------------------------------------------------------------------------------------------------------------------------<BR>
<DIV class=gmail_quote>On Fri, Aug 22, 2008 at 11:19 AM, sara meghellati <SPAN dir=ltr><<A href="mailto:sara_meghellati@yahoo.fr" target=_blank rel=nofollow>sara_meghellati@yahoo.fr</A>></SPAN> wrote:<BR>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD style="FONT-FAMILY: inherit; font-size-adjust: inherit; font-stretch: inherit" vAlign=top>I'm sending again my questions as nobody have answered me. <BR><BR>--- En date de : <B>Ven 22.8.08, sara meghellati <I><<A href="mailto:sara_meghellati@yahoo.fr" target=_blank rel=nofollow>sara_meghellati@yahoo.fr</A>></I></B> a écrit :<BR>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid">De: sara meghellati <<A href="mailto:sara_meghellati@yahoo.fr" target=_blank rel=nofollow>sara_meghellati@yahoo.fr</A>><BR>Objet: [Insight-users] Please help:problem with wathershed segmentation applied to 3D grayscale Image<BR>À: "insight itk" <<A href="mailto:insight-users@itk.org" target=_blank rel=nofollow>insight-users@itk.org</A>><BR>Date: Vendredi 22 Août 2008, 13h48<BR><BR>
<DIV>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD vAlign=top><PRE><SPAN>Dear itk experts,</SPAN></PRE><PRE><SPAN>I'm segmenting a volume (3D grayscale image) using watershed method inspired from the WatershedSegmentation1 </SPAN></PRE><PRE><SPAN>(2D </SPAN><SPAN>RGB</SPAN><SPAN> image as input)example provided within itk.</SPAN></PRE><PRE><SPAN>My code is well working for 2D grayscale images but when I change </SPAN></PRE><PRE><SPAN>the dimension to 3, the code
still running as it get stuck in a </SPAN></PRE><PRE><SPAN>loop!! I wait for more than 18min but no results!! Is it normal </SPAN></PRE><PRE><SPAN>that this kind of segmentation takes age to give the result in 3d </SPAN></PRE><PRE><SPAN>image or there is some thing wrong with my code? Please could you help me on that? Also, how can I follow the progress of the code?</SPAN></PRE><PRE><SPAN>I pass my code bellow. In this example I used the 3D data provided</SPAN></PRE><PRE><SPAN>in</SPAN><SPAN style="COLOR: rgb(163,21,21)"> <A href="http://public.kitware.com/pub/itk/Data/LiverTumor/" target=_blank rel=nofollow><FONT color=#800080>http://public.kitware.com/pub/itk/Data/LiverTumor/</FONT></A>.</SPAN></PRE><PRE><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)"><iostream></SPAN></SPAN></PRE>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"itkImage.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"itkGradientAnisotropicDiffusionImageFilter.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"itkGradientMagnitudeImageFilter.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"itkWatershedImageFilter.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"itkImageFileReader.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"itkImageFileWriter.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"itkVectorCastImageFilter.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"itkUnaryFunctorImageFilter.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"itkScalarToRGBPixelFunctor.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: rgb(163,21,21)"> </SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"itkVTKImageExport.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"itkVTKImageImport.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: rgb(163,21,21)"> </SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"vtkImageData.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"vtkImageImport.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"vtkImageExport.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"vtkImageActor.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"vtkRenderer.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"vtkRenderWindow.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"vtkRenderWindowInteractor.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"vtkInteractorStyleTrackballCamera.h"</SPAN> </SPAN></DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">#include</SPAN><SPAN style="FONT-SIZE: 10pt"> <SPAN style="COLOR: rgb(163,21,21)">"vtkImageShiftScale.h"</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: rgb(163,21,21)"> </SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: green">// This function will connect the given itk::VTKImageExport filter to the given vtkImageImport filter.</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">template</SPAN><SPAN style="FONT-SIZE: 10pt"> <<SPAN style="COLOR: blue">typename</SPAN> ITK_Exporter, <SPAN style="COLOR: blue">typename</SPAN> VTK_Importer></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">void</SPAN><SPAN style="FONT-SIZE: 10pt"> ConnectPipelines(ITK_Exporter exporter, VTK_Importer* importer)</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt">{</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>importer->SetSpacingCallback(exporter->GetSpacingCallback());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>importer->SetOriginCallback(exporter->GetOriginCallback());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>importer->SetDataExtentCallback(exporter->GetDataExtentCallback());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>importer->SetCallbackUserData(exporter->GetCallbackUserData());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt">}</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"> </SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">int</SPAN><SPAN style="FONT-SIZE: 10pt"> main( )</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt">{<SPAN> </SPAN></SPAN></DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: blue">typedef</SPAN> itk::Image<<SPAN style="COLOR: blue">float</SPAN>, 3><SPAN> </SPAN>ImageType; <SPAN style="COLOR: green"></SPAN></SPAN></DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: blue">typedef</SPAN> itk::Image<<SPAN style="COLOR: blue">unsigned</SPAN> <SPAN style="COLOR: blue">long</SPAN>, 3><SPAN> </SPAN>LabeledImageType;</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: blue">typedef</SPAN> itk::Image<<SPAN style="COLOR: blue">float</SPAN>, 3><SPAN> </SPAN>ScalarImageType;</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: green">// for visualization purposes</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: blue">typedef</SPAN> itk::RGBPixel<<SPAN style="COLOR: blue">unsigned</SPAN> <SPAN style="COLOR: blue">char</SPAN>><SPAN> </SPAN>RGBPixelType;</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: blue">typedef</SPAN> itk::Image<RGBPixelType, 3><SPAN> </SPAN>RGBImageType;</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"> </SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: blue">typedef</SPAN> itk::ImageFileReader<ImageType> FileReaderType;</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: blue">typedef</SPAN> itk::GradientAnisotropicDiffusionImageFilter<ImageType,<SPAN> </SPAN>ImageType><SPAN> </SPAN>DiffusionFilterType;</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: blue">typedef</SPAN> itk::GradientMagnitudeImageFilter<ImageType,ImageType><SPAN> </SPAN>GradientMagnitudeFilterType; </SPAN></DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: blue">typedef</SPAN> itk::WatershedImageFilter<ScalarImageType> WatershedFilterType; <SPAN style="COLOR: green"></SPAN></SPAN></DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: blue">typedef</SPAN> itk::ImageFileWriter<RGBImageType> FileWriterType;</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"> </SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>FileReaderType::Pointer reader = FileReaderType::New</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>reader->SetFileName( <SPAN style="COLOR: rgb(163,21,21)">"c:/images/3DImages/Patient01.mhd"</SPAN><SPAN> </SPAN>);</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: green">//reader->SetFileName("c:/Images/BrainProtonDensitySlice.png");</SPAN></SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: green"> </SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>DiffusionFilterType::Pointer diffusion = DiffusionFilterType::New();</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>diffusion->SetNumberOfIterations( atoi(<SPAN style="COLOR: rgb(163,21,21)">"10"</SPAN>) );</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>diffusion->SetConductanceParameter( atof(<SPAN style="COLOR: rgb(163,21,21)">"2.0"</SPAN>) );</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>diffusion->SetTimeStep(0.0625);</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: green"> </SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>GradientMagnitudeFilterType::Pointer gradient = GradientMagnitudeFilterType::New();</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN></SPAN></DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>WatershedFilterType::Pointer watershed = WatershedFilterType::New();</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>watershed->SetLevel( atof(<SPAN style="COLOR: rgb(163,21,21)">"0.15"</SPAN>) );<SPAN> </SPAN></SPAN></DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>watershed->SetThreshold( atof(<SPAN style="COLOR: rgb(163,21,21)">"0.001"</SPAN>) );<SPAN> </SPAN><SPAN style="COLOR: green"></SPAN></SPAN></DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: blue">typedef</SPAN> itk::Functor::ScalarToRGBPixelFunctor<<SPAN style="COLOR: blue">unsigned</SPAN> <SPAN style="COLOR: blue">long</SPAN>><SPAN> </SPAN>ColorMapFunctorType;</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: blue">typedef</SPAN> itk::UnaryFunctorImageFilter<LabeledImageType,<SPAN> </SPAN>RGBImageType, ColorMapFunctorType> ColorMapFilterType;</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New();</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"> </SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>FileWriterType::Pointer writer = FileWriterType::New();</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>writer->SetFileName(<SPAN style="COLOR: rgb(163,21,21)">"c:/Images/WatershedSegImg.mhd"</SPAN>);</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"> </SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>diffusion->SetInput(reader->GetOutput());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>gradient->SetInput(diffusion->GetOutput());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>watershed->SetInput(gradient->GetOutput());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>colormapper->SetInput(watershed->GetOutput());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>writer->SetInput(colormapper->GetOutput());</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>writer->Update();</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"> </SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue">try</SPAN><SPAN style="FONT-SIZE: 10pt"> </SPAN></DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>{</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>writer->Update();<SPAN> </SPAN></SPAN></DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN> </SPAN>}</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: blue">catch</SPAN> (itk::ExceptionObject &e)</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>{</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>std::cerr << e << std::endl;</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN>}</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN></SPAN></DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"><SPAN> </SPAN><SPAN style="COLOR: blue">return</SPAN> 0;</SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt"> </SPAN> </DIV>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10pt">}</SPAN></DIV><PRE><SPAN></SPAN></PRE><PRE><SPAN>Thanks</SPAN></PRE><PRE>Sara <SPAN></SPAN></PRE></TD></TR></TBODY></TABLE><BR>
<HR SIZE=1>
Envoyé avec <A href="http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52423/*http://fr.docs.yahoo.com/mail/overview/index.html" target=_blank rel=nofollow>Yahoo! Mail</A>.<BR>Une boite mail plus intelligente. </DIV><PRE>_______________________________________________
Insight-users mailing list
<A href="mailto:Insight-users@itk.org" target=_blank rel=nofollow>Insight-users@itk.org</A>
<A href="http://www.itk.org/mailman/listinfo/insight-users" target=_blank rel=nofollow>http://www.itk.org/mailman/listinfo/insight-users</A>
</PRE></BLOCKQUOTE></TD></TR></TBODY></TABLE>
<DIV class=WgoR0d><BR>
<HR SIZE=1>
Envoyé avec <A href="http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52423/*http://fr.docs.yahoo.com/mail/overview/index.html" target=_blank rel=nofollow>Yahoo! Mail</A>.<BR>Une boite mail plus intelligente. </DIV><BR>_______________________________________________<BR>Insight-users mailing list<BR><A href="mailto:Insight-users@itk.org" target=_blank rel=nofollow>Insight-users@itk.org</A><BR><A href="http://www.itk.org/mailman/listinfo/insight-users" target=_blank rel=nofollow>http://www.itk.org/mailman/listinfo/insight-users</A><BR><BR></BLOCKQUOTE></DIV><BR></DIV></DIV></BLOCKQUOTE></td></tr></table><br>
<hr size="1">
Envoyé avec <a href="http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52423/*http://fr.docs.yahoo.com/mail/overview/index.html">Yahoo! Mail</a>.<br>Une boite mail plus intelligente. </a>