#if defined (_MSC_VER) && (_MSC_VER >= 1000) #pragma once #endif #ifndef _INC_BEH_SearchForObject #define _INC_BEH_SearchForObject #include "Behavior.h" #include "Beh_TranslateAll.h" #include "Beh_UniformScale.h" #include "Sense_AvgIntensity.h" #include "Geometric.h" #include namespace mial{ /*! A derived class of the behavioral ABC this class performs a translation towards the user provided location. Then, for a user provided duration it begins searching that area for a structure thats intensity is above the user provided threshold (via the Sense_AvgIntensity sensor). Upon finding an area with the minimum intensity level the Beh_UniformScale sub-behavior is launched, which scales up the deformable organism until the intensity condition is broken. This behavior does not has Beh_TranslateAll and Beh_UniformScale sub-behaviors. \param Type the internal type used for storage \param nDims the number of dimensions */ template class Beh_SearchForObject : public Behavior { public: //Smart pointers typedef Beh_SearchForObject Self; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; typedef itk::WeakPointer ConstWeakPointer; itkNewMacro(Self); typedef vnl_vector VectorType; typedef typename Behavior::Error Error; //! A structure defining the inputs for the behavior. /*! Since structures support public inheritance derived class must inherit from this class in their definitions of behaviorIn. */ struct behaviorIn: public Behavior::behaviorIn{ //Setup the smart pointer typedef behaviorIn Self; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; typedef itk::WeakPointer ConstWeakPointer; itkNewMacro(Self); //Define all custom here //! The internal intensity requirement to be met double intensityRequirement; //! The duration of the translation in deformable organism time. double duration; //! The location to translate too VectorType translateLoc; //! A method for converting stream-based arguments into the structures members (marshalling). /*! Stream is expected as "duration intensityLevel xPosition yPosition zPosition(3d only)" */ bool fillFromStream(std::stringstream &args){ translateLoc = VectorType(nDims); args>> duration; args>> intensityRequirement; for(int i=0;i> translateLoc(i);} return true;}; protected: behaviorIn(){}; }; virtual bool run(typename Behavior::behaviorIn * i, std::stringstream *s); bool isFinished(); virtual bool update(); virtual void cleanUp(); //! A pointer to the image used for the Sense_AvgIntensity sensor. typename TInputImage::ConstPointer image; //! A pointer for the geometric layer used for the Sense_AvgIntensity sensor. typename Geometric::Pointer geomLayer; private: void translate(VectorType &loc); void scale(); double startTime; double endTime; typedef Sense_AvgIntensity AvgIntensitySensorType; typename AvgIntensitySensorType::Pointer avgIntensitySensor; typedef Beh_TranslateAll TranslateBehaviorType; typedef Beh_UniformScale ScaleBehaviorType; typename TranslateBehaviorType::Pointer translateBehavior; typename ScaleBehaviorType::Pointer scaleBehavior; typename behaviorIn::Pointer input; bool found; bool trans; protected: Beh_SearchForObject(); }; }//end mial #include "Beh_SearchForObject.cxx" #endif /* _INC_BEH_SearchForObject_42E452A7009C_INCLUDED */