<div dir="ltr">Please keep the mailing list cc'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"><<a href="mailto:akshay.pai.u@gmail.com" target="_blank">akshay.pai.u@gmail.com</a>></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<double,2> PixelType;
typedef itk::Image<PixelType,2> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(argv<a href="http://marc.info/?l=insight-users&m=119882779819459#1" target="_blank">[1]</a>);
try{
reader->Update();
}
catch(itk::ExceptionObject & excep)
{
std::cerr<<excep;
return -1;
}
unsigned int numberOfClasses = 3;
typedef itk::Vector< double, 2 > MeasurementVectorType;
//typedef PixelType MeasurementVectorType;
typedef itk::Statistics::ListSample< MeasurementVectorType > SampleType;
typedef itk::ImageRegionConstIterator<ImageType> ConstIteratorType;
ConstIteratorType sourceit(reader->GetOutput(), \
(reader->GetOutput())->GetLargestPossibleRegion()); sourceit.GoToBegin();
SampleType::Pointer sample = SampleType::New();
sample->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->Initialize( 101 );
normalGenerator2->Initialize( 110 );
//MeasurementVectorType mv;
double mean1 = 100;
double mean2 = 100;
double standardDeviation1 = 30;
double standardDeviation2 = 30;
for ( unsigned int i = 0 ; i < 100 ; ++i )
{
mv<a href="http://marc.info/?l=insight-users&m=119882779819459#0" target="_blank">[0]</a> = ( normalGenerator1->GetVariate() * standardDeviation1 ) + mean1;
mv<a href="http://marc.info/?l=insight-users&m=119882779819459#1" target="_blank">[1]</a> = ( normalGenerator2->GetVariate() * standardDeviation2 ) + mean2;
sample->PushBack( mv );
}
normalGenerator1->Initialize( 3024 );
normalGenerator2->Initialize(324 );
mean1 = 200;
mean2 = 200;
standardDeviation1 = 30;
standardDeviation2 = 30;
for ( unsigned int i = 0 ; i < 100 ; ++i )
{
mv<a href="http://marc.info/?l=insight-users&m=119882779819459#0" target="_blank">[0]</a> = ( normalGenerator1->GetVariate() * standardDeviation1 ) + mean1;
mv<a href="http://marc.info/?l=insight-users&m=119882779819459#1" target="_blank">[1]</a> = ( normalGenerator2->GetVariate() * standardDeviation2 ) + mean2;
sample->PushBack( mv );
}
normalGenerator1->Initialize( 7654 );
normalGenerator2->Initialize( 5467 );
mean1 = 300;
mean2 = 300;
standardDeviation1 = 60;
standardDeviation2 = 60;
for ( unsigned int i = 0 ; i < 100 ; ++i )
{
mv<a href="http://marc.info/?l=insight-users&m=119882779819459#0" target="_blank">[0]</a> = ( normalGenerator1->GetVariate() * standardDeviation1 ) + mean1;
mv<a href="http://marc.info/?l=insight-users&m=119882779819459#1" target="_blank">[1]</a> = ( normalGenerator2->GetVariate() * standardDeviation2 ) + mean2;
sample->PushBack( mv );
}
typedef itk::Array< double > ParametersType;
ParametersType params( 4 );
std::vector< ParametersType > initialParameters( numberOfClasses );
params<a href="http://marc.info/?l=insight-users&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&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&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&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&m=119882779819459#0" target="_blank">[0]</a> = params;
params<a href="http://marc.info/?l=insight-users&m=119882779819459#0" target="_blank">[0]</a> = 200.0;
params<a href="http://marc.info/?l=insight-users&m=119882779819459#1" target="_blank">[1]</a> = 200.0;
params<a href="http://marc.info/?l=insight-users&m=119882779819459#2" target="_blank">[2]</a> = 850.0;
params<a href="http://marc.info/?l=insight-users&m=119882779819459#3" target="_blank">[3]</a> = 850.0;
initialParameters<a href="http://marc.info/?l=insight-users&m=119882779819459#1" target="_blank">[1]</a> = params;
params<a href="http://marc.info/?l=insight-users&m=119882779819459#0" target="_blank">[0]</a> = 300.0;
params<a href="http://marc.info/?l=insight-users&m=119882779819459#1" target="_blank">[1]</a> = 300.0;
params<a href="http://marc.info/?l=insight-users&m=119882779819459#2" target="_blank">[2]</a> = 1500.0;
params<a href="http://marc.info/?l=insight-users&m=119882779819459#3" target="_blank">[3]</a> = 1500.0;
initialParameters<a href="http://marc.info/?l=insight-users&m=119882779819459#2" target="_blank">[2]</a> = params;
typedef itk::Statistics::GaussianMixtureModelComponent< SampleType >
ComponentType;
std::vector< ComponentType::Pointer > components;
for ( unsigned int i = 0 ; i < numberOfClasses ; i++ )
{
components.push_back( ComponentType::New() );
(components[i])->SetSample( sample );
(components[i])->SetParameters( initialParameters[i] );
}
typedef itk::Statistics::ExpectationMaximizationMixtureModelEstimator<
SampleType > EstimatorType;
EstimatorType::Pointer estimator = EstimatorType::New();
estimator->SetSample( sample );
estimator->SetMaximumIteration( 1200 );
itk::Array< double > initialProportions(numberOfClasses);
initialProportions<a href="http://marc.info/?l=insight-users&m=119882779819459#0" target="_blank">[0]</a> = 0.4;
initialProportions<a href="http://marc.info/?l=insight-users&m=119882779819459#1" target="_blank">[1]</a> = 0.4;
initialProportions<a href="http://marc.info/?l=insight-users&m=119882779819459#2" target="_blank">[2]</a> = 0.2;
estimator->SetInitialProportions( initialProportions );
for ( unsigned int i = 0 ; i < numberOfClasses ; i++)
{
estimator->AddComponent( (ComponentType::Superclass*)
(components[i]).GetPointer() );
}
estimator->Update();
for ( unsigned int i = 0 ; i < numberOfClasses ; i++ )
{
std::cout << "Cluster[" << i << "]" << std::endl;
std::cout << " Parameters:" << std::endl;
std::cout << " " << (components[i])->GetFullParameters()
<< std::endl;
std::cout << " Proportion: ";
std::cout << " " << (*estimator->GetProportions())[i] << 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"><<a href="mailto:akshay.pai.u@gmail.com" target="_blank">akshay.pai.u@gmail.com</a>></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"><<a href="mailto:akshay.pai.u@gmail.com" target="_blank">akshay.pai.u@gmail.com</a>></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>