]> Creatis software - creaMaracasVisu.git/commitdiff
#2864 creaMaracasVisu Feature New Normal - Manual Paint , modifies external image...
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 1 Mar 2016 11:16:13 +0000 (12:16 +0100)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 1 Mar 2016 11:16:13 +0000 (12:16 +0100)
18 files changed:
bbtk/src/bbcreaMaracasVisuBitmapButtonIcon.cxx
bbtk/src/bbcreaMaracasVisuManualPaint.cxx
bbtk/src/bbcreaMaracasVisuManualPaint.h
bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx
bbtk/src/bbcreaMaracasVisuManualPaint_Model.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/ManualPaintModel.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/ManualPaintModel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/baseFilterManualPaint.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/baseFilterManualPaint.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/wxManualPaintPanel.cpp

index b02d67cf0ead5a1778e7f0a4ae20a2dddff0f6e5..840cdfb1a07c22c294f4ab4685119c745643b8f5 100644 (file)
@@ -21,11 +21,11 @@ void BitmapButtonIcon::Process()
                wxBitmap icon4(four_xpm);
                wxBitmap icon5(five_xpm);
                
-               if(index==1){ bbSetOutputIcon( icon1 );}
-               if(index==2){ bbSetOutputIcon( icon2 );}
-               if(index==3){ bbSetOutputIcon( icon3 );}
-               if(index==4){ bbSetOutputIcon( icon4 );}
-               if(index==5){ bbSetOutputIcon( icon5 );}
+               if(index==1){ bbSetOutputIcon( icon1 ); }
+               if(index==2){ bbSetOutputIcon( icon2 ); }
+               if(index==3){ bbSetOutputIcon( icon3 ); }
+               if(index==4){ bbSetOutputIcon( icon4 ); }
+               if(index==5){ bbSetOutputIcon( icon5 ); }
 }
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
index f29e5e103d08c2e36bad2b7aad9fb24542061e59..ba692644e2b621d30379b32924f6654c832adf62 100644 (file)
@@ -83,67 +83,49 @@ printf("ManualPaint::Process start\n");
     {
         firsttime=false;
 
-        ManualPaintModel        *mpModel        = new ManualPaintModel();
-        mpModel->SetImage( bbGetInputIn() );
+        ManualPaintModel        *mpModel                       = new ManualPaintModel();
+        mpModel->SetImages( bbGetInputIn() , bbGetInputIn2() );
 
-        wxManualPaintPanel        *mpPanel        = (wxManualPaintPanel*)bbGetOutputWidget();
-printf("ManualPaint::Process 1\n");
+        wxManualPaintPanel        *mpPanel                     = (wxManualPaintPanel*)bbGetOutputWidget();
         mpPanel->SetManualPaintModel(mpModel);
-printf("ManualPaint::Process 2 %p\n", mpPanel);
 
         if (bbGetInputWxVtkBaseView1()!=NULL)
         {
             ManualPaintControler    *mpControler    = new ManualPaintControler();
             mpControler->SetManualPaintModel(mpModel);
-printf("ManualPaint::Process 3\n");
             mpControler->SetManualPaintPanel(mpPanel);
-printf("ManualPaint::Process 4\n");
             mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView1() );
-printf("ManualPaint::Process 5 %p \n",bbGetInputWxVtkBaseView1() );
             mpControler->Config();
-printf("ManualPaint::Process 6\n");
         }
 
         if (bbGetInputWxVtkBaseView2()!=NULL)
         {
-printf("ManualPaint::Process 7\n");
             ManualPaintControler    *mpControler    = new ManualPaintControler();
-printf("ManualPaint::Process 7.1\n");
             mpControler->SetManualPaintModel(mpModel);
-printf("ManualPaint::Process 7.2\n");
             mpControler->SetManualPaintPanel(mpPanel);
-printf("ManualPaint::Process 7.3\n");
             mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView2() );
-printf("ManualPaint::Process 7.4 %p\n", bbGetInputWxVtkBaseView2() );
             mpControler->Config();
-printf("ManualPaint::Process 8\n");
         }
 
         if (bbGetInputWxVtkBaseView3()!=NULL)
         {
-printf("ManualPaint::Process 9\n");
             ManualPaintControler    *mpControler    = new ManualPaintControler();
             mpControler->SetManualPaintModel(mpModel);
             mpControler->SetManualPaintPanel(mpPanel);
             mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView3() );
             mpControler->Config();
-printf("ManualPaint::Process 10\n");
         }
 
         if (bbGetInputWxVtkBaseView4()!=NULL)
         {
-printf("ManualPaint::Process 11\n");
             ManualPaintControler    *mpControler    = new ManualPaintControler();
             mpControler->SetManualPaintModel(mpModel);
             mpControler->SetManualPaintPanel(mpPanel);
             mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView4() );
             mpControler->Config();
-printf("ManualPaint::Process 12\n");
         }
-printf("ManualPaint::Process 13\n");
 
-    }
-printf("ManualPaint::Process end\n");
+    } // firsttime
 
 }
 //=====
