[Insight-users] a cast problem ?

Karthik Krishnan Karthik.Krishnan at kitware.com
Thu Sep 29 17:34:47 EDT 2005


Hi Arnaud,

Most of the classes in Statistics recently between Versions 2.0 and 2.2  
underwent a minor change, allow most of the algorithms to allow the 
number of random variates  to be specified at run-time.

 From an API standpoint, this boils down to
itk::Vector/ FixedArray being replaced with itk::Array
itk::Matrix replaced with itk::VariableSizeMatrix.

The error that you see below is cause of these changes.

meanAlgorithm[2]->GetOutput() is of type itk::Array and not of type itk::Vector. 
Since Array derives from vnl_vector, all you need to get the following code to compile is replace:

MahalanobisDistance->SetMean(meanAlgorithm[2]->GetOutput()->Get_vnl_vector());

with

MahalanobisDistance->SetMean(meanAlgorithm[2]->GetOutput());

We apologize for the API changes. All classes with such changes have this mentioned in bold on their doxygen pages.

Thanks
Regards
Karthik

 

Lagaffe wrote:

>Hello again,
>
>still trying to compile ;-)
>Well, another problem ...
>this is the line which was working before:
>MahalanobisDistance->SetMean(meanAlgorithm[2]->GetOutput()->Get_vnl_vector());
>and now ...
>error: 'class itk::Array<double>' has no member named
>'Get_vnl_vector'
>
>meanAlgorithm is an Array of
>itk::Statistics::MeanCalculator,
>Any idea, why now I have a pb with Get_vnl_vector ?
>
>thanks
>arnaud
>
>About my previous mail ... it seems that the problem
>is due to an inconsistency with the use of "const" ...
>but before it was compiling without problem ???
> 
>error: passing 'const itk::VariableSizeMatrix<double>'
>as 'this' argument of 'void
>itk::VariableSizeMatrix<T>::SetIdentity() [with T =
>double]' discards qualifiers
>it seems that discards qualifiers means:
>discards qualifier
>
>Example 
>myfile.cpp: In function `int main()':
> myfile.cpp:20: passing `const DayOfYear' as `this'
>argument of `void DayOfYear::Set(int, int)' discards
>qualifiers
>Meaning 
>You have an inconsistency with the use of "const"
>Usual Causes
>A non-const member function is being invoked for a
>const object
>A const object is being passed as a non-const
>parameter
>A const member function calls a non-const member
>function
>See the CMSC 202 lecture notes on the use of const
>
>=> thanks for help
>
>arnaud
>
>
>	
>
>	
>		
>___________________________________________________________________________ 
>Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
>Téléchargez cette version sur http://fr.messenger.yahoo.com
>_______________________________________________
>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