}
//---------------------------------------------------------------------------
-void BrushFilter::FindMinMaxBrush(int &minX, int &maxX, int &minY, int &maxY,
+void BrushFilter::FindMinMaxBrush(int px, int py, int pz,int &minX, int &maxX, int &minY, int &maxY,
int &minZ, int &maxZ, int &size)
{
size = _brushsize - 1;
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+/*
minX = _px - size;
maxX = _px + size;
minY = _py - size;
maxY = _py + size;
minZ = _pz - size;
maxZ = _pz + size;
-
if (_2D3D == 0) //2D
{
if (_direction == 0) // YZ
maxZ = _pz;
}
} // _2D3D
+*/
+ minX = px - size;
+ maxX = px + size;
+ minY = py - size;
+ maxY = py + size;
+ minZ = pz - size;
+ maxZ = pz + size;
+ if (_2D3D == 0) //2D
+ {
+ if (_direction == 0) // YZ
+ {
+ minX = px;
+ maxX = px;
+ }
+ if (_direction == 1) // XZ
+ {
+ minY = py;
+ maxY = py;
+ }
+ if (_direction == 2) // XY
+ {
+ minZ = pz;
+ maxZ = pz;
+ }
+ } // _2D3D
if (_2D3D == 1) { } // 3D
}
//---------------------------------------------------------------------------
-void BrushFilter::Run() // virtual
+void BrushFilter::Run(int px, int py, int pz) // virtual
{
if (_image != NULL)
{
- this->_IMManager->BaseInitialPoint(_px, _py ,_pz);
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// this->_IMManager->BaseInitialPoint(_px, _py ,_pz);
+ this->_IMManager->BaseInitialPoint(px, py ,pz);
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);
+ FindMinMaxBrush(px,py,pz,minX, maxX, minY, maxY, minZ, maxZ, size);
double xx, yy, zz, rr = size * size;
float scalarComponent;
for (i = minX; i <= maxX; i++)
{
- xx = _px - i;
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// xx = _px - i;
+ xx = px - i;
xx = xx * xx;
for (j = minY; j <= maxY; j++)
{
- yy = _py - j;
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// yy = _py - j;
+ yy = py - j;
yy = yy * yy;
for (k = minZ; k <= maxZ; k++)
{
} // _brushform 0
if (_brushform == 1)
{
- zz = _pz - k;
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// zz = _pz - k;
+ zz = pz - k;
zz = zz * zz;
if ((xx + yy + zz) <= rr) {
pixelModify=true;
void SetBrushSize( int brushsize );
void SetBrushForm( int brushform );
void SetBrushTool( int brushtool );
- void FindMinMaxBrush(int &minxX,int &maxX,int &minY,int &maxY,int &minZ,int &maxZ,int &size);
- virtual void Run();
+ void FindMinMaxBrush(int px, int py, int pz,int &minxX,int &maxX,int &minY,int &maxY,int &minZ,int &maxZ,int &size);
+ virtual void Run(int px, int py, int pz);
private:
int _brushsize;
void FillFilter::Run(int px, int py, int pz) // virtual
{
long int ivi;
- if ((_px >= _minX) && (_px < _dimX) && (_py >= _minY) && (_py < _dimY)
- && (_pz >= _minZ) && (_pz < _dimZ))
+
+/* //EED 2020-04-28 BORRAME Change to local variables to use with openmp
+ if ( (_px >= _minX) && (_px < _dimX) &&
+ (_py >= _minY) && (_py < _dimY) &&
+ (_pz >= _minZ) && (_pz < _dimZ) )
{
this->_IMManager->BaseInitialPoint(_px, _py ,_pz);
-// FillToolLoop(_px, _py, _pz);
+ FillToolLoop(_px, _py, _pz);
+ } //if _minX _maxX _minY _maxY _minZ _maxZ
+*/
+
+ if ( (px >= _minX) && (px < _dimX) &&
+ (py >= _minY) && (py < _dimY) &&
+ (pz >= _minZ) && (pz < _dimZ) )
+ {
+ this->_IMManager->BaseInitialPoint(px, py ,pz);
FillToolLoop(px, py, pz);
+ } //if _minX _maxX _minY _maxY _minZ _maxZ
- } //if _minX _maxX _minY _maxY _minZ _maxZ
}
{
if (_tool == 0)
{
- _brushfilter->SetPoint(px, py, pz);
- _brushfilter->Run();
+// _brushfilter->SetPoint(px, py, pz);
+ _brushfilter->Run(px,py,pz);
} // _tool 2
if (_tool == 1)
{
- _fillfilter->SetPoint(px, py, pz);
+// _fillfilter->SetPoint(px, py, pz);
_fillfilter->Run(px,py,pz);
} // _tool 1
} // _active
//---------------------------------------------------------------------------
void ManualPaintModel::SetImages(vtkImageData *image,vtkImageData *image2)
{
-printf("EED ManualPaintModel::SetImage Start\n ");
if (image!=NULL)
{
-printf("EED ManualPaintModel::SetImage 1\n ");
_brushfilter -> SetImages(image,image2);
-printf("EED ManualPaintModel::SetImage 2\n ");
_fillfilter -> SetImages(image,image2);
-printf("EED ManualPaintModel::SetImage 3\n ");
if (image2!=NULL)
{
_imageUndoRedo->SetImage(image2);
-printf("EED ManualPaintModel::SetImage 4\n ");
} else {
_imageUndoRedo->SetImage(image);
-printf("EED ManualPaintModel::SetImage 5\n ");
}
//EED 2020-04-28 BORRAME Change to local variables to use with openmp
// _imageUndoRedo_visited->SetImage( _fillfilter->GetAuxImageFill() );
} else {
printf("EED Warning image=NULL in ManualPaintModel::SetImages(image,image2)\n ");
}
-printf("EED ManualPaintModel::SetImage End\n ");
}
//---------------------------------------------------------------------------
}
//---------------------------------------------------------------------------
-void baseFilterManualPaint::Run() // virtual
+void baseFilterManualPaint::Run(int px, int py, int pz) // virtual
{
}
_direction = direction;
}
+/* //EED 2020-04-28 BORRAME Change to local variables to use with openmp
//---------------------------------------------------------------------------
void baseFilterManualPaint::SetPoint(int px, int py, int pz)
{
_py = py;
_pz = pz;
}
-
+*/
+
//---------------------------------------------------------------------------
void baseFilterManualPaint::SetImages(vtkImageData *image, vtkImageData *image2)
{
int GetRangeMax( ); //DFCH
ImageMManager* GetImageMManager(); //DFCH
void CleanImageMManager(); //DFCH
- virtual void Run();
+ virtual void Run(int px, int py, int pz);
private:
protected:
ImageMManager *_IMManager; //Saves the last modified region (MinX, MaxX, MinY, MaxY, MinZ, MaxZ).
vtkImageData *_image;
vtkImageData *_image2;
int _direction;
- int _px; // start point of the brush
- int _py;
- int _pz;
int _minX; // min max of the image
int _minY;
int _minZ;
//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// int _px; // start point of the brush
+// int _py;
+// int _pz;
// int _maxX;
// int _maxY;
// int _maxZ;