From: Diego Caceres Date: Mon, 5 Sep 2011 15:58:13 +0000 (+0000) Subject: FillFilter Range panel working!! :) :) :) X-Git-Tag: v1.0.4~65 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=946f520d175833a7d013118b88ed8a3231a8b212;p=creaMaracasVisu.git FillFilter Range panel working!! :) :) :) DFCH --- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp index da04d84..02a5130 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp @@ -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 <