- SetGeneralMinMax(minX,maxX,minY,maxY,minZ,maxZ);
-}
-
-
-
-//---------------------------------------------------------------------------
-void BrushFilter::Run() // virtual
-{
- if (_image!=NULL)
- {
- float value=(float)_graylevel;
- int i,j,k;
-
- int size;
- int minX,maxX,minY,maxY,minZ,maxZ;
- FindMinMaxBrush(minX,maxX,minY,maxY,minZ,maxZ,size);
-
- double xx,yy,zz,rr=size*size;
-
- for (i=minX; i<=maxX; i++)
- {
- xx=_px-i;
- xx=xx*xx;
- for (j=minY; j<=maxY; j++)
- {
- yy=_py-j;
- yy=yy*yy;
- for (k=minZ; k<=maxZ; k++)
- {
-// if ((i>=_minX) && (i<=_maxX) && (j>=_minY) && (j<=_maxY) && (k>=_minZ) && (k<=_maxZ))
-// {
- zz=_pz-k;
- zz=zz*zz;
- if (_brushform==0)
- {
- _image->SetScalarComponentFromFloat (i,j,k, 0, value );
- } else if (_brushform==1)
- {
- if ((xx+yy+zz)<=rr)
- {
- _image->SetScalarComponentFromFloat (i,j,k, 0, value );
- }
- } // _brushform
-
-// } //if _minX _maxX _minY _maxY _minZ _maxZ
-
- }//k
- }//j
- }//i
- _image->Modified();
- } else {
- printf("ERROR : bbcreaMaracasvisu::vtkInteractorManualPaint::PaintImage : Image not set. \n");
- } // _image
-}
-
-
-//---------------------------------------------------------------------------
-void BrushFilter::SetBrushSize( int brushsize )
-{
- _brushsize = brushsize;
-}
-
-//---------------------------------------------------------------------------
-void BrushFilter::SetBrushForm( int brushform )
-{
- _brushform = brushform;
-}
-
-//---------------------------------------------------------------------------
-void BrushFilter::SetBrushTool( int brushtool )
-{
- _brushtool = brushtool;
+ SetGeneralMinMax(minX, maxX, minY, maxY, minZ, maxZ);
+}
+
+//---------------------------------------------------------------------------
+void BrushFilter::Run() // virtual
+{
+ if (_image != NULL)
+ {
+ float value = (float) _graylevel;
+ int i, j, k;
+
+ int size;
+ int minX, maxX, minY, maxY, minZ, maxZ;
+ FindMinMaxBrush(minX, maxX, minY, maxY, minZ, maxZ, size);
+
+ double xx, yy, zz, rr = size * size;
+ float scalarComponent;
+ bool pixelModify;
+
+ for (i = minX; i <= maxX; i++)
+ {
+ xx = _px - i;
+ xx = xx * xx;
+ for (j = minY; j <= maxY; j++)
+ {
+ yy = _py - j;
+ yy = yy * yy;
+ for (k = minZ; k <= maxZ; k++)
+ {
+ pixelModify=false;
+ scalarComponent = _image->GetScalarComponentAsFloat(i,j, k, 0);
+ if ((_RangeMin <= scalarComponent) && (scalarComponent <= _RangeMax ))
+ {
+ if (_brushform == 0)
+ {
+ pixelModify=true;
+// this->_IMManager->AddModifiedPixel(i, j, k); //DFCH
+// _image->SetScalarComponentFromFloat(i, j, k, 0,value);
+ } // _brushform 0
+ if (_brushform == 1)
+ {
+ zz = _pz - k;
+ zz = zz * zz;
+ if ((xx + yy + zz) <= rr) {
+ pixelModify=true;
+// this->_IMManager->AddModifiedPixel(i, j, k); //DFCH
+// _image->SetScalarComponentFromFloat(i, j, k, 0,value);
+ }
+ } // _brushform 1
+ if (pixelModify==true)
+ {
+ this->_IMManager->AddModifiedPixel(i, j, k); //DFCH
+ if (_image2!=NULL)
+ {
+ _image2->SetScalarComponentFromFloat(i, j, k, 0,value);
+ }else {
+ _image->SetScalarComponentFromFloat(i, j, k, 0,value);
+ }
+ } // if pixelModify
+ } // GetRangeMin && GetRangeMax
+
+ } //for k
+ } //for j
+ } //for i
+ _image->Modified();
+ } else {
+ printf(
+ "ERROR : bbcreaMaracasvisu::vtkInteractorManualPaint::PaintImage : Image not set. \n");
+ } // _image
+}
+
+//---------------------------------------------------------------------------
+void BrushFilter::SetBrushSize(int brushsize)
+{
+ _brushsize = brushsize;
+}
+
+//---------------------------------------------------------------------------
+void BrushFilter::SetBrushForm(int brushform)
+{
+ _brushform = brushform;
+}
+
+//---------------------------------------------------------------------------
+void BrushFilter::SetBrushTool(int brushtool)
+{
+ _brushtool = brushtool;