[Insight-users] confidence connected filter applied to brain web data: the example gives incorrect segmentation!

sara meghellati sara_meghellati at yahoo.fr
Mon Sep 15 04:14:04 EDT 2008


Hi Luis,
Thank youfor your reply, yes some seeds are poorly located. I have tried other seeds and it's works fine. 
Thank you 
Sara 

--- En date de : Dim 14.9.08, Luis Ibanez <luis.ibanez at kitware.com> a écrit :

De: Luis Ibanez <luis.ibanez at kitware.com>
Objet: Re: confidence connected filter applied to brain web data: the example gives incorrect segmentation!
À: sara_meghellati at yahoo.fr
Cc: "insight itk" <insight-users at itk.org>
Date: Dimanche 14 Septembre 2008, 17h48


Hi Sara,


                 Thanks for pointing this out.


You have indeed found a bug in this section of the ITK Software Guide.

After playing with the code, and reviewing the locations of the seed
point, we found that three of them are poorly located.


We have fine tunned their locations to the following indices:


  InternalImageType::IndexType index1;
  index1[0] = 118;
  index1[1] = 133;
  index1[2] = 92;
  confidenceConnected->AddSeed( index1 );

  InternalImageType::IndexType index2;
  index2[0] = 63;
  index2[1] = 135;
  index2[2] = 94;
  confidenceConnected->AddSeed( index2 );

  InternalImageType::IndexType index3;
  index3[0] = 63;
  index3[1] = 157;
  index3[2] = 90;
  confidenceConnected->AddSeed( index3 );

  InternalImageType::IndexType index4;
  index4[0] = 111;
  index4[1] = 150;
  index4[2] = 90;
  confidenceConnected->AddSeed( index4 );

  InternalImageType::IndexType index5;
  index5[0] = 111;
  index5[1] = 50;
  index5[2] = 88;
  confidenceConnected->AddSeed( index5 );


Please find attached a corrected version of the source code.


You can run this program with the following command line:

  ./ConfidenceConnected brainweb165a10f17.mha segment.mhd

It should run in about 20 seconds.



Please give it a try and let us know if you find
any problems,


     Thanks


        Luis


----------------------------

BTW:
Please note that you don't need to use atoi() in the expression

       index1[0] = atoi("118");

You can simply do

       index1[0] = 118;


------------------------------------------------------------------
sara meghellati wrote:
> Hi Luis ,
> Unless I'm mistaken, I have applied the confidence connected filter as

