]> Creatis software - creaMaracasVisu.git/commitdiff
FillFilter Range panel working!! :) :) :)
authorDiego Caceres <Diego.Caceres@creatis.insa-lyon.fr>
Mon, 5 Sep 2011 15:58:13 +0000 (15:58 +0000)
committerDiego Caceres <Diego.Caceres@creatis.insa-lyon.fr>
Mon, 5 Sep 2011 15:58:13 +0000 (15:58 +0000)
DFCH

lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/wxManualPaintPanel.cpp

index da04d845305125c4712db7d377e7f178d22fd961..02a5130c17546f2dedfaa6be6211588771243bec 100644 (file)
@@ -6,7 +6,7 @@ FillFilter::FillFilter()
 {
     _tolerancefill      =   50;
     _distancefill       =   500;
-    _limitRecursionFill =   100000;
+    _limitRecursionFill =   50000;
     _auxImageFill       =   NULL;
 }
 
@@ -104,10 +104,48 @@ void FillFilter::FillToolRecursive(int px,int py, int pz)
         _tmpDistfill=(px-_pxfill)*(px-_pxfill)  + (py-_pyfill)*(py-_pyfill) + (pz-_pzfill)*(pz-_pzfill);
         _tmpiglfill=_image->GetScalarComponentAsDouble(px,py,pz, 0);
 
-        _auxGrayLevelValidationFill =   (_tmpiglfill!=_graylevel) &&
+        float grayLBFMTOL = _graylevelbasefill-_tolerancefill;
+        float grayLBFPTOL = _graylevelbasefill+_tolerancefill;
+        bool isInRange = false;
+        //DFCH
+        if( _RangeMin <= grayLBFMTOL && _RangeMax >= grayLBFPTOL )
+        {
+               isInRange = true;
+        }//fi esle
+        else if( _RangeMin > grayLBFMTOL && _RangeMax >= grayLBFPTOL )
+        {
+               grayLBFMTOL = _RangeMin;
+               isInRange = true;
+        }//fi esle
+        else if( _RangeMin <= grayLBFMTOL && _RangeMax < grayLBFPTOL )
+        {
+               grayLBFPTOL = _RangeMax;
+               isInRange = true;
+        }//fi esle
+        else if(  ( _RangeMin <= _graylevelbasefill ) && ( _graylevelbasefill <= _RangeMax ) )
+        {
+               grayLBFMTOL = _RangeMin;
+               grayLBFPTOL = _RangeMax;
+               isInRange = true;
+        }//fi esle
+
+        if( isInRange )
+        {
+               _auxGrayLevelValidationFill =  (_tmpiglfill!=_graylevel) &&
+                                           (_tmpiglfill>=grayLBFMTOL) &&
+                                           (_tmpiglfill<=grayLBFPTOL) &&
+                                           (_tmpDistfill<=_distbasefill); //DFCH
+        }//fi
+        else
+        {
+               _auxGrayLevelValidationFill = false;
+        }//esle
+        //DFCH
+        /*_auxGrayLevelValidationFill =   (_tmpiglfill!=_graylevel) &&
                                         (_tmpiglfill>=_graylevelbasefill-_tolerancefill) &&
                                         (_tmpiglfill<=_graylevelbasefill+_tolerancefill) &&
-                                        (_tmpDistfill<=_distbasefill);
+                                        (_tmpDistfill<=_distbasefill);*/ //DFCH
+
 
         if (  _auxGrayLevelValidationFill==true )
         {
@@ -239,14 +277,12 @@ void FillFilter::SetDistanceFill(int distancefill)
 //---------------------------------------------------------------------------
 void FillFilter::SetRangeMin(  int min )
 {
-       std::cout<<"pechaaan   Min: " << min <<std::endl;
        _RangeMin  = min;
 }
 
 //---------------------------------------------------------------------------
 void FillFilter::SetRangeMax(  int max )
 {
-       std::cout<<"pechaaan   Max: " << max <<std::endl;
        _RangeMax  = max;
 }
 
index f68ec8a046263fc3385d7a1385655644322af68a..e8f8d2c523e3cf90657b437f59d052d2ad1c134d 100644 (file)
@@ -23,7 +23,7 @@ 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
-                     double range[0];
+                     double range[2];
                      GetScalarRange( range );
                      int min = 0;//range[0];
                      int max = 6000;//range[1];