#if defined (_MSC_VER) && (_MSC_VER >= 1000) #pragma once #endif #ifndef _SENSE_AvgIntensity #define _SENSE_AvgIntensity #include "itkImageRegionConstIterator.h" #include "Geometric.h" #include "itkImageFileWriter.h" #include "Sensor.h" namespace mial { //! Derived sensory class for computing image AvgIntensity. /*!A derived class of the sensory ABC, this class calculates the AvgIntensity of the image and returns it in the form of TAvgIntensityImage. Calculations are performed using ITK's AvgIntensityMagnitudeRecursiveGaussianImageFilter, and AvgIntensityRecursiveGaussianImageFilter, the later of which provides the derivatives along each direction. In order to run the sensor one must use its publicly defined sensorIn and sensorOut types to create the input arguments and receive the output. In this case the sensor takes a pointer to the input image and the standard deviation to be used for smoothing, and outputs a pointer to the AvgIntensity image.*/ template class Sense_AvgIntensity: public Sensor { //**************************************************** //Member variables //**************************************************** public: //Smartpointer typedef Sense_AvgIntensity Self; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; typedef itk::WeakPointer ConstWeakPointer; itkNewMacro(Self); typedef TInputImage InputImageType; typedef typename InputImageType::ConstPointer InputImagePointer; typedef itk::Image OutputImageType; typedef typename OutputImageType::ConstPointer OutputImagePointer; struct sensorIn: public Sensor::sensorIn{ //Smartpointer typedef sensorIn Self; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; typedef itk::WeakPointer ConstWeakPointer; itkNewMacro(Self); //Define all custom here InputImagePointer imageIn; typedef Geometric GeometricType; typename GeometricType::Pointer geom; protected: sensorIn(){}; }; struct sensorOut: public Sensor::sensorOut{ //Smartpointer typedef sensorOut Self; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; typedef itk::WeakPointer ConstWeakPointer; itkNewMacro(Self); //Define all custom here DataType avgIntensity; protected: sensorOut(){}; }; private: typename sensorOut::Pointer sensorOutput; //**************************************************** //Member functions //**************************************************** public: //Run the sensor virtual void run(typename Sensor::sensorIn * const i); //Overide in derived class if custom sensor output desired //virtual Sensor::sensorOut::Pointer getOutput(){ return sensorOutput;}; private: //write an image to file void writeImageToFile(OutputImagePointer img,char * name); protected: Sense_AvgIntensity(); }; } // end namespace mial #include "Sense_AvgIntensity.cxx" #endif