]> Creatis software - creaMaracasVisu.git/commitdiff
ManualPaint RangeSlider 50% DFCH
authorDiego Caceres <Diego.Caceres@creatis.insa-lyon.fr>
Tue, 9 Aug 2011 20:10:50 +0000 (20:10 +0000)
committerDiego Caceres <Diego.Caceres@creatis.insa-lyon.fr>
Tue, 9 Aug 2011 20:10:50 +0000 (20:10 +0000)
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/ManualPaintModel.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/ManualPaintModel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/ManualPaintPanel.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/ManualPaintPanel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/baseFilterManualPaint.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/baseFilterManualPaint.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/vtkInteractorManualPaint.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/wxManualPaintPanel.cpp

index b61cf00f12932e10401f623d2d8a4d9492498d82..4a1d0d6bf1a966ffc4ec037cf2951e8ecadd0ee9 100644 (file)
@@ -111,6 +111,9 @@ void BrushFilter::Run()  // virtual
                 {
 //                    if ((i>=_minX) && (i<=_maxX) && (j>=_minY) && (j<=_maxY) && (k>=_minZ) && (k<=_maxZ))
 //                    {
+                         float scalarComponent = _image->GetScalarComponentAsFloat(i,j,k, 0);
+                         if( ( this->GetRangeMin() <=  scalarComponent ) && ( scalarComponent <=  this->GetRangeMax() ) )
+                         {
                         zz=_pz-k;
                         zz=zz*zz;
                         if (_brushform==0)
@@ -123,6 +126,7 @@ void BrushFilter::Run()  // virtual
                                 _image->SetScalarComponentFromFloat (i,j,k, 0, value );
                             }
                         } // _brushform
+                         } //   GetRangeMin && GetRangeMax
 
 //                    } //if _minX _maxX _minY _maxY _minZ _maxZ
 
@@ -155,27 +159,25 @@ void BrushFilter::SetBrushTool( int brushtool )
 }
 
 //---------------------------------------------------------------------------
-void BrushFilter::SetRangeMin( unsigned int min )
+void BrushFilter::SetRangeMin( int min )
 {
-       std::cout<<"pechaaan   Min: " << min <<std::endl;
        _RangeMin  = min;
 }
 
 //---------------------------------------------------------------------------
-void BrushFilter::SetRangeMax( unsigned int max )
+void BrushFilter::SetRangeMax( int max )
 {
-       std::cout<<"pechaaan   Max: " << max <<std::endl;
        _RangeMax  = max;
 }
 
 //---------------------------------------------------------------------------
-unsigned int BrushFilter::GetRangeMin( )
+int BrushFilter::GetRangeMin( )
 {
        return( _RangeMin );
 }
 
 //---------------------------------------------------------------------------
-unsigned int BrushFilter::GetRangeMax(  )
+int BrushFilter::GetRangeMax(  )
 {
        return( _RangeMax );
 }
index d5b86dac323465160d7f616dcd657fb0c1938486..86f94e27ac8771590b077329828a6ce55a859ea4 100644 (file)
@@ -11,10 +11,10 @@ public:
     void SetBrushSize( int brushsize );
     void SetBrushForm( int brushform );
     void SetBrushTool( int brushtool );
-    void SetRangeMin( unsigned int min );//DFCH
-    void SetRangeMax( unsigned int max );//DFCH
-    unsigned int GetRangeMin( ); //DFCH
-    unsigned int GetRangeMax( ); //DFCH
+    void SetRangeMin( int min );//DFCH
+    void SetRangeMax( int max );//DFCH
+    int GetRangeMin( ); //DFCH
+    int GetRangeMax( ); //DFCH
     void FindMinMaxBrush(int &minxX,int &maxX,int &minY,int &maxY,int &minZ,int &maxZ,int &size);
     virtual void Run();
 
@@ -23,8 +23,8 @@ private:
     int             _brushsize;
     int             _brushform;
     int             _brushtool;
-    unsigned int    _RangeMin;
-    unsigned int    _RangeMax;
+    int                        _RangeMin;
+    int                        _RangeMax;
 
 
 
index 4b0d29b73d519afa994d20532359acdc6baf0314..944cfff590c683697555dcc01232d17afaebdb6f 100644 (file)
@@ -13,10 +13,10 @@ public:
 
     void SetToleranceFill(double tolerancefill);
     void SetDistanceFill(int distancefill);
