]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Visualization/ImageBlender.h
...
[cpPlugins.git] / lib / cpExtensions / Visualization / ImageBlender.h
index 6ba1a43137a7f52801249c896fb14ce9ffb4c445..7ccc86494c09d093dac237e5300bf0f4d0c18ba4 100644 (file)
@@ -3,7 +3,9 @@
 
 #include <cpExtensions/cpExtensions_Export.h>
 
+#include <cmath>
 #include <map>
+
 #include <vtkThreadedImageAlgorithm.h>
 
 namespace cpExtensions
@@ -19,21 +21,25 @@ namespace cpExtensions
       typedef ImageBlender Self;
       vtkTypeMacro( ImageBlender, vtkThreadedImageAlgorithm );
 
+      vtkGetMacro( MaxWindow, double );
+      vtkGetMacro( MaxLevel, double );
+      vtkGetMacro( MinWindow, double );
+      vtkGetMacro( MinLevel, double );
+      vtkGetMacro( Window, double );
+      vtkGetMacro( Level, double );
+
+      vtkSetMacro( MaxWindow, double );
+      vtkSetMacro( MaxLevel, double );
+      vtkSetMacro( MinWindow, double );
+      vtkSetMacro( MinLevel, double );
+      vtkSetMacro( Window, double );
+      vtkSetMacro( Level, double );
+
     public:
       static Self* New( );
       void PrintSelf( std::ostream& os, vtkIndent indent );
 
       unsigned int GetNumberOfImages( ) const;
-
-      const double& GetMaxWindow( ) const;
-      const double& GetMaxLevel( ) const;
-      const double& GetMinWindow( ) const;
-      const double& GetMinLevel( ) const;
-      const double& GetWindow( ) const;
-      const double& GetLevel( ) const;
-
-      void SetWindow( const double& w );
-      void SetLevel( const double& l );
       void SetWindowLevel( const double& w, const double& l );
 
       void GetColor(
@@ -72,7 +78,7 @@ namespace cpExtensions
         vtkImageData** inDatas,
         int numInputs,
         vtkImageData* outData,
-        int outExt[6],
+        int outExt[ 6 ],
         int id
         );
 
@@ -84,7 +90,7 @@ namespace cpExtensions
     protected:
       struct TColor
       {
-        double R, G, B;
+        double R, G, B, N;
         TColor(
           const double& r = double( 1 ),
           const double& g = double( 0 ),
@@ -93,16 +99,18 @@ namespace cpExtensions
           : R( r ),
             G( g ),
             B( b )
-          { }
+          {
+            this->N = std::sqrt( ( r * r ) + ( g * g ) + ( b * b ) );
+          }
       };
-      mutable std::map< unsigned int, TColor > m_Colors;
-
-      double m_MaxWindow;
-      double m_MaxLevel;
-      double m_MinWindow;
-      double m_MinLevel;
-      double m_Window;
-      double m_Level;
+      mutable std::map< unsigned int, TColor > Colors;
+
+      double MaxWindow;
+      double MaxLevel;
+      double MinWindow;
+      double MinLevel;
+      double Window;
+      double Level;
 
       int    m_Extent[ 6 ];
       double m_WLSlope;