[Insight-users] Problems with ITK 4.3
Bill Lorensen
bill.lorensen at gmail.com
Thu Apr 11 08:29:30 EDT 2013
Please keep the mailing list cc'ed...
Does program you provided, fail for you?
On Thu, Apr 11, 2013 at 5:49 AM, Akshay <akshay.pai.u at gmail.com> wrote:
> Something like this?
>
> 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[1] <http://marc.info/?l=insight-users&m=119882779819459#1>);
> 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[0] <http://marc.info/?l=insight-users&m=119882779819459#0> = ( normalGenerator1->GetVariate() * standardDeviation1 ) + mean1;
> mv[1] <http://marc.info/?l=insight-users&m=119882779819459#1> = ( 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[0] <http://marc.info/?l=insight-users&m=119882779819459#0> = ( normalGenerator1->GetVariate() * standardDeviation1 ) + mean1;
> mv[1] <http://marc.info/?l=insight-users&m=119882779819459#1> = ( 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[0] <http://marc.info/?l=insight-users&m=119882779819459#0> = ( normalGenerator1->GetVariate() * standardDeviation1 ) + mean1;
> mv[1] <http://marc.info/?l=insight-users&m=119882779819459#1> = ( normalGenerator2->GetVariate() * standardDeviation2 ) + mean2;
>
> sample->PushBack( mv );
> }
> typedef itk::Array< double > ParametersType;
> ParametersType params( 4 );
> std::vector< ParametersType > initialParameters( numberOfClasses );
> params[0] <http://marc.info/?l=insight-users&m=119882779819459#0> = 100.0; // Mean of Component 1, gaussian 1 - Estimate
> params[1] <http://marc.info/?l=insight-users&m=119882779819459#1> = 100.0; // Mean of Component 2, gaussian 1 - Estimate
> params[2] <http://marc.info/?l=insight-users&m=119882779819459#2> = 800.0; // Variance of Component 1, gaussian 1 - Estimate
> params[3] <http://marc.info/?l=insight-users&m=119882779819459#3> = 800.0; // Variance of Componet 2, gaussian 1 - Estimate
> initialParameters[0] <http://marc.info/?l=insight-users&m=119882779819459#0> = params;
> params[0] <http://marc.info/?l=insight-users&m=119882779819459#0> = 200.0;
> params[1] <http://marc.info/?l=insight-users&m=119882779819459#1> = 200.0;
> params[2] <http://marc.info/?l=insight-users&m=119882779819459#2> = 850.0;
> params[3] <http://marc.info/?l=insight-users&m=119882779819459#3> = 850.0;
> initialParameters[1] <http://marc.info/?l=insight-users&m=119882779819459#1> = params;
> params[0] <http://marc.info/?l=insight-users&m=119882779819459#0> = 300.0;
> params[1] <http://marc.info/?l=insight-users&m=119882779819459#1> = 300.0;
> params[2] <http://marc.info/?l=insight-users&m=119882779819459#2> = 1500.0;
> params[3] <http://marc.info/?l=insight-users&m=119882779819459#3> = 1500.0;
> initialParameters[2] <http://marc.info/?l=insight-users&m=119882779819459#2> = 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[0] <http://marc.info/?l=insight-users&m=119882779819459#0> = 0.4;
> initialProportions[1] <http://marc.info/?l=insight-users&m=119882779819459#1> = 0.4;
> initialProportions[2] <http://marc.info/?l=insight-users&m=119882779819459#2> = 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;
> }
>
>
>
>
>
>
>
>
>
> On 4/10/13 10:09 PM, Bill Lorensen wrote:
>
> A small compilable example that illustrates the problem.
>
>
> On Wed, Apr 10, 2013 at 3:58 PM, Akshay <akshay.pai.u at gmail.com> wrote:
>
>> 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-
>> /home/akshay/InsightToolkit-4.3.1/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.txx:
>> suspicious return value (3) from SVDC
>> /home/akshay/InsightToolkit-4.3.1/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.txx:
>> M is 3x3
>> M = [ ...
>> nan nan nan
>> nan nan nan
>> nan nan nan ]
>>
>> Machine details : Intel(R) Xeon(R) CPU E5420 @ 2.50GHz Linux.
>>
>> However, i have no such issues on a Mac.
>>
>> Let me know what other information you need?
>>
>>
>>
>>
>> On 4/10/13 9:54 PM, Bill Lorensen wrote:
>>
>> Please provide a small compilable example that illsutrates you problm.
>>
>> Thanks,
>>
>> Bill
>>
>>
>> On Wed, Apr 10, 2013 at 2:49 PM, Akshay <akshay.pai.u at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I am having issues with running a binary. I am getting the error
>>>
>>> suspicious return value (3) from SVDC and M is a set of NaN values. My
>>> itk version is 4.3.
>>>
>>> Any help is appreciated
>>>
>>> Best,
>>>
>>> Akshay
>>> _____________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://www.kitware.com/products/protraining.php
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>
>>
>>
>> --
>> Unpaid intern in BillsBasement at noware dot com
>>
>>
>>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
>
>
>
--
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130411/4ee156eb/attachment.htm>
More information about the Insight-users
mailing list