[Insight-users] Update the membershipfunction in the MRFImageFilter

Luis Ibanez luis.ibanez at kitware.com
Thu Jan 12 08:32:10 EST 2006



Hi Nicolas,

Thanks for the detailed description of the problem
that you are facing.


Why are you invoking the New() operator as


     m_MembershipFunctionPtr->New();     ??


The normal way to do it would be:


     m_MembershipFunctionPtr = MembershipFunctionType::New();


Since the New() operator is a static functions that returns
the pointer to the newly created object.

In general in ITK, you crate an instance of an
object of type T with the following code:



          T::Pointer  myTobject  = T::New();


You may find useful to read the introductory section of the
ITK Software Guide. At least until the Data Representation
chapter (inclusive).

       http://www.itk.org/ItkSoftwareGuide.pdf




Please modify your usage of the New() operator, and let us
know if you continue experiencing any problems.



     Thanks



        Luis



=========================
Nicolas Forster wrote:
> Hi!
> 
> I have a problem with the MRFImageFilter. I use the 
> DistanceToCentroidMembershipFunction() and I want to update the clusters 
> at each iteration.
> 
> My problem is the following: I cannot creat a m_MembershipFunctionPtr. 
> Clearly I want to do
> 
> typedef itk::Statistics::DistanceToCentroidMembershipFunction< arrrray > 
> MembershipFunctionType;
> typename MembershipFunctionType::Pointer m_MembershipFunctionPtr;
> 
> m_MembershipFunctionPtr->New();
> m_MembershipFunctionPtr->SetCentroid( newCentroid ); (*)
> m_ClassifierPtr->AddMembershipFunction( m_MembershipFunctionPtr );*/
>   m_ClassifierPtr->Update();
> 
> in the .txx file (in the ApplyICMLabeller() just before labelledImage = 
> m_ClassifierPtr->GetClassifiedImage(); ). The compiler compile but when 
> I run the program it stop at the (*). It seems that 
> m_MembershipFunctionPtr does not exist.
> 
> Thanks for your help
> 
> Nico
> _______________________________________________
> 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