-    void SetRangeMin( unsigned int min );//DFCH
-    void SetRangeMax( unsigned int max );//DFCH
-    unsigned int GetRangeMin( ); //DFCH
-    unsigned int GetRangeMax( ); //DFCH
+    void SetRangeMin( int min );//DFCH
+    void SetRangeMax( int max );//DFCH
+    int GetRangeMin( ); //DFCH
+    int GetRangeMax( ); //DFCH
     virtual void SetImage(vtkImageData *image);
 
 private:
@@ -37,8 +37,8 @@ private:
     bool             _auxGrayLevelValidationFill;
     long int        _countProgressingFill;
     long int        _limitRecursionFill;
-    unsigned int    _RangeMin;
-    unsigned int    _RangeMax;
+    int                        _RangeMin;
+    int                        _RangeMax;
     void    SetAuxImageFill(int px,int py, int pz);
 
 protected:
index ae9a7e3c6a3637bc95bd581b3c75286100f17df0..17a86cf96f2faa06c40ba10995fe66c25268542e 100644 (file)
@@ -60,14 +60,14 @@ void ManualPaintModel::SetGrayLevel( double graylevel )
 }
 
 //---------------------------------------------------------------------------
-void ManualPaintModel::SetRangeMin( unsigned int min )
+void ManualPaintModel::SetRangeMin( int min )
 {
        _brushfilter->SetRangeMin(min);
        _fillfilter->SetRangeMin(min);
 }
 
 //---------------------------------------------------------------------------
-void ManualPaintModel::SetRangeMax( unsigned int max )
+void ManualPaintModel::SetRangeMax( int max )
 {
        _brushfilter->SetRangeMax(max);
        _fillfilter->SetRangeMax(max);
@@ -105,4 +105,9 @@ void ManualPaintModel::SetDistanceFill(int distancefill)
 {
     _fillfilter->SetDistanceFill(distancefill);
 }
+//---------------------------------------------------------------------------
+void ManualPaintModel::GetScalarRange( double * range )
+{
+       _fillfilter->GetScalarRange( range );
+}
 
index c3199bbe1f82171836732789fc8f8cd73a909dc5..a39146321d27dbb04f4c39ecc66e9b52ae25ea03 100644 (file)
@@ -20,8 +20,9 @@ public:
     void SetToleranceFill(double tolerancefill);
     void SetDistanceFill(int distancefill);
     void PaintImage(int px,int py, int pz);
-    void SetRangeMin( unsigned int min );
-    void SetRangeMax( unsigned int max );
+    void SetRangeMin( int min );
+    void SetRangeMax( int max );
+    void GetScalarRange( double * range );
 
 
 private:
index 6a108da966827c2dedfca729a4fb6605dfb95484..764af391619c42bd707f265100d3fcc1c861b132 100644 (file)
@@ -33,22 +33,22 @@ void ManualPaintPanel::SetBrushSize( int brushsize )
 }
 
 //---------------------------------------------------------------------------
-void ManualPaintPanel::SetRangeMin( unsigned int min )
+void ManualPaintPanel::SetRangeMin( int min )
 {
     if (_manualPaintModel!=NULL)
     {
-       SetRangeMin( min );
+       _manualPaintModel->SetRangeMin( min );
     } else {
        printf("ERROR  in  ManualPaintPanel  _manualPaintModel not set.\n");
     }
 }
 
 //---------------------------------------------------------------------------
-void ManualPaintPanel::SetRangeMax( unsigned int max )
+void ManualPaintPanel::SetRangeMax( int max )
 {
     if (_manualPaintModel!=NULL)
     {
-       SetRangeMax( max );
+       _manualPaintModel->SetRangeMax( max );
     } else {
        printf("ERROR  in  ManualPaintPanel  _manualPaintModel not set.\n");
     }
@@ -120,3 +120,13 @@ void ManualPaintPanel::SetDistanceFill(int distancefill)
     }
 }
 
