+//ups ??EED DEF_POINTER_IMAGE_VTK_CREA(v_image,ss_image,p_image,st_image,_image)
+//ups ??EED DEF_POINTER_IMAGE_VTK_CREA(v_image2,ss_image2,p_image2,st_image2,_image2)
+
+ _countRecursiveFill++;
+ _countProgressingFill++;
+ if (_countProgressingFill > 200000)
+ {
+ printf("R %ld \n", _countRecursiveFill);
+ _countProgressingFill = 0;
+ }
+
+ if ((px >= _minX) && (px <= _maxX) && (py >= _minY) && (py <= _maxY)
+ && (pz >= _minZ) && (pz <= _maxZ))
+ {
+ if (_usingAuxImageFill == true)
+ {
+//UPS ??EED this->_IMManager->AddModifiedPixel(px, py, pz); //DFCH
+//EED01
+// _auxImageFill->SetScalarComponentFromFloat(px, py, pz, 0, 0);
+ _ptrAuxImageFill[ ivi ]=0;
+ }
+ difX=px-_pxfill;
+ difY=py-_pyfill;
+ difZ=pz-_pzfill;
+ _tmpDistfill = difX*difX + difY*difY + difZ*difZ;
+// _tmpDistfill = (px-_pxfill)*(px-_pxfill)
+// + (py-_pyfill)*(py-_pyfill)
+// + (pz-_pzfill)*(pz-_pzfill);
+
+//if (_countRecursiveFill >1 )
+//{
+// printf(" -> %d %d %d cr=%ld r=%f\n", px,py,pz,_countRecursiveFill , _tmpDistfill);
+//}
+
+
+//EED01
+// _tmpiglfill = _image->GetScalarComponentAsDouble(px, py, pz, 0);
+GETVALUE2_VTK_CREA(_tmpiglfill,p_image,st_image,ivi)
+
+ if (_image2!=NULL)
+ {
+//EED01
+// _tmpiglfill2 = _image2->GetScalarComponentAsDouble(px, py, pz, 0);
+GETVALUE2_VTK_CREA(_tmpiglfill2,p_image2,st_image2,ivi)
+ } else {
+ _tmpiglfill2 = _tmpiglfill;
+ }
+
+ 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 Range
+
+ if (isInRange)
+ {
+ _auxGrayLevelValidationFill = (_tmpiglfill != _graylevel)
+ && (_tmpiglfill2 != _graylevel)
+ && (_tmpiglfill >= grayLBFMTOL)
+ && (_tmpiglfill <= grayLBFPTOL)
+ && (_tmpDistfill <= _distbasefill); //DFCH
+ } else {
+ _auxGrayLevelValidationFill = false;
+ } // if isInRange
+
+ //DFCH
+ /*_auxGrayLevelValidationFill = (_tmpiglfill!=_graylevel) &&
+ (_tmpiglfill>=_graylevelbasefill-_tolerancefill) &&
+ (_tmpiglfill<=_graylevelbasefill+_tolerancefill) &&
+ (_tmpDistfill<=_distbasefill);*/ //DFCH
+
+ if (_auxGrayLevelValidationFill == true)
+ {
+//UPS ??EED this->_IMManager->AddModifiedPixel(px, py, pz); //DFCH
+ if (_image2!=NULL)
+ {
+//EED01
+// _image2->SetScalarComponentFromFloat(px, py, pz, 0,(float) _graylevel);
+SETVALUE2_VTK_CREA(_graylevel,p_image2,st_image2,ivi)
+ } else {
+//EED01
+// _image->SetScalarComponentFromFloat(px, py, pz, 0,(float) _graylevel);
+SETVALUE2_VTK_CREA(_graylevel,p_image,st_image,ivi)
+ }
+
+ if (_countRecursiveFill < _limitRecursionFill)
+ {
+
+ if (_2D3D == 0) //2D
+ {
+ if (_direction == 0) // YZ
+ {
+ //FillToolRecursive(px+1,py,pz);
+ //FillToolRecursive(px-1,py,pz);
+ FillToolRecursive(px, py + 1, pz, ivi+_OneLine );
+ FillToolRecursive(px, py - 1, pz, ivi-_OneLine );
+ FillToolRecursive(px, py, pz - 1, ivi-_OnePlane );
+ FillToolRecursive(px, py, pz + 1, ivi+_OnePlane );
+ }
+ if (_direction == 1) // XZ
+ {
+ FillToolRecursive(px + 1, py, pz, ivi+_OneColumn);
+ FillToolRecursive(px - 1, py, pz, ivi-_OneColumn);
+ //FillToolRecursive(px,py+1,pz);
+ //FillToolRecursive(px,py-1,pz);
+ FillToolRecursive(px, py, pz - 1, ivi-_OnePlane );
+ FillToolRecursive(px, py, pz + 1, ivi+_OnePlane );
+ }
+ if (_direction == 2) // XY
+ {
+ FillToolRecursive(px + 1, py, pz, ivi+_OneColumn);
+ FillToolRecursive(px, py + 1, pz, ivi+_OneLine);
+ FillToolRecursive(px - 1, py, pz, ivi-_OneColumn);
+ FillToolRecursive(px, py - 1, pz, ivi-_OneLine);
+ //FillToolRecursive(px,py,pz-1);
+ //FillToolRecursive(px,py,pz+1);
+ }
+ } else { // 3D
+ FillToolRecursive(px + 1, py, pz, ivi+_OneColumn );
+ FillToolRecursive(px - 1, py, pz, ivi-_OneColumn );
+ FillToolRecursive(px, py + 1, pz, ivi+_OneLine );
+ FillToolRecursive(px, py - 1, pz, ivi-_OneLine );
+ FillToolRecursive(px, py, pz - 1, ivi-_OnePlane );
+ FillToolRecursive(px, py, pz + 1, ivi+_OnePlane );
+ } // 2D 3D
+
+ } //_countRecursiveFill
+ } // _graylevel
+
+ if ((_auxGrayLevelValidationFill == true) && (_countRecursiveFill >= _limitRecursionFill))
+ {
+ _countRecursiveFillProblem++;
+ if (_2D3D == 0) //2D
+ {
+ if (_direction == 0) // YZ
+ {
+ //SetAuxImageFill(px+1,py,pz);
+ //SetAuxImageFill(px-1,py,pz);
+ SetAuxImageFill(px, py + 1, pz,ivi+_OneLine);
+ SetAuxImageFill(px, py - 1, pz,ivi-_OneLine);
+ SetAuxImageFill(px, py, pz - 1,ivi-_OnePlane);
+ SetAuxImageFill(px, py, pz + 1,ivi+_OnePlane);
+ }
+ if (_direction == 1) // XZ
+ {
+ SetAuxImageFill(px + 1, py, pz,ivi+_OneColumn);
+ SetAuxImageFill(px - 1, py, pz,ivi-_OneColumn);
+ //SetAuxImageFill(px,py+1,pz);
+ //SetAuxImageFill(px,py-1,pz);
+ SetAuxImageFill(px, py, pz - 1,ivi-_OnePlane);
+ SetAuxImageFill(px, py, pz + 1,ivi+_OnePlane);
+ }
+ if (_direction == 2) // XY
+ {
+ SetAuxImageFill(px + 1, py, pz,ivi+_OneColumn);
+ SetAuxImageFill(px - 1, py, pz,ivi-_OneColumn);
+ SetAuxImageFill(px, py + 1, pz,ivi+_OneLine);
+ SetAuxImageFill(px, py - 1, pz,ivi-_OneLine);
+ //SetAuxImageFill(px,py,pz-1);
+ //SetAuxImageFill(px,py,pz+1);
+ }
+ } else { // 3D
+ SetAuxImageFill(px + 1, py, pz,ivi+_OneColumn);
+ SetAuxImageFill(px - 1, py, pz,ivi-_OneColumn);
+ SetAuxImageFill(px, py + 1, pz,ivi+_OneLine);
+ SetAuxImageFill(px, py - 1, pz,ivi-_OneLine);
+ SetAuxImageFill(px, py, pz - 1,ivi-_OnePlane);
+ SetAuxImageFill(px, py, pz + 1,ivi+_OnePlane);
+ } // 2D 3D
+
+ } // _graylevel //_limitRecursionFill
+
+ } //if _minX _maxX _minY _maxY _minZ _maxZ
+ _countRecursiveFill--;