Hi ITK users,<br><br>I'm attempting to run fuzzy connectedness segmentation on a RGB image. Based on ITK documentation examples, I have&nbsp; compiled&nbsp; the code&nbsp; and build the executable but when I run it the program aborts and the following error message it is displayed:<br><br>.../vnl_matrix.txx :&nbsp; 1184: matrix has non-finite elements<br><br>Any suggestion to fix the problem?.<br><br>Here, it is the code:<br><br><br><br>#include "itkVectorConfidenceConnectedImageFilter.h"<br>#include "itkSimpleFuzzyConnectednessRGBImageFilter.h"<br><br><br>#include "itkImage.h"<br>#include "itkImageFileReader.h"<br>#include "itkImageFileWriter.h"<br>#include "itkVector.h"<br>#include "itkArray2D.h"<br><br><br>int main( int argc, char *argv[] )<br>{<br>&nbsp; if( argc &lt; 7 )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Missing Parameters " &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Usage: " &lt;&lt; argv[0];<br>&nbsp;&nbsp;&nbsp;
 std::cerr &lt;&lt; " inputImage&nbsp; outputImage outputmap seedX seedY multiplier " &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; return 1;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp; typedef&nbsp;&nbsp; unsigned char&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PixelComponentType;<br>&nbsp; const&nbsp;&nbsp; unsigned char&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;VDim = 3;<br>&nbsp; typedef&nbsp;&nbsp; itk::Vector&lt; PixelComponentType, VDim &gt;&nbsp;&nbsp; InputPixelType;<br>&nbsp; const&nbsp;&nbsp;&nbsp;&nbsp; unsigned int&nbsp;&nbsp;&nbsp; Dimension = 2;<br>&nbsp; typedef itk::Image&lt; InputPixelType, Dimension &gt;&nbsp; InputImageType;<br><br>&nbsp; typedef unsigned char OutputPixelType;<br>&nbsp; typedef itk::Image&lt; OutputPixelType, Dimension &gt; OutputImageType;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;
 typedef&nbsp; itk::VectorConfidenceConnectedImageFilter&lt; InputImageType, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OutputImageType &gt; ConnectedFilterType;<br>&nbsp; <br><br>&nbsp; ConnectedFilterType::Pointer confidenceConnected = ConnectedFilterType::New();<br><br>&nbsp; typedef itk::SimpleFuzzyConnectednessRGBImageFilter&lt; InputImageType, OutputImageType &gt;&nbsp; FuzzySegmentationFilterType;<br>&nbsp; <br>&nbsp; FuzzySegmentationFilterType::Pointer fuzzysegmenter = FuzzySegmentationFilterType::New();<br><br>&nbsp; typedef FuzzySegmentationFilterType::FuzzySceneType&nbsp; FuzzySceneType; <br><br>&nbsp; typedef&nbsp; itk::ImageFileReader&lt;&nbsp; InputImageType&nbsp;&nbsp; &gt; ReaderType;<br>&nbsp; typedef&nbsp; itk::ImageFileWriter&lt;&nbsp; OutputImageType&nbsp; &gt; WriterType;<br>&nbsp;
 typedef&nbsp; itk::ImageFileWriter&lt; FuzzySceneType&nbsp; &gt;&nbsp;&nbsp;&nbsp; FuzzyWriterType;<br><br><br>&nbsp; ReaderType::Pointer reader = ReaderType::New();<br>&nbsp; WriterType::Pointer writer = WriterType::New();<br><br>&nbsp; FuzzyWriterType::Pointer fwriter = FuzzyWriterType::New();<br><br>&nbsp; reader-&gt;SetFileName( argv[1] );<br>&nbsp; writer-&gt;SetFileName( argv[2] ); <br>&nbsp; fwriter-&gt;SetFileName( argv[3] );<br><br>&nbsp; InputImageType::IndexType index;<br><br>&nbsp; index[0] = atoi(argv[4]);<br>&nbsp; index[1] = atoi(argv[5]);<br><br><br>&nbsp; confidenceConnected-&gt;SetInput( reader-&gt;GetOutput() );<br><br>&nbsp; WriterType::Pointer confidenceWriter = WriterType::New();<br>&nbsp; confidenceWriter-&gt;SetInput( confidenceConnected-&gt;GetOutput() );<br>&nbsp; confidenceWriter-&gt;SetFileName("confConPre.png");<br>&nbsp; confidenceWriter-&gt;Update();<br><br>&nbsp;&nbsp; &nbsp;<br>&nbsp; fuzzysegmenter-&gt;SetInput( reader-&gt;GetOutput()
 );<br>&nbsp; &nbsp;<br>&nbsp; const double multiplier = atof( argv[6] );<br><br>&nbsp; confidenceConnected-&gt;SetMultiplier( multiplier );<br><br>&nbsp; const unsigned int iterations = 2;<br>&nbsp;&nbsp; &nbsp;<br>&nbsp; confidenceConnected-&gt;SetNumberOfIterations( iterations );<br><br>&nbsp; confidenceConnected-&gt;SetReplaceValue( 255 );<br><br>&nbsp; confidenceConnected-&gt;SetSeed( index );<br>&nbsp; &nbsp;<br>&nbsp; //confidenceConnected-&gt;AddSeed( index );<br><br>&nbsp; confidenceConnected-&gt;SetInitialNeighborhoodRadius( 3 );<br><br>&nbsp; typedef ConnectedFilterType::MeanVectorType&nbsp;&nbsp; MeanVectorType; <br>&nbsp;&nbsp; &nbsp;<br>&nbsp; const MeanVectorType &amp; mean = confidenceConnected-&gt;GetMean();<br><br>&nbsp; typedef ConnectedFilterType::CovarianceMatrixType&nbsp;&nbsp; CovarianceMatrixType; <br>&nbsp;&nbsp; &nbsp;<br>&nbsp; const CovarianceMatrixType &amp; covariance = confidenceConnected-&gt;GetCovariance();<br>&nbsp; <br>&nbsp; std::cout
 &lt;&lt; "Covariance matrix = " &lt;&lt; std::endl;<br>&nbsp; std::cout &lt;&lt; covariance &lt;&lt; std::endl;<br>&nbsp;&nbsp; &nbsp;<br>&nbsp; fuzzysegmenter-&gt;SetObjectSeed( index );<br>&nbsp; <br>&nbsp; const double * mean1 = mean.data_block();<br><br>&nbsp; const double * cov1 = covariance.data_block();<br><br>&nbsp; double ccov[3][3]; <br>&nbsp; <br>&nbsp; double mmean[3];<br>&nbsp; <br>&nbsp; int z=0;<br>&nbsp; for (int x=0; x&lt;3; ++x)<br>&nbsp; for (int y=0; y&lt;3; ++y)<br>&nbsp; {<br>&nbsp;&nbsp; &nbsp;&nbsp; ccov[x][y]= cov1[z];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ++z;<br>&nbsp; }<br><br> <br>&nbsp; for (int i=0; i&lt;3; ++i)<br>&nbsp; mmean[i]= mean1[i];<br><br>&nbsp; fuzzysegmenter-&gt;SetMean(&nbsp; mmean ); &nbsp;<br>&nbsp; fuzzysegmenter-&gt;SetVariance( ccov );<br>&nbsp; fuzzysegmenter-&gt;SetThreshold( 0.5 );<br>&nbsp; <br>&nbsp; writer-&gt;SetInput( fuzzysegmenter-&gt;GetOutput() );<br>&nbsp; <br>&nbsp; fwriter-&gt;SetInput(
 fuzzysegmenter-&gt;GetFuzzyScene() );<br>&nbsp; <br><br>&nbsp;&nbsp; try<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; fuzzysegmenter-&gt;Update();<br>&nbsp;&nbsp; &nbsp;writer-&gt;Update();<br>&nbsp;&nbsp;&nbsp; fwriter-&gt;Update();<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; catch( itk::ExceptionObject &amp; excep )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Exception caught !" &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; excep &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; }<br><br><br>&nbsp; return 0;<br>}<br><br><p>&#32;

<hr size=1>No need to miss a message. <a href="http://us.rd.yahoo.com/evt=43910/*http://mobile.yahoo.com/mail
">Get email on-the-go </a><br>with Yahoo! Mail for Mobile. <a href="http://us.rd.yahoo.com/evt=43910/*http://mobile.yahoo.com/mail
">Get started.</a>