<div dir="ltr">Please keep the mailing list cc&#39;ed...<div><br></div><div style>Does program you provided, fail for you?</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 11, 2013 at 5:49 AM, Akshay <span dir="ltr">&lt;<a href="mailto:akshay.pai.u@gmail.com" target="_blank">akshay.pai.u@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Something like this?<br>
      <br>
      
      
      <pre style="line-height:normal;text-indent:0px;letter-spacing:normal;text-align:start;font-variant:normal;text-transform:none;font-style:normal;font-weight:normal;word-spacing:0px">int main(int argc, char * argv[] )
{

// EM- test

  typedef itk::Vector&lt;double,2&gt; PixelType;
  typedef itk::Image&lt;PixelType,2&gt; ImageType;
  typedef itk::ImageFileReader&lt;ImageType&gt; ReaderType;
  ReaderType::Pointer reader = ReaderType::New();
  reader-&gt;SetFileName(argv<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#1" target="_blank">[1]</a>);
  try{
        reader-&gt;Update();
  }
  catch(itk::ExceptionObject &amp; excep)
  {
        std::cerr&lt;&lt;excep;
        return -1;
  }
   
  unsigned int numberOfClasses = 3;
  typedef itk::Vector&lt; double, 2 &gt; MeasurementVectorType;
  //typedef PixelType MeasurementVectorType;
  typedef itk::Statistics::ListSample&lt; MeasurementVectorType &gt; SampleType;
  typedef itk::ImageRegionConstIterator&lt;ImageType&gt; ConstIteratorType;
  ConstIteratorType sourceit(reader-&gt;GetOutput(), \
(reader-&gt;GetOutput())-&gt;GetLargestPossibleRegion());  sourceit.GoToBegin();
  SampleType::Pointer sample = SampleType::New();
  sample-&gt;SetMeasurementVectorSize( 2 ); // length of measurement vectors
  //   
                                    // in the sample.
  //std::clock_t start = clock();
  MeasurementVectorType mv;
    
  typedef itk::Statistics::NormalVariateGenerator NormalGeneratorType;
  NormalGeneratorType::Pointer normalGenerator1 = NormalGeneratorType::New();
  NormalGeneratorType::Pointer normalGenerator2 = NormalGeneratorType::New();

  normalGenerator1-&gt;Initialize( 101 );
  normalGenerator2-&gt;Initialize( 110 );

  //MeasurementVectorType mv;
  double mean1 = 100;
  double mean2 = 100;
  double standardDeviation1 = 30;
  double standardDeviation2 = 30;
  for ( unsigned int i = 0 ; i &lt; 100 ; ++i )
    {
    mv<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#0" target="_blank">[0]</a> = ( normalGenerator1-&gt;GetVariate() * standardDeviation1 ) + mean1;
      mv<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#1" target="_blank">[1]</a> = ( normalGenerator2-&gt;GetVariate() * standardDeviation2 ) + mean2;
      sample-&gt;PushBack( mv );
    }

  normalGenerator1-&gt;Initialize( 3024 );
  normalGenerator2-&gt;Initialize(324 );
  mean1 = 200;
  mean2 = 200;
  standardDeviation1 = 30;
  standardDeviation2 = 30;
  for ( unsigned int i = 0 ; i &lt; 100 ; ++i )
    {
    mv<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#0" target="_blank">[0]</a> = ( normalGenerator1-&gt;GetVariate() * standardDeviation1 ) + mean1;
      mv<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#1" target="_blank">[1]</a> = ( normalGenerator2-&gt;GetVariate() * standardDeviation2 ) + mean2;
    sample-&gt;PushBack( mv );
    }
    normalGenerator1-&gt;Initialize( 7654 );
      normalGenerator2-&gt;Initialize( 5467 );
    mean1 = 300;
    mean2 = 300;
      standardDeviation1 = 60;
      standardDeviation2 = 60;
  for ( unsigned int i = 0 ; i &lt; 100 ; ++i )
    {
    mv<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#0" target="_blank">[0]</a> = ( normalGenerator1-&gt;GetVariate() * standardDeviation1 ) + mean1;
      mv<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#1" target="_blank">[1]</a> = ( normalGenerator2-&gt;GetVariate() * standardDeviation2 ) + mean2;

    sample-&gt;PushBack( mv );
    }
  typedef itk::Array&lt; double &gt; ParametersType;
  ParametersType params( 4 );
  std::vector&lt; ParametersType &gt; initialParameters( numberOfClasses );
  params<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#0" target="_blank">[0]</a> = 100.0;      // Mean of Component 1, gaussian 1 - Estimate
  params<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#1" target="_blank">[1]</a> = 100.0;      // Mean of Component 2, gaussian 1 - Estimate
  params<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#2" target="_blank">[2]</a> = 800.0;      // Variance of Component 1, gaussian 1 - Estimate
  params<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#3" target="_blank">[3]</a> = 800.0;      // Variance of  Componet 2, gaussian 1 - Estimate
  initialParameters<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#0" target="_blank">[0]</a> = params;
  params<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#0" target="_blank">[0]</a> = 200.0;
  params<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#1" target="_blank">[1]</a> = 200.0;
  params<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#2" target="_blank">[2]</a> = 850.0;
  params<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#3" target="_blank">[3]</a> = 850.0;
  initialParameters<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#1" target="_blank">[1]</a> = params;
  params<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#0" target="_blank">[0]</a> = 300.0;
  params<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#1" target="_blank">[1]</a> = 300.0;
  params<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#2" target="_blank">[2]</a> = 1500.0;
  params<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#3" target="_blank">[3]</a> = 1500.0;
  initialParameters<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#2" target="_blank">[2]</a> = params;
  typedef itk::Statistics::GaussianMixtureModelComponent&lt; SampleType &gt; 
    ComponentType;

  std::vector&lt; ComponentType::Pointer &gt; components;
  for ( unsigned int i = 0 ; i &lt; numberOfClasses ; i++ )
    {
    components.push_back( ComponentType::New() );
    (components[i])-&gt;SetSample( sample );
    (components[i])-&gt;SetParameters( initialParameters[i] );
    }
  typedef itk::Statistics::ExpectationMaximizationMixtureModelEstimator&lt; 
                           SampleType &gt; EstimatorType;
  EstimatorType::Pointer estimator = EstimatorType::New();

  estimator-&gt;SetSample( sample );
  estimator-&gt;SetMaximumIteration( 1200 );
  itk::Array&lt; double &gt; initialProportions(numberOfClasses);
  initialProportions<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#0" target="_blank">[0]</a> = 0.4;
  initialProportions<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#1" target="_blank">[1]</a> = 0.4;
  initialProportions<a href="http://marc.info/?l=insight-users&amp;m=119882779819459#2" target="_blank">[2]</a> = 0.2;      

  estimator-&gt;SetInitialProportions( initialProportions );
  
  for ( unsigned int i = 0 ; i &lt; numberOfClasses ; i++)
    {
    estimator-&gt;AddComponent( (ComponentType::Superclass*)
                             (components[i]).GetPointer() );
    }  
  estimator-&gt;Update();
  for ( unsigned int i = 0 ; i &lt; numberOfClasses ; i++ )
    {
    std::cout &lt;&lt; &quot;Cluster[&quot; &lt;&lt; i &lt;&lt; &quot;]&quot; &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;    Parameters:&quot; &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;         &quot; &lt;&lt; (components[i])-&gt;GetFullParameters() 
              &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;    Proportion: &quot;;
    std::cout &lt;&lt; &quot;         &quot; &lt;&lt; (*estimator-&gt;GetProportions())[i] &lt;&lt; std::endl;
    } 

      return 0;
}</pre><div><div class="h5">
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
      On 4/10/13 10:09 PM, Bill Lorensen wrote:<br>
    </div></div></div><div><div class="h5">
    <blockquote type="cite">
      <div dir="ltr">A small compilable example that illustrates the
        problem.<br>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Wed, Apr 10, 2013 at 3:58 PM, Akshay
          <span dir="ltr">&lt;<a href="mailto:akshay.pai.u@gmail.com" target="_blank">akshay.pai.u@gmail.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div>It is an external program called BSI i am trying to
                run. I am able to compile the binary successfully. This
                is what i get when i run the binary-<br>
                /home/akshay/InsightToolkit-4.3.1/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.txx:

                suspicious return value (3) from SVDC<br>
                /home/akshay/InsightToolkit-4.3.1/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.txx:

                M is 3x3<br>
                M = [ ...<br>
                             nan              nan              nan <br>
                             nan              nan              nan <br>
                             nan              nan              nan  ]<br>
                <br>
                Machine details : Intel(R) Xeon(R) CPU E5420  @ 2.50GHz
                Linux.<br>
                <br>
                However, i have no such issues on a Mac.<br>
                <br>
                Let me know what other information you need?
                <div>
                  <div><br>
                    <br>
                    <br>
                    <br>
                    On 4/10/13 9:54 PM, Bill Lorensen wrote:<br>
                  </div>
                </div>
              </div>
              <div>
                <div>
                  <blockquote type="cite">
                    <div dir="ltr">
                      <div>Please provide a small compilable example
                        that illsutrates you problm.<br>
                        <br>
                      </div>
                      Thanks,<br>
                      <br>
                      Bill<br>
                    </div>
                    <div class="gmail_extra"><br>
                      <br>
                      <div class="gmail_quote">On Wed, Apr 10, 2013 at
                        2:49 PM, Akshay <span dir="ltr">&lt;<a href="mailto:akshay.pai.u@gmail.com" target="_blank">akshay.pai.u@gmail.com</a>&gt;</span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
                          <br>
                          I am having issues with running a binary. I am
                          getting the error<br>
                          <br>
                           suspicious return value (3) from SVDC and M
                          is a set of NaN values. My itk version is 4.3.<br>
                          <br>
                          Any help is appreciated<br>
                          <br>
                          Best,<br>
                          <br>
                          Akshay<br>
                          _____________________________________<br>
                          Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
                          <br>
                          Visit other Kitware open-source projects at<br>
                          <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
                          <br>
                          Kitware offers ITK Training Courses, for more
                          information visit:<br>
                          <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
                          <br>
                          Please keep messages on-topic and check the
                          ITK FAQ at:<br>
                          <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
                          <br>
                          Follow this link to subscribe/unsubscribe:<br>
                          <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
                        </blockquote>
                      </div>
                      <br>
                      <br clear="all">
                      <br>
                      -- <br>
                      Unpaid intern in BillsBasement at noware dot com<br>
                    </div>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <br>
        -- <br>
        Unpaid intern in BillsBasement at noware dot com<br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>