index b48977515f2d9f8d9c1015dc9582365c0ef715e7..0e66ac22467d4992504500144048065851af049e 100644 (file)
@@ -49,6 +49,7 @@ class bbcreaMaracasVisu_EXPORT ManualPaint
 // Don't edit this file. This file is generated from xml description..
 //=====
   BBTK_DECLARE_INPUT(In,vtkImageData*);
+  BBTK_DECLARE_INPUT(In2,vtkImageData*);
   BBTK_DECLARE_INPUT(WxVtkBaseView1,wxVtkBaseView*);
   BBTK_DECLARE_INPUT(WxVtkBaseView2,wxVtkBaseView*);
   BBTK_DECLARE_INPUT(WxVtkBaseView3,wxVtkBaseView*);
@@ -65,15 +66,18 @@ class bbcreaMaracasVisu_EXPORT ManualPaint
 };
 
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ManualPaint,bbtk::WxBlackBox);
-BBTK_NAME("ManualPaint");
-BBTK_AUTHOR("eduardo davila (Creatis)");
-BBTK_DESCRIPTION("Voxel manual paint");
-BBTK_CATEGORY("widget");
-BBTK_INPUT(ManualPaint,In,"Input image to be modified",vtkImageData*,"");
-BBTK_INPUT(ManualPaint,WxVtkBaseView1,"creaMaracasVisu viewer 2D",wxVtkBaseView*,"");
-BBTK_INPUT(ManualPaint,WxVtkBaseView2,"creaMaracasVisu viewer 2D",wxVtkBaseView*,"");
-BBTK_INPUT(ManualPaint,WxVtkBaseView3,"creaMaracasVisu viewer 2D",wxVtkBaseView*,"");
-BBTK_INPUT(ManualPaint,WxVtkBaseView4,"creaMaracasVisu viewer 2D",wxVtkBaseView*,"");
+  BBTK_NAME("ManualPaint");
+  BBTK_AUTHOR("eduardo davila (Creatis)");
+  BBTK_DESCRIPTION("Voxel manual paint");
+  BBTK_CATEGORY("widget");
+
+  BBTK_INPUT(ManualPaint,In,"Input Image / image result",vtkImageData*,"");
+  BBTK_INPUT(ManualPaint,In2,"Image result",vtkImageData*,"");
+  BBTK_INPUT(ManualPaint,WxVtkBaseView1,"creaMaracasVisu viewer 2D",wxVtkBaseView*,"");
+  BBTK_INPUT(ManualPaint,WxVtkBaseView2,"creaMaracasVisu viewer 2D",wxVtkBaseView*,"");
+  BBTK_INPUT(ManualPaint,WxVtkBaseView3,"creaMaracasVisu viewer 2D",wxVtkBaseView*,"");
+  BBTK_INPUT(ManualPaint,WxVtkBaseView4,"creaMaracasVisu viewer 2D",wxVtkBaseView*,"");
+
 BBTK_END_DESCRIBE_BLACK_BOX(ManualPaint);
 //=====
 // Don't edit this file. This file is generated from xml description..
index 87c4312f5cdca38e73722cf864e3788c0f15df20..de2b946de5bd4480bbc78899f08d27a8cc25a37e 100644 (file)
@@ -33,7 +33,7 @@ void ManualPaint_Model::Process()
                manualpaintmodel->SetActive( bbGetInputActive() );
                manualpaintmodel->SetTool( bbGetInputTool() );
                manualpaintmodel->Set2D3D( bbGetInput2D3D() );
-               manualpaintmodel->SetImage( bbGetInputImage() );
+               manualpaintmodel->SetImages( bbGetInputImage(),bbGetInputImage2() );
                manualpaintmodel->SetGrayLevel( bbGetInputGrayLevel() );
                manualpaintmodel->SetDirection( bbGetInputDirection() );
                manualpaintmodel->SetBrushSize( bbGetInputBrushSize() );
@@ -67,6 +67,7 @@ void ManualPaint_Model::bbUserSetDefaultValues()
        bbSetInputTool(1);  // Paint
        bbSetInput2D3D(1);  // 3D
        bbSetInputImage(NULL);
+       bbSetInputImage2(NULL);
        bbSetInputGrayLevel(100);
        bbSetInputDirection(2); // XY
        bbSetInputBrushSize(3);
index ed8279a29064ab9e37cff52037432b253c4d0575..e19ab05b6fb6aa1ff0b0d796ea33047c5abc347a 100644 (file)
@@ -24,6 +24,7 @@ class bbcreaMaracasVisu_EXPORT ManualPaint_Model
   BBTK_DECLARE_INPUT(Tool,int);
   BBTK_DECLARE_INPUT(2D3D,int);
   BBTK_DECLARE_INPUT(Image,vtkImageData*);
+  BBTK_DECLARE_INPUT(Image2,vtkImageData*);
   BBTK_DECLARE_INPUT(GrayLevel,double);
   BBTK_DECLARE_INPUT(Direction,int);
   BBTK_DECLARE_INPUT(BrushSize,int);
@@ -55,7 +56,8 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ManualPaint_Model,bbtk::AtomicBlackBox);
   BBTK_INPUT(ManualPaint_Model,Active,"true (default) , false",bool,"");
   BBTK_INPUT(ManualPaint_Model,Tool,"0=Brush, 1=Paint(default)",int,"");
   BBTK_INPUT(ManualPaint_Model,2D3D,"0=2D, 1=3D (default)",int,"");