> descripted in the itk book page 507,  but I couldn't get te same
result 
> as in the book ! the segmentation is very bad.
> I have applied this filter to the 
> volume /BrainPart2/Brain/brainweb165a10f17.mha  using 
> itk::GradientAnisotropicDiffusionImageFilter
> with the folling param
> //filter->SetNumberOfIterations( 2 );
> //filter->SetTimeStep( 0.05 );
> //filter->SetConductanceParameter( 3 );
> and
> confidenceConnected->SetMultiplier(2.5 );
> // confidenceConnected->SetNumberOfIterations(5);
> // confidenceConnected->SetReplaceValue(255);
> // confidenceConnected->SetInitialNeighborhoodRadius(2);
>  
> and the seeds points
>  
> InputImageType::IndexType index1;
> // index1[0] = atoi("118"); // Convert a string to integer.
> // index1[1] = atoi("85");
> // index1[2] = atoi("92");
> //
> // InputImageType::IndexType index2;
> // index2[0] = atoi( "63" );
> // index2[1] = atoi( "87" );
> // index2[2] = atoi( "94" );
> //
> // InputImageType::IndexType index3;
> // index3[0] = atoi( "63" );
> // index3[1] = atoi( "157" );
> // index3[2] = atoi( "90" );
> //
> // InputImageType::IndexType index4;
> // index4[0] = atoi( "111" );
> // index4[1] = atoi( "188" );
> // index4[2] = atoi( "90" );
> //
> // InputImageType::IndexType index5;
> // index5[0] = atoi( "111" );
> // index5[1] = atoi( "50" );
> // index5[2] = atoi( "88" );
>  
> As you can see all the parms that I have used as the same as described 
> in the book.
> please could you chek and tell me if I'm wrong.
>  
> Thanks
> Sara
>  
> 
> 
/*========================================================================= Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: ConfidenceConnected.cxx,v $ Language: C++ Date: $Date: 2005/11/19 16:31:50 $ Version: $Revision: 1.36 $ Copyright (c) Insight Software Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #if defined(_MSC_VER) #pragma warning ( disable : 4786 ) #endif #ifdef __BORLANDC__ #define ITK_LEAN_AND_MEAN #endif #include "itkConfidenceConnectedImageFilter.h" #include "itkImage.h" #include "itkCastImageFilter.h" #include "itkCurvatureFlowImageFilter.h" #include "itkImageFileReader.h" #include
 "itkImageFileWriter.h" int main( int argc, char *argv[] ) { if( argc < 3 ) { std::cerr << "Missing Parameters " << std::endl; std::cerr << "Usage: " << argv[0]; std::cerr << " inputImage outputImage " << std::endl; return 1; } typedef float InternalPixelType; const unsigned int Dimension = 3; typedef itk::Image< InternalPixelType, Dimension > InternalImageType; typedef unsigned char OutputPixelType; typedef itk::Image< OutputPixelType, Dimension > OutputImageType; typedef itk::CastImageFilter< InternalImageType, OutputImageType > CastingFilterType; CastingFilterType::Pointer caster = CastingFilterType::New(); typedef itk::ImageFileReader< InternalImageType > ReaderType; typedef itk::ImageFileWriter< OutputImageType > WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); reader->SetFileName( argv[1] ); writer->SetFileName( argv[2] ); typedef itk::CurvatureFlowImageFilter< InternalImageType,
 InternalImageType > CurvatureFlowImageFilterType; CurvatureFlowImageFilterType::Pointer smoothing = CurvatureFlowImageFilterType::New(); typedef itk::ConfidenceConnectedImageFilter ConnectedFilterType; ConnectedFilterType::Pointer confidenceConnected = ConnectedFilterType::New(); smoothing->SetInput( reader->GetOutput() ); confidenceConnected->SetInput( smoothing->GetOutput() ); caster->SetInput( confidenceConnected->GetOutput() ); writer->SetInput( caster->GetOutput() ); smoothing->SetNumberOfIterations( 2 ); smoothing->SetTimeStep( 0.05 ); confidenceConnected->SetMultiplier( 2.5 ); confidenceConnected->SetNumberOfIterations( 5 ); confidenceConnected->SetInitialNeighborhoodRadius( 2 ); confidenceConnected->SetReplaceValue( 255 ); InternalImageType::IndexType index1; index1[0] = 118; index1[1] = 133; index1[2] = 92; confidenceConnected->AddSeed( index1 ); InternalImageType::IndexType index2; index2[0] = 63; index2[1] = 135; index2[2] = 94;
 confidenceConnected->AddSeed( index2 ); InternalImageType::IndexType index3; index3[0] = 63; index3[1] = 157; index3[2] = 90; confidenceConnected->AddSeed( index3 ); InternalImageType::IndexType index4; index4[0] = 111; index4[1] = 150; index4[2] = 90; confidenceConnected->AddSeed( index4 ); InternalImageType::IndexType index5; index5[0] = 111; index5[1] = 50; index5[2] = 88; confidenceConnected->AddSeed( index5 ); try { writer->Update(); } catch( itk::ExceptionObject & excep ) { std::cerr << "Exception caught !" << std::endl; std::cerr << excep << std::endl; } return EXIT_SUCCESS; }


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080915/cfbefdc4/attachment.htm>


More information about the Insight-users mailing list