AW: AW: AW: [Insight-users] MeanCalculator

Karthik Krishnan Karthik.Krishnan at kitware.com
Thu Aug 24 11:06:47 EDT 2006


Hello Corinna,

You need to have that line after the update call, not before the Update 
call. Its size is correctly reported. The Output is allocated at run 
time during the update. It will be 0 before the update.

    MeanCalculatorType::Pointer meanCalculator = MeanCalculatorType::New();
    meanCalculator->SetInputSample( abstractTrainingShapes );
    std::cout << "size of abstract training shapes: " << 
abstractTrainingShapes->Size() << std::endl;
    std::cout << "size of mean: " << 
meanCalculator->GetOutput()->GetSize() << std::endl;
    try
    {
        meanCalculator->Update();
    }
    catch( itk::ExceptionObject & excp )
    {...
    }
    std::cout << "size of mean: " << 
meanCalculator->GetOutput()->GetSize() << std::endl;


HTH
-karthik




Buerger, Corinna (ext) wrote:

>Hello Karthik, 
>
>Attached please find the relevant code of mine.
>Thanks a lot for your help!
>
>Bye, 
>
>Corinna
>
> 
>
>-----Ursprüngliche Nachricht-----
>Von: Karthik Krishnan [mailto:Karthik.Krishnan at kitware.com] 
>Gesendet: Dienstag, 22. August 2006 16:34
>An: Buerger, Corinna (ext)
>Cc: insight-users at itk.org
>Betreff: Re: AW: AW: [Insight-users] MeanCalculator
>
>That is very wierd. Could you please send me a minimal compiling example 
>to illustrate the problem.
>
>Thanks
>-karthik
>
>Buerger, Corinna (ext) wrote:
>
>  
>
>>Hi, 
>>
>>Thanks for the update. Unfortunately, it did not fix the problem. 
>>meanCalculator->GetInputSample()->Size() still outputs 0. What is different now is that Update() does not throw an exception. Still, I cannot go on and compute the covariance matrix.
>>
>>Bye, 
>>
>>Corinna
>>
>>
>>
>>
>>-----Ursprüngliche Nachricht-----
>>Von: Karthik Krishnan [mailto:Karthik.Krishnan at kitware.com] 
>>Gesendet: Freitag, 18. August 2006 22:12
>>An: Buerger, Corinna (ext)
>>Cc: insight-users at itk.org
>>Betreff: Re: AW: [Insight-users] MeanCalculator
>>
>>Another update. Please update Code/Numerics/Statistics/itkListSample.h
>>
>>That should fix your issue.
>>
>>Thanks
>>-karthik
>>
>>Buerger, Corinna (ext) wrote:
>>
>> 
>>
>>    
>>
>>>Hi Karthik, 
>>>
>>>Thanks for your quick reply!
>>>I updated the code and it does throw and exception. Still, I don't understand what is wrong here. As mentioned earlier, when I output the size of my input sample on std::cout, the correct size is displayed. Thanks for your help.
>>>
>>>Bye, 
>>>
>>>Corinna
>>>
>>>
>>>-----Ursprüngliche Nachricht-----
>>>Von: Karthik Krishnan [mailto:Karthik.Krishnan at kitware.com] 
>>>Gesendet: Montag, 14. August 2006 17:40
>>>An: Buerger, Corinna (ext)
>>>Cc: insight-users at itk.org
>>>Betreff: Re: [Insight-users] MeanCalculator
>>>
>>>Hi Corinna,
>>>
>>>I've added a safeguard to the itkMeanCalculator.txx, so it throws an 
>>>exception if the length of the output is 0. Please update  
>>>Code/Numerics/Statistics/itkMeanCalculator.txx and please let me know if 
>>>it throws an exception.
>>>
>>>If it doesn't, sample code would be appreciated.
>>>
>>>Thanks
>>>-karthik
>>>
>>>Buerger, Corinna (ext) wrote:
>>>
>>>
>>>
>>>   
>>>
>>>      
>>>
>>>>Hi all,
>>>>
>>>>I want to use the itk::Statistics::MeanCalculator.
>>>>The following lines are a code snippet of mine.
>>>>
>>>>// start code snippet
>>>>MeanCalculatorType::Pointer meanCalculator = MeanCalculatorType::New();
>>>>meanCalculator->SetInputSample( dataSample );
>>>>meanCalculator->Update();
>>>>std::cout << "size of data sample: " << dataSample->Size() << 
>>>>std::endl;                                     // outputs 3 (which is 
>>>>correct)
>>>>std::cout << "size of mean: " << 
>>>>meanCalculator->GetOutput()->GetSize() << std::endl;                // 
>>>>outputs 0 (why???)
>>>>// end code snippet
>>>>
>>>>dataSample is earlier defined as:
>>>>typedef itk::VariableLengthVector< double > DataType;
>>>>typedef itk::Statistics::ListSample< DataType > DataSampleType;
>>>>DataSampleType::Pointer dataSample;
>>>>
>>>>Why do I get no output from the MeanCalculator?
>>>>Any help is appreciated.
>>>>
>>>>Regards,
>>>>
>>>>Corinna
>>>>
>>>>------------------------------------------------------------------------
>>>>
>>>>_______________________________________________
>>>>Insight-users mailing list
>>>>Insight-users at itk.org
>>>>http://www.itk.org/mailman/listinfo/insight-users
>>>>
>>>>
>>>>  
>>>>
>>>>     
>>>>
>>>>        
>>>>
>>>_______________________________________________
>>>Insight-users mailing list
>>>Insight-users at itk.org
>>>http://www.itk.org/mailman/listinfo/insight-users
>>>
>>>
>>>
>>>   
>>>
>>>      
>>>
>>_______________________________________________
>>Insight-users mailing list
>>Insight-users at itk.org
>>http://www.itk.org/mailman/listinfo/insight-users
>>
>> 
>>
>>    
>>


More information about the Insight-users mailing list