-  BBTK_INPUT(ManualPaint_Model,Image,"Image input",vtkImageData*,"");
+  BBTK_INPUT(ManualPaint_Model,Image,"Image input / image result",vtkImageData*,"");
+  BBTK_INPUT(ManualPaint_Model,Image2,"Image result",vtkImageData*,"");
   BBTK_INPUT(ManualPaint_Model,GrayLevel,"Fill gray level (100 default)",double,"");
   BBTK_INPUT(ManualPaint_Model,Direction,"Used in the 2D mode.   0=YZ , 1=XY , 2=XY(default) ",int,"");
   BBTK_INPUT(ManualPaint_Model,BrushSize,"default 3",int,"");
index 20a8c38c47c4a4376e437d61cda7e4014a99a982..b478c254c48bb109c184e5798fddb794cccf214b 100644 (file)
@@ -72,6 +72,12 @@ void ColorLayerImageViewManager::SetwxVtkBaseView(int id, wxVtkBaseView *basevie
 }
 
 
+wxVtkBaseView*         ColorLayerImageViewManager::GetwxVtkBaseView(int id)
+{
+       return _colorLayerImageViewLst[id]->GetwxVtkBaseView();
+}
+
+
 //----------------------------------------------------------------------------
 void ColorLayerImageViewManager::SetX2(int x2)  
 {
index b00693026f57b2d393679faae249e8924a81535e..3c2fd26abcee0c12461cb0e943006e8c65d7022b 100644 (file)
@@ -44,29 +44,30 @@ class  ColorLayerImageViewManager
   public: 
          ColorLayerImageViewManager( );
          ~ColorLayerImageViewManager( );
-         void SetX2(int x2);
-         void SetY2(int y2);
-         void SetZ2(int z2);
-         virtual int GetX();
-         virtual int GetY();
-         virtual int GetZ();
-         void          SetwxVtkBaseView(int id, wxVtkBaseView *baseview);
-         void          SetBaseColors(std::vector<double> & base_color);
-         double        GetBaseColors(unsigned int index);
-         void          SetGreyLevelBoundaries(std::vector<double> & grey_level_boundary);
-         void          SetBaseTransparence(std::vector<double> & base_transparence);
-         void          SetRangeForColorBar(std::vector<double> & range);
-         double        GetGreyLevelBoundaries(unsigned int index);
-         void          SetPlainOrGradientColor(bool color_type);
-         int           GetBaseColorNb();
-         void          Refresh();
-         void          onThreshold();
-         void          onThresholdRemove();
-         void          onThresholdChange();
-         void          onThresholdInterpolation( bool interpolation );
-         void          SetSliceFixDynamic( bool fixdin );
-         void          onThresholdChangeOpacity( int opacity );
-         void          SetImage( vtkImageData* img );
+         void                          SetX2(int x2);
+         void                          SetY2(int y2);
+         void                          SetZ2(int z2);
+         virtual int           GetX();
+         virtual int           GetY();
+         virtual int           GetZ();
+         void                          SetwxVtkBaseView(int id, wxVtkBaseView *baseview);
+         wxVtkBaseView*        GetwxVtkBaseView(int id);
+         void                          SetBaseColors(std::vector<double> & base_color);
+         double                        GetBaseColors(unsigned int index);
+         void                          SetGreyLevelBoundaries(std::vector<double> & grey_level_boundary);
+         void                          SetBaseTransparence(std::vector<double> & base_transparence);
+         void                          SetRangeForColorBar(std::vector<double> & range);
+         double                        GetGreyLevelBoundaries(unsigned int index);
+         void                          SetPlainOrGradientColor(bool color_type);
+         int                           GetBaseColorNb();
+         void                          Refresh();
+         void                          onThreshold();
+         void                          onThresholdRemove();
+         void                          onThresholdChange();
+         void                          onThresholdInterpolation( bool interpolation );
+         void                          SetSliceFixDynamic( bool fixdin );
+         void                          onThresholdChangeOpacity( int opacity );
+         void                          SetImage( vtkImageData* img );
   private:
 
        std::vector< ColorLayerImageView* >     _colorLayerImageViewLst;
index 7763924fdad8c41fcf58465913689da140dc1997..371951cf4411b4fb5eccae9138f044e129be3e64 100644 (file)
@@ -304,6 +304,15 @@ void ColorLayerImageViewPanel::SetImage(vtkImageData *img)
                    _sl_SliceImageZ->SetRange( 0 , dim[2] );
                }
 
+printf("EED ColorLayerImageViewPanel::SetImage  UUPPSS----------------------\n"  );
+printf("EED ColorLayerImageViewPanel::SetImage  UUPPSS----------------------\n"  );
+printf("EED ColorLayerImageViewPanel::SetImage  UUPPSS----------------------\n"  );
+printf("EED ColorLayerImageViewPanel::SetImage  UUPPSS----------------------\n"  );
+printf("  Here I have to analyse the spacing and size image to calculate new spacingvv\n"  );
+printf("  I need the caracteristics of the base image\n"  );
+//                     GetColorLayerImageViewManager()->GetwxVtkBaseView(0);
+
+
         if ( (spc[0]!=_spcBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2]) ||
              (dim[0]!=_dimBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2])
             )
