]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Algorithms/LightCompensationFilter.h
yet another refactoring
[cpPlugins.git] / lib / cpExtensions / Algorithms / LightCompensationFilter.h
diff --git a/lib/cpExtensions/Algorithms/LightCompensationFilter.h b/lib/cpExtensions/Algorithms/LightCompensationFilter.h
new file mode 100644 (file)
index 0000000..a3c28ff
--- /dev/null
@@ -0,0 +1,65 @@
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#ifndef __CPEXTENSIONS__ALGORITHMS__LIGHTCOMPENSATIONFILTER__H__
+#define __CPEXTENSIONS__ALGORITHMS__LIGHTCOMPENSATIONFILTER__H__
+
+#include <itkInPlaceImageFilter.h>
+#include <cpExtensions/Algorithms/ParallelImageMean.h>
+
+namespace cpExtensions
+{
+  namespace Algorithms
+  {
+    /**
+     */
+    template< class I >
+    class LightCompensationFilter
+      : public itk::InPlaceImageFilter< I, I >
+    {
+    public:
+      typedef LightCompensationFilter         Self;
+      typedef itk::InPlaceImageFilter< I, I > Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef I TImage;
+      typedef typename I::RegionType TRegion;
+
+      typedef cpExtensions::Algorithms::ParallelImageMean< I > TMeanCalculator;
+      typedef typename TMeanCalculator::TMean TMean;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( LightCompensationFilter, itkInPlaceImageFilter );
+
+      itkGetConstMacro( Mean, TMean );
+
+    protected:
+      LightCompensationFilter( );
+      virtual ~LightCompensationFilter( );
+
+    private:
+      virtual void BeforeThreadedGenerateData( );
+      virtual void ThreadedGenerateData(
+        const TRegion& region, itk::ThreadIdType id
+        );
+      virtual void AfterThreadedGenerateData( );
+
+    protected:
+      TMean m_Mean;
+      TMean m_Coefficient;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include <cpExtensions/Algorithms/LightCompensationFilter.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __CPEXTENSIONS__ALGORITHMS__LIGHTCOMPENSATIONFILTER__H__
+
+// eof - $RCSfile$