#if defined (_MSC_VER) && (_MSC_VER >= 1000) #pragma once #endif #ifndef _INC_ORGANISM #define _INC_ORGANISM #include "ControlCenter.h" #include "Physics.h" #include "Geometric.h" namespace mial { //! The abstract base container class that houses and connects all layers of the deformable organism. /*! In medical image analysis strategies based on deformable models, controlling the deformations of the models is a desirable goal to produce proper segmentations. Incorporating expert knowledge to automatically guide deformations cannot be easily and elegantly achieved using the classical deformable model low-level energy-based fitting mechanisms. Deformable Organisms (DOs), are a decision-making framework for medical image analysis that complements bottom-up, data-driven deformable models with top-down, knowledge-driven mode-fitting strategies in a layered fashion inspired by artificial life modeling concepts. Intuitive and controlled deformations are carried out through behaviors. Sensory input from image data and contextual knowledge about the analysis problem govern these different behaviors. Deformable Organisms are built following a multilevel AL modelling approach consisting of four primary layers: cognitive, behavioral, physical, and geometrical. Specifically, the cognitive layer makes decisions based on the DOs current state, anatomical knowledge, and its surrounding environment (the image). Decisions could be made to sense information, to deform based on sensory data, to illicit help from the user, or to terminate the segmentation process. All of these actions are described under the behavioral layer of the organism, and they rely upon both the physical and geometrical layers for implementation. For example, in the context of our `vessel crawlers', the act of moving towards a sensed target location is described by the `growing' behavioral method. The cognitive center gathers sensory input using the `sense-to-grow' sensory module, decides the correct location via the `where-to-grow' decision module, elicits the act of `growing', and then conforms to the vascular walls by `fitting'. In turn, each of these methods relies upon the physical and geometrical layers to carry out tasks, such as maintaining model stability. Consequently, we have a framework with many independent layers of abstraction, each built upon the implementation of independent modules and or processes. \param DataType The data type to use (eg. float) \param nDims The dimensionality of the organism */ template class Organism { protected: //! The Physics layer used to simulate the deformation dynamics typename Physics::Pointer physLayer; //! The Geometric layer that houses the shape of the organism typename Geometric::Pointer geomLayer; //! The ControlCenter (or cognitive layer) that is responsible for deciding what action to take, and performing that action. typename ControlCenter::Pointer cgLayer; DataType runTime; public: //! The default constructor Organism(){runTime =1;}; //! The type used for the geometric layer typedef Geometric GeometricType; //virtual void addNode(DataType* )=0; //! Public method for adding behaviors. /*! \param Behavior * b the behavior to add \param bool replacePhys = true A boolean indicating whether or not to replace the physics layer of the passed in behavior with that of the organism. If set to false, the organism may run behaviors that actually simulate a different organism. */ virtual bool addBehaviour( Behavior * b,bool replacePhys=true ){if(b!=NULL){if(replacePhys){b->setPhysLayer(physLayer);}return cgLayer->addBehavior(b);}else{ return false;}}; // inline //! Public method for adding deformations /*! \param Deformation * d the deformation to add */ virtual bool addDeformation( Deformation * d ){ return physLayer->addDeformation(d); }; // inline //! Public method for setting the cogntive layer /*! \param ControlCenter * c the control center to set. */ virtual bool setCognitiveLayer( ControlCenter *c ){ if(c!=NULL){cgLayer = c;return true;}else{return false;}}; // inline //! Public method for setting the physics layer /*! \param Physics * p the physics layer to set. */ virtual bool setPhysicsLayer( Physics * p ){if(p!=NULL){physLayer = p; return true;}else{ return false;} }; // inline //! Public method for setting the geometric layer /*! \param Geometric * c the geometric layer to set. */ virtual bool setGeometricLayer( Geometric * g ){if(g!=NULL){geomLayer = g; return true;}else{return false;} }; // inline //virtual bool setDefaultBehaviour() =0; //virtual bool setSchedule() =0; //virtual bool postMessage() =0; //virtual char* checkMessages() =0; //! Public method for simulating the organism. /*! Implemenations of this method are in charge of running the cogntive and physics layers. */ virtual int run() =0; virtual void setRunTime(DataType r){runTime = r;}; private: }; } // end namespace mial #include "Organism.cxx" #endif /* _INC_ORGANISM*/