@@ -316,7 +325,7 @@ void ColorLayerImageViewPanel::SetImage(vtkImageData *img)
                                bool transformOkDlg;
                        wxString msg = _T("The image resolution of both images are not compatible. Do you want to tranform it? ");
                        wxDlgTransformByDimensionBySpacingByPixel dlg;
-                       dlg.GetTransformType(this,spc,spc,dim,dim,msg,typeOfTransformation,transformOkDlg);
+                       dlg.GetTransformType(this,_spcBase,spc,_dimBase,dim,msg,typeOfTransformation,transformOkDlg);
                        // CM Reset the default value (Pixel i.e. 3) if the dialog box returned an inappropriate value.
                        if (transformOkDlg == false)
                                {
index cb4564f2c480af7d9b9c0b82b9e55c688176b667..a26343843979618652779f4ad38353b6f7fafdd9 100644 (file)
@@ -88,25 +88,25 @@ class ColorLayerImageViewPanel
                        void SetActive(bool active);
 
                private:
-                       bool                                                                    _active;
-                       int                                                                     _fitting_mode;
-                       int                                                                     _dimBase[3];
-                       double                                                          _spcBase[3];
-                       double                                                          _spcOrg[3];
-                       bool                                                                    _thresholdGo;
+                       bool                                                    _active;
+                       int                                                             _fitting_mode;
+                       int                                                             _dimBase[3];
+                       double                                                  _spcBase[3];
+                       double                                                  _spcOrg[3];
+                       bool                                                    _thresholdGo;
                        ColorLayerImageViewManager      *_colorLayerImageViewManager;
-                       wxButton                                                                *_btn_ReadImage;
-                       wxSlider                                                                *_opacity;
-                       wxCheckBox                                                      *_interpolationCheckBox;
-                       wxCheckBox                                                      *_cb_ShowHide;
-                       wxCheckBox                                                      *_cb_SliceFixDinamic;
-                       wxSlider                                                                *_sl_SliceImageX;
-                       wxSlider                                                                *_sl_SliceImageY;
-                       wxSlider                                                                *_sl_SliceImageZ;
+                       wxButton                                                *_btn_ReadImage;
+                       wxSlider                                                *_opacity;
+                       wxCheckBox                                              *_interpolationCheckBox;
+                       wxCheckBox                                              *_cb_ShowHide;
+                       wxCheckBox                                              *_cb_SliceFixDinamic;
+                       wxSlider                                                *_sl_SliceImageX;
+                       wxSlider                                                *_sl_SliceImageY;
+                       wxSlider                                                *_sl_SliceImageZ;
 
 //Borrame
-//                     mBarRange2                                                      *_barrange2;
-                       Histogram*                                                      _histogram;
+//                     mBarRange2                                              *_barrange2;
+                       Histogram*                                              _histogram;
                        HistogramMinMaxLevel*                   _histogramMinMaxLevel;
 
                        void onReadImage(wxCommandEvent& event);
index ce9bf014a21137341eb0afecd7bb51d6f0b24824..7e5e76e053466852b97501e80cf761cc407893a3 100644 (file)
@@ -101,6 +101,9 @@ void BrushFilter::FindMinMaxBrush(int &minX, int &maxX, int &minY, int &maxY,
 //---------------------------------------------------------------------------
 void BrushFilter::Run() // virtual
 {
+
+printf("EED nBrushFilter::Run  _RangeMax %d \n",_RangeMax);
+
        if (_image != NULL)
        {
                float value = (float) _graylevel;
@@ -111,43 +114,55 @@ void BrushFilter::Run() // virtual
                FindMinMaxBrush(minX, maxX, minY, maxY, minZ, maxZ, size);
 
                double xx, yy, zz, rr = size * size;
+               float scalarComponent;
+               bool pixelModify;
 
-printf("EED BrushFilter::Run() %d  %d\n", _RangeMin, _RangeMax);
-
-               for (i = minX; i <= maxX; i++) {
+               for (i = minX; i <= maxX; i++) 
+               {
                        xx = _px - i;
                        xx = xx * xx;
-                       for (j = minY; j <= maxY; j++) {
+                       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))
-//                    {
-
-                                       float scalarComponent = _image->GetScalarComponentAsFloat(i,j, k, 0);
+                               for (k = minZ; k <= maxZ; k++) 
+                               {
+                                       pixelModify=false;
+                                       scalarComponent = _image->GetScalarComponentAsFloat(i,j, k, 0);
                                        if ((_RangeMin <= scalarComponent)
-                                                       && (scalarComponent <= _RangeMax )) {
+                                                       && (scalarComponent <= _RangeMax )) 
+                                       {
                                                if (_brushform == 0) 
                                                {
-                                                       this->_IMManager->AddModifiedPixel(i, j, k); //DFCH
-                                                       _image->SetScalarComponentFromFloat(i, j, k, 0,value);
+                                                       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) {
-                                                               this->_IMManager->AddModifiedPixel(i, j, k); //DFCH
-                                                               _image->SetScalarComponentFromFloat(i, j, k, 0,value);
+                                                               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
 
-//                    } //if _minX _maxX _minY _maxY _minZ _maxZ
-
-                               } //k
-                       } //j
-               } //i
+                               } //for k
+                       } //for j
+               } //for i
                _image->Modified();
        } else {
                printf(
@@ -156,37 +171,21 @@ printf("EED BrushFilter::Run() %d  %d\n", _RangeMin, _RangeMax);
 }
 
 //---------------------------------------------------------------------------
-void BrushFilter::SetBrushSize(int brushsize) {
+void BrushFilter::SetBrushSize(int brushsize) 
+{
        _brushsize = brushsize;
 }
 
 //---------------------------------------------------------------------------
-void BrushFilter::SetBrushForm(int brushform) {
+void BrushFilter::SetBrushForm(int brushform) 
+{
        _brushform = brushform;
 }
 
 //---------------------------------------------------------------------------
-void BrushFilter::SetBrushTool(int brushtool) {
+void BrushFilter::SetBrushTool(int brushtool) 
+{
        _brushtool = brushtool;
 }
 
-//---------------------------------------------------------------------------
-void BrushFilter::SetRangeMin(int min) {
-       _RangeMin = min;
-}
-
-//---------------------------------------------------------------------------
-void BrushFilter::SetRangeMax(int max) {
-       _RangeMax = max;
-}
-
-//---------------------------------------------------------------------------
-int BrushFilter::GetRangeMin() {
-       return _RangeMin;
-}
-
-//---------------------------------------------------------------------------
-int BrushFilter::GetRangeMax() {
-       return _RangeMax;
-}
 
index d13d8681219ea75fe5a9d429415c4aff7aa78bfc..3e35c343b3c6b924a442195b8bd85bc85b916c3c 100644 (file)
@@ -36,10 +36,6 @@ public:
     void SetBrushSize( int brushsize );
     void SetBrushForm( int brushform );
     void SetBrushTool( int brushtool );
-    void SetRangeMin( int min );//DFCH
-    void SetRangeMax( int max );//DFCH
-    int GetRangeMin( ); //DFCH
-    int GetRangeMax( ); //DFCH
     void FindMinMaxBrush(int &minxX,int &maxX,int &minY,int &maxY,int &minZ,int &maxZ,int &size);
     virtual void Run();
 
@@ -48,9 +44,6 @@ private:
     int             _brushsize;
     int             _brushform;
     int             _brushtool;
-    int                        _RangeMin;
-    int                        _RangeMax;
-
 
 
 protected:
index 197b07eea9135949f7a7fb0aa087185cb754b48b..afdaf48a362a2193d29e9a0c78824d6288be27da 100644 (file)
 
 #include "FillFilter.h"
 
-FillFilter::FillFilter() {
-       _tolerancefill = 50;
-       _distancefill = 500;
+FillFilter::FillFilter() 
+{
+       _tolerancefill          = 50;
+       _distancefill           = 500;
        _limitRecursionFill = 50000;
-       _auxImageFill = NULL;
+       _auxImageFill           = NULL;
 }
 
 //---------------------------------------------------------------------------
-FillFilter::~FillFilter() {
+FillFilter::~FillFilter() 
+{
        if (_auxImageFill != NULL)
        {
                _auxImageFill->Delete();
@@ -41,9 +43,9 @@ FillFilter::~FillFilter() {
 }
 
 //---------------------------------------------------------------------------
-void FillFilter::SetImage(vtkImageData *image) // virtual
-               {
-       baseFilterManualPaint::SetImage(image);
+void FillFilter::SetImages(vtkImageData *image,vtkImageData *image2) // virtual
+{
+       baseFilterManualPaint::SetImages(image,image2);
        if (_auxImageFill != NULL)
        {
                _auxImageFill->Delete();
@@ -102,25 +104,36 @@ void FillFilter::Run() // virtual
 }
 
 //---------------------------------------------------------------------------
-void FillFilter::FillToolRecursive(int px, int py, int pz) {
+void FillFilter::FillToolRecursive(int px, int py, int pz) 
+{
        _countRecursiveFill++;
 
        _countProgressingFill++;
-       if (_countProgressingFill > 200000) {
+       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) {
+                       && (pz >= _minZ) && (pz <= _maxZ)) 
+       {
+               if (_usingAuxImageFill == true) 
+               {
                        this->_IMManager->AddModifiedPixel(px, py, pz); //DFCH
                        _auxImageFill->SetScalarComponentFromFloat(px, py, pz, 0, 0);
                }
                _tmpDistfill = (px - _pxfill) * (px - _pxfill)
                                + (py - _pyfill) * (py - _pyfill)
                                + (pz - _pzfill) * (pz - _pzfill);
-               _tmpiglfill = _image->GetScalarComponentAsDouble(px, py, pz, 0);
+               _tmpiglfill     = _image->GetScalarComponentAsDouble(px, py, pz, 0);
+
+               if (_image2!=NULL)
+               {
+                       _tmpiglfill2    =       _image2->GetScalarComponentAsDouble(px, py, pz, 0);
+               } else {
+                       _tmpiglfill2    =       _tmpiglfill;
+               }
 
                float grayLBFMTOL = _graylevelbasefill - _tolerancefill;
                float grayLBFPTOL = _graylevelbasefill + _tolerancefill;
@@ -144,31 +157,40 @@ void FillFilter::FillToolRecursive(int px, int py, int pz) {
                        isInRange = true;
                } //fi esle
 
-               if (isInRange) {
+               if (isInRange) 
+               {
                        _auxGrayLevelValidationFill = (_tmpiglfill != _graylevel)
+                                       && (_tmpiglfill2 != _graylevel)
                                        && (_tmpiglfill >= grayLBFMTOL)
                                        && (_tmpiglfill <= grayLBFPTOL)
                                        && (_tmpDistfill <= _distbasefill); //DFCH
-               } //fi
-               else {
+               } else {
                        _auxGrayLevelValidationFill = false;
-               } //esle
+               } // if isInRange
+
                  //DFCH
                /*_auxGrayLevelValidationFill =   (_tmpiglfill!=_graylevel) &&
                 (_tmpiglfill>=_graylevelbasefill-_tolerancefill) &&
                 (_tmpiglfill<=_graylevelbasefill+_tolerancefill) &&
                 (_tmpDistfill<=_distbasefill);*/ //DFCH
-               if (_auxGrayLevelValidationFill == true) {
+
+               if (_auxGrayLevelValidationFill == true) 
+               {
                        this->_IMManager->AddModifiedPixel(px, py, pz); //DFCH
-                       _image->SetScalarComponentFromFloat(px, py, pz, 0,
-                                       (float) _graylevel);
+                       if (_image2!=NULL)
+                       {
+                               _image2->SetScalarComponentFromFloat(px, py, pz, 0,(float) _graylevel);
+                       } else {
+                               _image->SetScalarComponentFromFloat(px, py, pz, 0,(float) _graylevel);
+                       }
 
-                       if (_countRecursiveFill < _limitRecursionFill) {
+                       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);
@@ -208,7 +230,8 @@ void FillFilter::FillToolRecursive(int px, int py, int pz) {
                } // _graylevel
 
                if ((_auxGrayLevelValidationFill == true)
-                               && (_countRecursiveFill >= _limitRecursionFill)) {
+                               && (_countRecursiveFill >= _limitRecursionFill)) 
+               {
                        _countRecursiveFillProblem++;
 
                        if (_2D3D == 0) //2D
@@ -259,7 +282,8 @@ void FillFilter::FillToolRecursive(int px, int py, int pz) {
 }
 
 //---------------------------------------------------------------------------
-void FillFilter::SetAuxImageFill(int px, int py, int pz) {
+void FillFilter::SetAuxImageFill(int px, int py, int pz) 
+{
        if ((px >= _minX) && (px <= _maxX) && (py >= _minY) && (py <= _maxY)
                        && (pz >= _minZ) && (pz <= _maxZ)) {
                this->_IMManager->AddModifiedPixel(px, py, pz); //DFCH
@@ -268,31 +292,15 @@ void FillFilter::SetAuxImageFill(int px, int py, int pz) {
 }
 
 //---------------------------------------------------------------------------
-void FillFilter::SetToleranceFill(double tolerancefill) {
+void FillFilter::SetToleranceFill(double tolerancefill) 
+{
        _tolerancefill = tolerancefill;
 }
 
 //---------------------------------------------------------------------------
-void FillFilter::SetDistanceFill(int distancefill) {
+void FillFilter::SetDistanceFill(int distancefill) 
+{
        _distancefill = distancefill;
 }
 
-//---------------------------------------------------------------------------
-void FillFilter::SetRangeMin(int min) {
-       _RangeMin = min;
-}
-
-//---------------------------------------------------------------------------
-void FillFilter::SetRangeMax(int max) {
-       _RangeMax = max;
-}
-
-//---------------------------------------------------------------------------
-int FillFilter::GetRangeMin() {
-       return (_RangeMin);
-}
 
-//---------------------------------------------------------------------------
-int FillFilter::GetRangeMax() {
-       return (_RangeMax);
-}
index 9bf7796b71045241c28b2a7cfcd75786a7addeff..dc118a8eab717ed996cdc219a01bd3fdbe86c00e 100644 (file)
@@ -33,16 +33,12 @@ public:
        FillFilter();
        virtual ~FillFilter();
 
-    void Run();
-    void FillToolRecursive(int px,int py, int pz);
+    void                       Run();
+    void                       FillToolRecursive(int px,int py, int pz);
 
-    void SetToleranceFill(double tolerancefill);
-    void SetDistanceFill(int distancefill);
-    void SetRangeMin( int min );//DFCH
-    void SetRangeMax( int max );//DFCH
-    int GetRangeMin( ); //DFCH
-    int GetRangeMax( ); //DFCH
-    virtual void SetImage(vtkImageData *image);
+    void                       SetToleranceFill(double tolerancefill);
+    void                       SetDistanceFill(int distancefill);
+    virtual void       SetImages(vtkImageData *image,vtkImageData *image2);
 
 private:
     double          _tolerancefill;
@@ -55,16 +51,17 @@ private:
     double          _distbasefill;
     double          _tmpDistfill;
     double          _tmpiglfill;
+    double          _tmpiglfill2;
     long int        _countRecursiveFill;
     long int        _countRecursiveFillProblem;
     vtkImageData    *_auxImageFill;
-    bool             _usingAuxImageFill;
-    bool             _auxGrayLevelValidationFill;
+    bool            _usingAuxImageFill;
+    bool            _auxGrayLevelValidationFill;
     long int        _countProgressingFill;
     long int        _limitRecursionFill;
-    int                        _RangeMin;
-    int                        _RangeMax;
-    void    SetAuxImageFill(int px,int py, int pz);
+
+
+    void               SetAuxImageFill(int px,int py, int pz);
 
 protected:
 
index f0de5e28650a9480226af3f9197c12b0582e0b0c..0b81afae1286a814d8357d407350f8f2301f91d6 100644 (file)
@@ -82,12 +82,12 @@ void ManualPaintModel::Set2D3D(int dim2D3D)
 }
 
 //---------------------------------------------------------------------------
-void ManualPaintModel::SetImage(vtkImageData *image
+void ManualPaintModel::SetImages(vtkImageData *image,vtkImageData *image2
 {
        if (image!=NULL)
        {
-               _brushfilter->SetImage(image);
-               _fillfilter->SetImage(image);
+               _brushfilter -> SetImages(image,image2);
+               _fillfilter  -> SetImages(image,image2);
                _imageUndoRedo->SetImage(image);
        } else {
                printf("EED Warning image=NULL in ManualPaintModel::SetImage(image)\n ");
index 8ec61e2491b010c91c0e9d6490d2e84f393d2ea1..1a552e73f4e00f376ad9632b2a82d410e361c2f6 100644 (file)
@@ -44,7 +44,7 @@ public:
        void SetActive(bool active);
        void SetTool(int tool);
        void Set2D3D(int dim2D3D);
-       void SetImage(vtkImageData *image);
+       void SetImages(vtkImageData *image,vtkImageData *image2);
        void SetGrayLevel(double graylevel);
        void SetDirection(int direction);
        void SetBrushSize(int brushsize);
index f326ff525e2820fe53208d728d9111e392ad1b56..0a9f995c57616ad9292aaf3c9852d7f44b9fdd37 100644 (file)
 
 #include "baseFilterManualPaint.h"
 
-baseFilterManualPaint::baseFilterManualPaint() {
+baseFilterManualPaint::baseFilterManualPaint() 
+{
        _IMManager = new ImageMManager();
        _IMManager->CleanModifiedRegion();
-       _graylevel = 0.0;
-       _2D3D = 1; // 0 2D             ,   1 true 3D
-       _direction = 0; // 1 XZ             ,   0 YZ            ,   2 XY
-       _minX = 0;
-       _minY = 0;
-       _minZ = 0;
-       _maxX = 0;
-       _maxY = 0;
-       _maxZ = 0;
-
-       _pMinX = 0;
-       _pMinY = 0;
-       _pMinZ = 0;
-       _pMaxX = 0;
-       _pMaxY = 0;
-       _pMaxZ = 0;
+       _graylevel      = 0.0;
+       _2D3D           = 1; // 0 2D             ,   1 true 3D
+       _direction      = 0; // 1 XZ             ,   0 YZ            ,   2 XY
+       _image          = NULL;
+       _image2         = NULL;
+       _minX           = 0;
+       _minY           = 0;
+       _minZ           = 0;
+       _maxX           = 0;
+       _maxY           = 0;
+       _maxZ           = 0;
+
+       _pMinX          = 0;
+       _pMinY          = 0;
+       _pMinZ          = 0;
+       _pMaxX          = 0;
+       _pMaxY          = 0;
+       _pMaxZ          = 0;
+
+       _RangeMin       = 0;
+       _RangeMax       = 6000;
 }
 
 //---------------------------------------------------------------------------
@@ -79,18 +85,32 @@ void baseFilterManualPaint::SetPoint(int px, int py, int pz) {
 }
 
 //---------------------------------------------------------------------------
-void baseFilterManualPaint::SetImage(vtkImageData *image) {
+void baseFilterManualPaint::SetImages(vtkImageData *image, vtkImageData *image2) 
+{
+       _image  = image;
+       _image2 = image2;
+
        int ext[6];
-       _image = image;
        _image->GetWholeExtent(ext);
        _minX = 0;
        _minY = 0;
        _minZ = 0;
-       _maxX = ext[1] - ext[0];
-       _maxY = ext[3] - ext[2];
-       _maxZ = ext[5] - ext[4];
+
+       if (_image2!=NULL)
+       {
+               int extB[6];
+               _image2->GetWholeExtent(extB);
+               _maxX = std::min( ext[1]-ext[0] , extB[1]-extB[0] );
+               _maxY = std::min( ext[3]-ext[2] , extB[3]-extB[2] );
+               _maxZ = std::min( ext[5]-ext[4] , extB[5]-extB[4] );
+       } else {
+               _maxX = ext[1]-ext[0];
+               _maxY = ext[3]-ext[2];
+               _maxZ = ext[5]-ext[4];
+       } // if
 }
 
+
 //---------------------------------------------------------------------------
 void baseFilterManualPaint::ResetGeneralMinMax() {
        _pMinX = 10000;
@@ -135,10 +155,43 @@ void baseFilterManualPaint::GetScalarRange(double * range) {
        range = this->_image->GetScalarRange();
 }
 
+//---------------------------------------------------------------------------
 ImageMManager* baseFilterManualPaint::GetImageMManager() {
        return (this->_IMManager);
 } //DFCH
+
+//---------------------------------------------------------------------------
 void baseFilterManualPaint::CleanImageMManager() {
        this->_IMManager->CleanModifiedRegion();
 } //DFCH
 
+
+
+
+//---------------------------------------------------------------------------
+void baseFilterManualPaint::SetRangeMin(int min) 
+{
+       _RangeMin = min;
+}
+
+//---------------------------------------------------------------------------
+void baseFilterManualPaint::SetRangeMax(int max) 
+{
+       _RangeMax = max;
+}
+
+//---------------------------------------------------------------------------
+int baseFilterManualPaint::GetRangeMin() 
+{
+       return _RangeMin;
+}
+
+//---------------------------------------------------------------------------
+int baseFilterManualPaint::GetRangeMax() 
+{
+       return _RangeMax;
+}
+
+
+
+
index 32319a5a3eee1e3caa981125306278dca511f920..bdb76a4df51871292a97d724b5083440f48cbb68 100644 (file)
@@ -39,15 +39,20 @@ public:
        baseFilterManualPaint();
        virtual ~baseFilterManualPaint();
 
-       virtual void SetImage(vtkImageData *image);
+       virtual void SetImages(vtkImageData *image,vtkImageData *image2);
        void SetPoint(int px, int py, int pz);
        void Set2D3D(int dim2D3D);
        void SetGrayLevel(double graylevel);
        void SetDirection(int direction);
        void ResetGeneralMinMax();
-       void SetGeneralMinMax(int minX, int maxX, int minY, int maxY, int minZ,
-                       int maxZ);
+       void SetGeneralMinMax(int minX, int maxX, int minY, int maxY, int minZ, int maxZ);
        void GetScalarRange(double * range);
+
+    void SetRangeMin( int min );//DFCH
+    void SetRangeMax( int max );//DFCH
+    int GetRangeMin( ); //DFCH
+    int GetRangeMax( ); //DFCH
+
        ImageMManager* GetImageMManager(); //DFCH
        void CleanImageMManager(); //DFCH
        virtual void Run();
@@ -55,26 +60,31 @@ public:
 private:
 
 protected:
-       ImageMManager *_IMManager; //Saves the last modified region (MinX, MaxX, MinY, MaxY, MinZ, MaxZ).
-       vtkImageData *_image;
-       int _direction;
-       int _px; // start point of the brush
-       int _py;
-       int _pz;
-       int _pMinX; // General min max of many brush actions
-       int _pMinY;
-       int _pMinZ;
-       int _pMaxX;
-       int _pMaxY;
-       int _pMaxZ;
-       int _minX; // min max of the image
-       int _maxX;
-       int _minY;
-       int _maxY;
-       int _minZ;
-       int _maxZ;
-       bool _2D3D;
-       double _graylevel;
+       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                     _pMinX; // General min max of many brush actions
+       int                     _pMinY;
+       int                     _pMinZ;
+       int                     _pMaxX;
+       int                     _pMaxY;
+       int                     _pMaxZ;
+       int                     _minX; // min max of the image
+       int                     _maxX;
+       int                     _minY;
+       int                     _maxY;
+       int                     _minZ;
+       int                     _maxZ;
+       bool                    _2D3D;
+       double                  _graylevel;
+    int                        _RangeMin;
+    int                        _RangeMax;
+
+
 };
 
 #endif // _BASE_FILTER_MANUAL_PAINT_H_
index 4e8a54c403cac5fd3bbddc25d0b06d9b7708d9bc..ab311ae392aaa469c0c690c4ff9dbfe323cd7c26 100644 (file)
@@ -37,7 +37,7 @@ wxManualPaintPanel::wxManualPaintPanel( wxWindow * parent )
        //Title
        sizer->Add( tittleText );
        //giving some blank spaces
-       sizer->Add( new wxStaticText( this, -1, _T("             ") ) );
+       sizer->Add( new wxStaticText( this, -1, _T("          key A : Enable/Disable   ") ) );
 
        this->ConfigureActiveCBButton( );
        this->ConfigureBrushToolRadioButton( );
@@ -61,8 +61,7 @@ wxManualPaintPanel::wxManualPaintPanel( wxWindow * parent )
        this->_gConfigSizer = new wxFlexGridSizer( 1 );
        //BrushTool Radio Button
        //giving blank space
-       this->_gConfigSizer->Add(
-               new wxStaticText( this, -1, _T("             ") ) );
+       this->_gConfigSizer->Add(  new wxStaticText( this, -1, _T("             ") ) );
        //end of blank space
        this->_gConfigSizer->Add( _rbBrushTool, 1, wxGROW );
        //2D/3D Radio Button