+void ManualPaintPanel::GetScalarRange( double * range )
+{
+       if (_manualPaintModel!=NULL)
+       {
+           _manualPaintModel->GetScalarRange( range );
+       } else {
+          printf("ERROR  in  ManualPaintPanel  _manualPaintModel not set.\n");
+       }
+}
+
index 10e39de9152bd2726fe595243cd1a0fc2cffef8a..d52f5f09ccbcd5c22138eae2a226062a6c1f0d5f 100644 (file)
@@ -16,8 +16,9 @@ public:
     void SetBrushForm(int brushform);
     void SetToleranceFill(double tolerancefill);
     void SetDistanceFill(int distancefill);
-    void SetRangeMin( unsigned int min );
-    void SetRangeMax( unsigned int max );
+    void SetRangeMin( int min );
+    void SetRangeMax( int max );
+    void GetScalarRange( double * range);
 
 private:
        ManualPaintModel        *_manualPaintModel;
index 90d153bcb228696e4f826c9d7fd56f5d5ac43f1d..a63ce13401e92da345e31515e832daf4ebc6b72e 100644 (file)
@@ -119,3 +119,10 @@ void baseFilterManualPaint::SetGeneralMinMax(int minX,int maxX,int minY,int maxY
 
 }
 
+//---------------------------------------------------------------------------
+void baseFilterManualPaint::GetScalarRange( double * range )
+{
+       range = this->_image->GetScalarRange();
+}
+
+
index ab4fa786b796c1c345a35e175f15c84fec5bcd90..4414e51bb184a389f2d0b6cf649d8454414ec4f6 100644 (file)
@@ -16,6 +16,7 @@ class baseFilterManualPaint  {
         void SetDirection(int direction);
         void ResetGeneralMinMax();
         void SetGeneralMinMax(int minX,int maxX,int minY,int maxY,int minZ,int maxZ);
+        void GetScalarRange( double * range );
         virtual void Run();
 
     private:
index 65d918efffedb5c09b5e3d5fd5c0c380809d1366..4d9a6201b069fe15d09906492e7eb88e81e7eb66 100644 (file)
@@ -54,7 +54,6 @@ bool vtkInteractorManualPaint::OnMouseMove ()
 {
        if ((_state==true) || (_stateKey==true))
        {
-               std::cout<<"Pechaaaaaannnnnnn!!!!"<<std::endl;
         wxVtk2DBaseView             *wxvtk2Dbaseview    = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
         wxVTKRenderWindowInteractor *wxVTKiren          = wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor();
         int px,py;
index 03ca42da959504c241fd2301fb5307cb572800b0..f68ec8a046263fc3385d7a1385655644322af68a 100644 (file)
@@ -23,8 +23,10 @@ wxManualPaintPanel::wxManualPaintPanel(wxWindow * parent)
                      _sldDistanceFill   = new wxSlider(panel, -1, 500, 1, 500, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
                      _distancefillCtrl  = new wxTextCtrl(panel , -1,_T("500") );
                      //DFCH -- BarSlices
-                     int min = 0;
-                     int max = 100;
+                     double range[0];
+                     GetScalarRange( range );
+                     int min = 0;//range[0];
+                     int max = 6000;//range[1];
                      _mBarSlices = new mBarRange( panel, 70, 65 );
                      _mBarSlices->SetMin( 0 );
                      _mBarSlices->SetStart( 0 );
@@ -299,17 +301,12 @@ void wxManualPaintPanel :: onActualChange_Bar(wxCommandEvent& event)
 }
 void wxManualPaintPanel :: onStartChange_Bar(wxCommandEvent& event)
 {
-       SetRangeMax( _mBarSlices->GetStart() );
-       /*mbbtkSliderMinMax->bbSetOutputOutStart(modBarRange->GetStart());
-       mbbtkSliderMinMax->bbSetInputInMinShow(modBarRange->GetStart());
-       mbbtkSliderMinMax->bbSignalOutputModification(std::string("OutStart"));*/
+       SetRangeMin( _mBarSlices->GetStart() );
 }
 
 void wxManualPaintPanel :: onEndChange_Bar(wxCommandEvent& event)
 {
        SetRangeMax( _mBarSlices->GetEnd() );
-       /*mbbtkSliderMinMax->bbSetOutputOutEnd(modBarRange->GetEnd());
-       mbbtkSliderMinMax->bbSignalOutputModification(std::string("OutEnd"));*/
 }
 
 void wxManualPaintPanel :: onSelectionEnd(wxCommandEvent& event)