[Insight-users] a cast problem ?
Karthik Krishnan
Karthik.Krishnan at kitware.com
Fri Sep 30 16:53:00 EDT 2005
Yes. Thanks for pointing this out.
I've just added overloaded SetMean methods to
itk::MahalanobisDistanceMembershipFunction that will take Array< .. > as
input.
http://www.itk.org/cgi-bin/viewcvs.cgi/Code/Numerics/Statistics/itkMahalanobisDistanceMembershipFunction.h?root=Insight&r1=text&tr1=1.10&r2=text&tr2=1.9&diff_format=h
http://www.itk.org/cgi-bin/viewcvs.cgi/Code/Numerics/Statistics/itkMahalanobisDistanceMembershipFunction.txx?root=Insight&r1=text&tr1=1.11&r2=text&tr2=1.10&diff_format=h
Let us know if you have further trouble.
Thanks
Regards
karthik
Lagaffe wrote:
>Hi Karthik,
>
>first many thanks for help ;-)
>
>As you told me in your previous mail I did the
>following change:
>replace:
>MahalanobisDistance->SetMean(meanAlgorithm[2]->GetOutput()->Get_vnl_vector());
>with
>MahalanobisDistance->SetMean(meanAlgorithm[2]->GetOutput());
>
>But it still doesn't work...
>
> error: no matching function for call to
>'itk::Statistics::MahalanobisDistanceMembershipFunction<itk::Vector<unsigned
>char, 3u> >::SetMean(itk::Array<double>*)'
>note: candidates are: void
>itk::Statistics::MahalanobisDistanceMembershipFunction<TVector>::SetMean(const
>vnl_vector<double>&) [with TVector =
>itk::Vector<unsigned char, 3u>]
>instantiated from here
>
>
>I also check in ITK code and:
> As you said:meanAlgorithm[2]->GetOutput() is of type
>itk::Array and not of type itk::Vector.
>AND the MahalanobisDistanceMembershipFunction->setMean
>needs a vnl_vector<double> (MeanVectorType)BUT the
>class Array derives from vnl_vector< TValueType >
>So normally
>MahalanobisDistance->SetMean(meanAlgorithm[2]->GetOutput());
>has to work !
>
>the error means that the itk:Array doesn't derives
>from vnl_vector wich is not possible, no ? so is it
>possible that it is a source file conflict (I did not
>do the itk installation)
>any idea ?
>
>thanks,
>Arnaud
>
>--- Karthik Krishnan <Karthik.Krishnan at kitware.com> a
>écrit :
>
>
>
>>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
>>>
>>>
>>>
>>>
>>>
>
>
>
>
>
>
>
>___________________________________________________________________________
>Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
>Téléchargez cette version sur http://fr.messenger.yahoo.com
>
>
>
More information about the Insight-users
mailing list