00001 #if defined (_MSC_VER) && (_MSC_VER >= 1000)
00002 #pragma once
00003 #endif
00004 #ifndef _INC_Org_EulerSchedule
00005 #define _INC_Org_EulerSchedule
00006
00007 #include "itkOrganism.h"
00008
00009 #include "itkImageToImageFilter.h"
00010 #include "itkImage.h"
00011 #include "itkNumericTraits.h"
00012
00013 #include "itkImageRegionIterator.h"
00014
00015
00016 #include <iostream>
00017 #include "Phys_Euler.h"
00018 #include "Ctrl_ScheduleDriven.h"
00019 #include "Beh_TranslateAll.h"
00020 #include "Def_Translation.h"
00021 #include "Beh_UniformScale.h"
00022 #include "Def_UniformScale.h"
00023 #include "Sense_Gradient.h"
00024 #include "Geom_MeshSpatialObject.h"
00025
00026 using namespace mial;
00027 namespace itk
00028 {
00030
00045 template <class TInputImage, class TOutputImage,class TExternalForceImage, class DataType, int nDims>
00046 class ITK_EXPORT Org_EulerSchedule : public ItkOrganism<TInputImage,TOutputImage,TExternalForceImage,DataType,nDims>
00047 {
00048 public:
00050 itkStaticConstMacro(InputImageDimension, unsigned int,TInputImage::ImageDimension);
00051
00052 itkStaticConstMacro(OutputImageDimension, unsigned int,TOutputImage::ImageDimension);
00053
00054 typedef Org_EulerSchedule Self;
00055 typedef SmartPointer<Self> Pointer;
00056 typedef SmartPointer<const Self> ConstPointer;
00057 itkNewMacro(Self);
00058
00060 itkTypeMacro(Org_EulerSchedule, ItkOrganism);
00061
00062 typedef Geom_MeshSpatialObject<float,3> GeometricType;
00063 typedef Phys_Euler<float,TExternalForceImage,3> PhysLayerType;
00064 typedef Sense_Gradient<float,TInputImage,TExternalForceImage,3> gradientSensorType;
00065
00067 virtual bool setSchedule(std::string scheduleFileName){return cgL->setSchedule(scheduleFileName);};
00068
00070 virtual bool setTopology(std::string fName){
00071 return geomLayer->readTopologyFromFile(fName);};
00072
00074 virtual void setUp()
00075 {
00076 input->sigma = 1.0;
00077 input->imageIn = this->GetInput();
00078 gradientSensor->run(input);
00079 gradientSensor->run(input);
00080 typename gradientSensorType::sensorOut::Pointer output = (typename gradientSensorType::sensorOut *) ( gradientSensor->getOutput()).GetPointer();
00081 physLayer->setExternalForces((void *) &(output->imageOut));
00082 }
00083
00084
00085 protected:
00086 Ctrl_ScheduleDriven<float, 3>::Pointer cgL;
00087 typename GeometricType::Pointer geomLayer;
00088 typename PhysLayerType::Pointer physLayer;
00089 typename gradientSensorType::sensorIn::Pointer input;
00090 typename gradientSensorType::Pointer gradientSensor;
00091
00092 Org_EulerSchedule();
00093 virtual ~Org_EulerSchedule() {}
00094
00095
00096 };
00097 }
00098 #include "Org_EulerSchedule.cxx"
00099 #endif