]> Creatis software - creaMaracasVisu.git/commitdiff
2343 creaMaracasVisu Bug New Normal Interaction between ColorLayer and manualPaint
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Fri, 21 Mar 2014 14:23:14 +0000 (15:23 +0100)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Fri, 21 Mar 2014 14:23:14 +0000 (15:23 +0100)
16 files changed:
bbtk/bbs/boxes/UnitLayerPaint.bbg [new file with mode: 0644]
bbtk/bbs/boxes/UnitLayerPaint.bbs [new file with mode: 0644]
bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx
bbtk/src/bbcreaMaracasVisuManualPaint.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.cpp
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/ManualPaintPanel.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/ManualPaintPanel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/vtkInteractorManualPaint.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/wxManualPaintPanel.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/wxManualPaintPanel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView.cxx

diff --git a/bbtk/bbs/boxes/UnitLayerPaint.bbg b/bbtk/bbs/boxes/UnitLayerPaint.bbg
new file mode 100644 (file)
index 0000000..45b0ea3
--- /dev/null
@@ -0,0 +1,241 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/davila/Creatis/All/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/UnitLayerPaint.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:TRUE
+COMPLEXBOXNAME:UnitLayerPaint
+PACKAGENAME:creaMaracasVisu
+COMPLEXOUTPUTS:1
+COMPLEX_PORT
+OutWidget
+105.768851:-158.547510:-900.000000
+FIN_COMPLEX_PORT
+COMPLEXINPUTS:5
+COMPLEX_PORT
+InputImage
+-86.663553:91.493751:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+wxVtkBaseView_01
+-16.800689:91.353745:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+wxVtkBaseView_02
+59.831313:91.913768:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+wxVtkBaseView_03
+105.100769:84.227173:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+TitleModule
+124.916277:84.893462:-900.000000
+FIN_COMPLEX_PORT
+BOXES:16
+BOX
+creaMaracasVisu:ViewerNV:Box09
+ISEXEC:FALSE
+33.629033:-1.576918:-900.000000
+94.269033:-11.576918:-900.000000
+PORT
+nTypeView:"0"
+FIN_BOX
+BOX
+creaMaracasVisu:ManualPaint:Box11
+ISEXEC:FALSE
+-22.062493:7.255105:-900.000000
+23.512507:-2.744895:-900.000000
+PORT
+WinTitle:"Paint"
+FIN_BOX
+BOX
+wx:LayoutLine:Box13
+ISEXEC:FALSE
+-92.239645:-52.736806:-900.000000
+-34.679645:-62.736806:-900.000000
+PORT
+Orientation:"H"
+FIN_BOX
+BOX
+wx:LayoutTab:Box15
+ISEXEC:FALSE
+-115.371591:-25.436420:-900.000000
+-57.811591:-35.436420:-900.000000
+FIN_BOX
+BOX
+wx:LayoutTab:Box16
+ISEXEC:FALSE
+-30.536965:-32.299285:-900.000000
+27.023035:-42.299285:-900.000000
+FIN_BOX
+BOX
+wx:LayoutLine:Box17
+ISEXEC:FALSE
+-115.258808:-7.150446:-900.000000
+-57.698808:-17.150446:-900.000000
+PORT
+WinTitle:"Color"
+FIN_BOX
+BOX
+wx:LayoutLine:Box18
+ISEXEC:FALSE
+-34.328234:-13.564862:-900.000000
+23.231766:-23.564862:-900.000000
+PORT
+WinTitle:"Paint"
+FIN_BOX
+BOX
+wx:LayoutSplit:Box19
+ISEXEC:FALSE
+69.201144:-118.185923:-900.000000
+114.776144:-128.185923:-900.000000
+PORT
+Proportion:"30"
+FIN_BOX
+BOX
+toolsbbtk:SaveMHD-Button:Box20
+ISEXEC:FALSE
+49.474783:-54.794924:-900.000000
+95.049783:-64.794924:-900.000000
+FIN_BOX
+BOX
+creaMaracasVisu:ColorLayerImageView:Box21
+ISEXEC:FALSE
+-121.366653:10.167202:-900.000000
+-50.191653:0.167202:-900.000000
+PORT
+WinTitle:"Color"
+PORT
+lstBaseColor:"1 0 0 1 1 0 0 0 1"
+PORT
+lstGreyLevelBoundaries:"500 1500 2500 5000"
+FIN_BOX
+BOX
+vtk:vtkImageDataPointerRelay:Box23
+ISEXEC:FALSE
+-95.762984:51.256292:-900.000000
+-24.587984:41.256292:-900.000000
+FIN_BOX
+BOX
+wx:LayoutTab:Box24
+ISEXEC:FALSE
+-4.772832:-89.823842:-900.000000
+52.787168:-99.823842:-900.000000
+PORT
+WinWidth:"0"
+FIN_BOX
+BOX
+toolsbbtk:ImageVtkPropertiesWidget:Box25
+ISEXEC:FALSE
+-28.977992:-53.163115:-900.000000
+42.197008:-63.163115:-900.000000
+FIN_BOX
+BOX
+std:MagicBox:Box26
+ISEXEC:FALSE
+-14.647540:63.299675:-900.000000
+30.927460:53.299675:-900.000000
+FIN_BOX
+BOX
+std:MagicBox:Box27
+ISEXEC:FALSE
+44.893581:65.273236:-900.000000
+90.468581:55.273236:-900.000000
+FIN_BOX
+BOX
+std:MagicBox:Box28
+ISEXEC:FALSE
+99.534930:66.249067:-900.000000
+145.109930:56.249067:-900.000000
+FIN_BOX
+CONNECTIONS:28
+CONNECTION
+Box15:Widget:Box13:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box16:Widget:Box13:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box17:Widget:Box15:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box11:Widget:Box18:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box18:Widget:Box16:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box21:Widget:Box17:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box23:Out:Box21:In
+NumberOfControlPoints:0
+CONNECTION
+Box23:Out:Box20:In
+NumberOfControlPoints:0
+CONNECTION
+Box23:Out:Box11:In
+NumberOfControlPoints:0
+CONNECTION
+Box23:Out:Box09:In
+NumberOfControlPoints:0
+CONNECTION
+InputImage:InputImage:Box23:In
+NumberOfControlPoints:0
+CONNECTION
+Box13:Widget:Box24:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box23:Out:Box25:in
+NumberOfControlPoints:0
+CONNECTION
+wxVtkBaseView_01:wxVtkBaseView_01:Box26:In
+NumberOfControlPoints:0
+CONNECTION
+Box26:Out:Box21:WxVtkBaseView
+NumberOfControlPoints:0
+CONNECTION
+wxVtkBaseView_02:wxVtkBaseView_02:Box27:In
+NumberOfControlPoints:0
+CONNECTION
+wxVtkBaseView_03:wxVtkBaseView_03:Box28:In
+NumberOfControlPoints:0
+CONNECTION
+Box19:Widget:OutWidget:OutWidget
+NumberOfControlPoints:0
+CONNECTION
+Box26:Out:Box11:WxVtkBaseView1
+NumberOfControlPoints:0
+CONNECTION
+Box27:Out:Box21:WxVtkBaseView1
+NumberOfControlPoints:0
+CONNECTION
+Box27:Out:Box11:WxVtkBaseView2
+NumberOfControlPoints:0
+CONNECTION
+Box28:Out:Box21:WxVtkBaseView2
+NumberOfControlPoints:0
+CONNECTION
+Box28:Out:Box11:WxVtkBaseView3
+NumberOfControlPoints:0
+CONNECTION
+TitleModule:TitleModule:Box19:WinTitle
+NumberOfControlPoints:0
+CONNECTION
+Box20:Widget:Box24:Widget3
+NumberOfControlPoints:0
+CONNECTION
+Box25:widget:Box24:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box24:Widget:Box19:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box09:Widget:Box19:Widget1
+NumberOfControlPoints:0
+APP_END
diff --git a/bbtk/bbs/boxes/UnitLayerPaint.bbs b/bbtk/bbs/boxes/UnitLayerPaint.bbs
new file mode 100644 (file)
index 0000000..78fedf9
--- /dev/null
@@ -0,0 +1,98 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
+# - /home/davila/Creatis/All/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/UnitLayerPaint.bbs
+# ----------------------------------
+
+include std
+include itkvtk
+include creaMaracasVisu
+include wx
+include toolsbbtk
+include vtk
+include std
+
+define UnitLayerPaint creaMaracasVisu
+
+author "Author ??"
+description "Description ??"
+
+category "<VOID>"
+
+new ViewerNV Box09
+  set Box09.nTypeView "0"
+
+new ManualPaint Box11
+  set Box11.WinTitle "Paint"
+
+new LayoutLine Box13
+  set Box13.Orientation "H"
+
+new LayoutTab Box15
+
+new LayoutTab Box16
+
+new LayoutLine Box17
+  set Box17.WinTitle "Color"
+
+new LayoutLine Box18
+  set Box18.WinTitle "Paint"
+
+new LayoutSplit Box19
+  set Box19.Proportion "30"
+
+new SaveMHD-Button Box20
+
+new ColorLayerImageView Box21
+  set Box21.WinTitle "Color"
+  set Box21.lstBaseColor "1 0 0 1 1 0 0 0 1"
+  set Box21.lstGreyLevelBoundaries "500 1500 2500 5000"
+
+new vtkImageDataPointerRelay Box23
+
+new LayoutTab Box24
+  set Box24.WinWidth "0"
+
+new ImageVtkPropertiesWidget Box25
+
+new MagicBox Box26
+
+new MagicBox Box27
+
+new MagicBox Box28
+
+
+connect Box15.Widget Box13.Widget1
+connect Box16.Widget Box13.Widget2
+connect Box17.Widget Box15.Widget1
+connect Box11.Widget Box18.Widget1
+connect Box18.Widget Box16.Widget1
+connect Box21.Widget Box17.Widget1
+connect Box23.Out Box21.In
+connect Box23.Out Box20.In
+connect Box23.Out Box11.In
+connect Box23.Out Box09.In
+connect Box13.Widget Box24.Widget1
+connect Box23.Out Box25.in
+connect Box26.Out Box21.WxVtkBaseView
+connect Box26.Out Box11.WxVtkBaseView1
+connect Box27.Out Box21.WxVtkBaseView1
+connect Box27.Out Box11.WxVtkBaseView2
+connect Box28.Out Box21.WxVtkBaseView2
+connect Box28.Out Box11.WxVtkBaseView3
+connect Box20.Widget Box24.Widget3
+connect Box25.widget Box24.Widget2
+connect Box24.Widget Box19.Widget2
+connect Box09.Widget Box19.Widget1
+
+# Complex input ports
+input InputImage Box23.In " "
+input wxVtkBaseView_01 Box26.In " "
+input wxVtkBaseView_02 Box27.In " "
+input wxVtkBaseView_03 Box28.In " "
+input TitleModule Box19.WinTitle " "
+
+# Complex output ports
+output OutWidget Box19.Widget " "
+
+
+endefine
index 66a99f7d62aacfe63b4c930ea6eb5b2eef1fa491..95b040965b3044139c746f51ae8c25dd34b1967e 100644 (file)
@@ -41,6 +41,8 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ColorLayerImageView,bbtk::WxBlackBox);
 //=====
 void ColorLayerImageView::Process()
 {
+printf("ColorLayerImageView::Process start\n");
+
     ColorLayerImageViewPanel *clivp = (ColorLayerImageViewPanel*)bbGetOutputWidget();
 
     clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 0 , bbGetInputWxVtkBaseView() );
@@ -67,6 +69,8 @@ void ColorLayerImageView::Process()
 //    }
 //   ((wxStaticText*)bbGetOutputWidget())->SetLabel( bbtk::std2wx( msg ) );
 
+printf("ColorLayerImageView::Process end\n");
+
 }
 //=====
 // Don't edit this file. This file is generated from xml description..
index 0fb6ed4cb94993302cf867e06fd64266d7bc60bb..f29e5e103d08c2e36bad2b7aad9fb24542061e59 100644 (file)
@@ -52,6 +52,8 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint,bbtk::WxBlackBox);
 //=====
 void ManualPaint::Process()
 {
+printf("ManualPaint::Process start\n");
+
 
 /*
    std::string msg;
@@ -85,45 +87,63 @@ void ManualPaint::Process()
         mpModel->SetImage( bbGetInputIn() );
 
         wxManualPaintPanel        *mpPanel        = (wxManualPaintPanel*)bbGetOutputWidget();
+printf("ManualPaint::Process 1\n");
         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");
 
 }
 //=====
@@ -141,6 +161,10 @@ void ManualPaint::bbUserSetDefaultValues()
 {
     firsttime=true;
     bbSetInputIn(NULL);
+    bbSetInputWxVtkBaseView1(NULL);
+    bbSetInputWxVtkBaseView2(NULL);
+    bbSetInputWxVtkBaseView3(NULL);
+    bbSetInputWxVtkBaseView4(NULL);
 }
 //=====
 // Don't edit this file. This file is generated from xml description..
index 28c473df5cb0503b1ba702de14e34228a4e429d9..76851357f141e3fd083e013e14563e4af36666b2 100644 (file)
@@ -265,7 +265,13 @@ void ColorLayerImageView::ConfigLookupTable()  // virtual
 {
   // CM
   // Grey level extrema retrieved from the image grey level extrema.
-  GetImage()->GetScalarRange(_range);
+
+
+printf("ERROR: EED ColorLayerImageView::ConfigLookupTable   ------_range----------------\n");
+  _range[0]=0;
+  _range[1]=4000;
+//  GetImage()->GetScalarRange(_range);
+
 
 
   // ------------------ Setting Default Values
index f8c66939b65e5f5ee5423a0d4747430bc1616f68..a90e7348b627ad847a9c3895c11f0db14977ff9e 100644 (file)
@@ -41,8 +41,9 @@
 ColorLayerImageBasevtkInteractor::ColorLayerImageBasevtkInteractor(LayerImageBase* layerImageBase)
 {
     _state=false;
+    _stateKey=false;
     _layerImageBase=layerImageBase;
-
+       
 }
 
 //---------------------------------------------------------------------------------------------
@@ -50,15 +51,39 @@ ColorLayerImageBasevtkInteractor::~ColorLayerImageBasevtkInteractor()
 {
 }
 
+//---------------------------------------------------------------------------------------------
+bool ColorLayerImageBasevtkInteractor::OnChar() 
+{
+       return true;
+}
+
 
 //---------------------------------------------------------------------------------------------
 bool ColorLayerImageBasevtkInteractor::OnMouseMove()   // vitual
 {
-       printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove \n");
+       printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove start \n");
+
+       vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
+
+       // For example in ManualPaint Action
+        // This is not working, because the order of insertion events mecanism (_vtkInteractorStyleBaseView)
+        // Layer first Paint after.
+        // the only way to make it works is to take the axes an paint.  this force a first SetParent_refresh_waiting()
+//     if ( this->_vtkInteractorStyleBaseView->GetParent_refresh_waiting() == true )
+
+       if ( interactor->GetControlKey()==1 )  // EED This if for ManaulPaint Interaction compatibility
+        {
+               printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove need Refresh \n" );
+               _layerImageBase->onThreshold();
+                       _layerImageBase->GetvtkImageReslice()->Modified();
+       } 
+        else {
+       printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove NOT need Refresh \n" );
+       }       
+
        
        if (_state==true)
        {
-
                wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*) _vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
                wxVTKRenderWindowInteractor *wxVTKiren = wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor();
                int px, py;
@@ -79,7 +104,6 @@ bool ColorLayerImageBasevtkInteractor::OnMouseMove()   // vitual
                _layerImageBase->onThreshold();
 //             _layerImageBase->Refresh();
 
-
                this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
 
                if  (_vtkInteractorStyleBaseView->GetRefresh_waiting()==true)
@@ -91,7 +115,7 @@ bool ColorLayerImageBasevtkInteractor::OnMouseMove()   // vitual
        return true;
 }
 
-
+//---------------------------------------------------------------------------------------------
 bool  ColorLayerImageBasevtkInteractor::OnRightButtonDown() // virtual
 {
        printf("EED ColorLayerImageBasevtkInteractor::OnRightButtonDown \n");
@@ -99,6 +123,7 @@ bool  ColorLayerImageBasevtkInteractor::OnRightButtonDown() // virtual
        return true;
 }
 
+//---------------------------------------------------------------------------------------------
 bool  ColorLayerImageBasevtkInteractor::OnRightButtonUp()  // virtual
 {
        printf("EED ColorLayerImageBasevtkInteractor::OnRightButtonUp \n");
index 1781373de5a94f7360683f48c4ade828de891e75..d118348c03d6fe043dd4fa0025c517d4cda47305 100644 (file)
@@ -55,12 +55,14 @@ public:
        ColorLayerImageBasevtkInteractor(LayerImageBase* layerImageBase);
        virtual ~ColorLayerImageBasevtkInteractor();
 
-       virtual bool  OnMouseMove();
-       virtual bool  OnRightButtonDown();
-       virtual bool  OnRightButtonUp();
+       virtual bool OnChar(); 
+       virtual bool OnMouseMove();
+       virtual bool OnRightButtonDown();
+       virtual bool OnRightButtonUp();
 
 private:
     bool               _state;
+    bool               _stateKey;
     LayerImageBase*    _layerImageBase;
 
 protected:
index 8b53b3b0ea49b4edab875f17f0a6c48110fb470c..964e0e645b5554ca34141ed57293f63a4029a511 100644 (file)
@@ -112,6 +112,8 @@ void BrushFilter::Run() // virtual
 
                double xx, yy, zz, rr = size * size;
 
+printf("EED BrushFilter::Run() %d  %d\n", _RangeMin, _RangeMax);
+
                for (i = minX; i <= maxX; i++) {
                        xx = _px - i;
                        xx = xx * xx;
@@ -122,23 +124,23 @@ void BrushFilter::Run() // virtual
 //                    if ((i>=_minX) && (i<=_maxX) && (j>=_minY) && (j<=_maxY) && (k>=_minZ) && (k<=_maxZ))
 //                    {
 
-                                       float scalarComponent = _image->GetScalarComponentAsFloat(i,
-                                                       j, k, 0);
-                                       if ((this->GetRangeMin() <= scalarComponent)
-                                                       && (scalarComponent <= this->GetRangeMax())) {
-                                               zz = _pz - k;
-                                               zz = zz * zz;
-                                               if (_brushform == 0) {
+                                       float scalarComponent = _image->GetScalarComponentAsFloat(i,j, k, 0);
+                                       if ((_RangeMin <= scalarComponent)
+                                                       && (scalarComponent <= _RangeMax )) {
+                                               if (_brushform == 0) 
+                                               {
                                                        this->_IMManager->AddModifiedPixel(i, j, k); //DFCH
-                                                       _image->SetScalarComponentFromFloat(i, j, k, 0,
-                                                                       value);
-                                               } else if (_brushform == 1) {
+                                                       _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);
+                                                               _image->SetScalarComponentFromFloat(i, j, k, 0,value);
                                                        }
-                                               } // _brushform
+                                               } // _brushform 1
                                        } //   GetRangeMin && GetRangeMax
 
 //                    } //if _minX _maxX _minY _maxY _minZ _maxZ
@@ -180,11 +182,11 @@ void BrushFilter::SetRangeMax(int max) {
 
 //---------------------------------------------------------------------------
 int BrushFilter::GetRangeMin() {
-       return (_RangeMin);
+       return _RangeMin;
 }
 
 //---------------------------------------------------------------------------
 int BrushFilter::GetRangeMax() {
-       return (_RangeMax);
+       return _RangeMax;
 }
 
index 956fe6a560f62341e0803fc6d269654c0a656a87..ac69465260736205c291c5a5c9ad1b8fead13e72 100644 (file)
 #include "ManualPaintModel.h"
 
 ManualPaintModel::ManualPaintModel() {
-       _tool = 0; // 0 pencil         ,   1 fill
-       _brushfilter = new BrushFilter();
-       _fillfilter = new FillFilter();
-       _imageUndoRedo = new ImageUndoRedo();
+       _active         = true;
+       _tool           = 0; // 0 pencil         ,   1 fill
+       _brushfilter    = new BrushFilter();
+       _fillfilter     = new FillFilter();
+       _imageUndoRedo  = new ImageUndoRedo();
 }
 
 //---------------------------------------------------------------------------
-ManualPaintModel::~ManualPaintModel() {
+ManualPaintModel::~ManualPaintModel() 
+{
        delete _brushfilter;
        delete _fillfilter;
 }
 
+
+//---------------------------------------------------------------------------
+void ManualPaintModel::SetActive( bool active )
+{
+  _active = active;
+}
+
 //---------------------------------------------------------------------------
-void ManualPaintModel::PaintImage(int px, int py, int pz) {
-       if (_tool == 0) {
+void ManualPaintModel::PaintImage(int px, int py, int pz) 
+{
+printf("EED   ManualPaintModel::PaintImage\n");
+  if (_active==true)
+  {
+
+       if (_tool == 0) 
+       {
                _brushfilter->SetPoint(px, py, pz);
                _brushfilter->Run();
-       }
-       if (_tool == 1) {
+       } // _tool 2
+
+       if (_tool == 1) 
+       {
                _fillfilter->SetPoint(px, py, pz);
                _fillfilter->Run();
-       }
+       } // _tool 1
+  } // _active
 }
 
 //---------------------------------------------------------------------------
index 8379103ba63ae848c8bda8175f3d721ba86cae5e..8ec61e2491b010c91c0e9d6490d2e84f393d2ea1 100644 (file)
@@ -41,6 +41,7 @@ public:
        ManualPaintModel();
        virtual ~ManualPaintModel();
 
+       void SetActive(bool active);
        void SetTool(int tool);
        void Set2D3D(int dim2D3D);
        void SetImage(vtkImageData *image);
@@ -60,6 +61,7 @@ public:
 
 private:
        int _tool;
+       bool _active;
        BrushFilter *_brushfilter;
        FillFilter *_fillfilter;
        ImageUndoRedo *_imageUndoRedo;
index dc1cf3e4919d8ad048aae3465930b2d7acde0055..d2fb292cda25d957223633943a8a73321fd4c4a1 100644 (file)
@@ -144,6 +144,7 @@ void ManualPaintPanel::SetDistanceFill(int distancefill)
     }
 }
 
+//---------------------------------------------------------------------------
 void ManualPaintPanel::GetScalarRange( double * range )
 {
        if (_manualPaintModel!=NULL)
@@ -154,3 +155,14 @@ void ManualPaintPanel::GetScalarRange( double * range )
        }
 }
 
+//---------------------------------------------------------------------------
+void ManualPaintPanel::SetActive( bool active )
+{
+       if (_manualPaintModel!=NULL)
+       {
+           _manualPaintModel->SetActive( active );
+       } else {
+          printf("ERROR  in  ManualPaintPanel  _manualPaintModel not set.\n");
+       }
+}
+
index 0a1b8cc830de228b4e81a840e3e5da0c358df317..e756fd325320ca1276b003f749c5ac695dae9f5b 100644 (file)
@@ -33,6 +33,7 @@ public:
        ManualPaintPanel();
        virtual ~ManualPaintPanel();
 
+    void SetActive( bool active );
     void SetManualPaintModel(ManualPaintModel* manualPaintModel);
     void SetBrushSize( int brushsize );
     void SetGrayLevel( double graylevel );
index 5e67cd99b1b96235826fe983c0e526d902818911..122eccf2f9e551153215930e6f93b248b0e47f34 100644 (file)
@@ -41,9 +41,7 @@ vtkInteractorManualPaint::~vtkInteractorManualPaint() {
 
 //---------------------------------------------------------------------------
 bool vtkInteractorManualPaint::OnChar() {
-       vtkRenderWindowInteractor *interactor =
-                       _vtkInteractorStyleBaseView->GetInteractor();
-
+       vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
        if (interactor->GetKeyCode() == 97) {
                _stateKey = !_stateKey;
        }
@@ -71,7 +69,9 @@ bool vtkInteractorManualPaint::OnLeftButtonUp() {
 }
 
 //---------------------------------------------------------------------------
-bool vtkInteractorManualPaint::OnMouseMove() {
+bool vtkInteractorManualPaint::OnMouseMove() 
+{
+printf("EED vtkInteractorManualPaint::OnMouseMove \n");
        if ((_state == true) || (_stateKey == true)) {
                wxVtk2DBaseView *wxvtk2Dbaseview =
                                (wxVtk2DBaseView*) _vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
@@ -87,6 +87,7 @@ bool vtkInteractorManualPaint::OnMouseMove() {
 //        wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z,true, typeView);
                wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z, true);
 
+printf("EED vtkInteractorManualPaint::OnMouseMove A  %d %d %d\n", (int) X, (int) Y, (int) Z);
                _manualPaintControler->PaintImage((int) X, (int) Y, (int) Z);
                this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
 
index 2a0e6d3764ccd2d0f11fb7f4080eec64b059623e..4e8a54c403cac5fd3bbddc25d0b06d9b7708d9bc 100644 (file)
@@ -39,6 +39,7 @@ wxManualPaintPanel::wxManualPaintPanel( wxWindow * parent )
        //giving some blank spaces
        sizer->Add( new wxStaticText( this, -1, _T("             ") ) );
 
+       this->ConfigureActiveCBButton( );
        this->ConfigureBrushToolRadioButton( );
        this->Configure2D3DRadioButton( );
        this->ConfigureBrushFormRadioButton( );
@@ -52,7 +53,6 @@ wxManualPaintPanel::wxManualPaintPanel( wxWindow * parent )
        //Buttons
        wxStaticText *editButtonsText = new wxStaticText( this, -1,
                _T("Edit Buttons") );
-       sizer->Add( editButtonsText );
        this->_buttonsSizer = new wxFlexGridSizer( 4 );
        this->_buttonsSizer->Add( _btnUndo, 1, wxGROW );
        this->_buttonsSizer->Add( _btnRedo, 1, wxGROW );
@@ -116,6 +116,8 @@ wxManualPaintPanel::wxManualPaintPanel( wxWindow * parent )
                wxALIGN_BOTTOM | wxALIGN_LEFT | wxALL, 5 );
        this->_FillSizer->Add( sizerDistance );
 
+       sizer->Add( _activeCB );
+       sizer->Add( editButtonsText );
        sizer->Add( _buttonsSizer );
        sizer->Add( _gConfigSizer );
        sizer->Add( _brushSizer );
@@ -136,8 +138,16 @@ wxManualPaintPanel::~wxManualPaintPanel( )
 }
 
 //--------------------------------------------------------------------------
+void wxManualPaintPanel::ConfigureActiveCBButton( )
+{
+   _activeCB = new wxCheckBox (this, -1, _T("Active") );
+   _activeCB->SetValue(true);
+   SetActive( _activeCB->GetValue() );
+}
+
 
 //Panel Config
+//--------------------------------------------------------------------------
 void wxManualPaintPanel::ConfigureBrushToolRadioButton( )
 {
        wxString lstBrushForm[ 2 ];
@@ -147,6 +157,7 @@ void wxManualPaintPanel::ConfigureBrushToolRadioButton( )
                wxDefaultPosition, wxSize( 270, 45 ), 2, lstBrushForm, 2,
                wxRA_SPECIFY_COLS );
 }
+
 //--------------------------------------------------------------------------
 void wxManualPaintPanel::Configure2D3DRadioButton( )
 {
@@ -191,29 +202,33 @@ void wxManualPaintPanel::ConfigureRangeBar( )
        _mBarSlices->SetStart( min );
        _mBarSlices->SetEnd( max );
        _mBarSlices->Update( );
+
+       SetRangeMin( min );
+       SetRangeMax( max );
+
        //DFCH -- End BarSlices
 }
 //--------------------------------------------------------------------------
 void wxManualPaintPanel::ConfigureGrayLevelSld( )
 {
        _txtGrayLevel = new wxStaticText( this, -1,
-               wxString( _T("  Gray Level  ") ) );
+       wxString( _T("  Gray Level  ") ) );
        _sldGrayLevel = new wxSlider( this, -1, 0, 0, 255, wxDefaultPosition,
-               wxDefaultSize, wxSL_LABELS );
+       wxDefaultSize, wxSL_LABELS );
        _sldGrayLevel->SetMinSize( wxSize( 200, -1 ) );
        _sldGrayLevel->SetMaxSize( wxSize( 200, -1 ) );
        _graylevelCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
-               wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 0 );
+       wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 0 );
 }
 //--------------------------------------------------------------------------
 void wxManualPaintPanel::ConfigureBrushSizeSld( )
 {
        _txtBrushSize = new wxStaticText( this, -1,
-               wxString( _T("  Brush size  ") ) );
+       wxString( _T("  Brush size  ") ) );
        _sldBrushSize = new wxSlider( this, -1, 1, 1, 50, wxDefaultPosition,
-               wxDefaultSize, wxSL_LABELS );
+       wxDefaultSize, wxSL_LABELS );
        _BrushSizeCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
-               wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 0 );
+       wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 0 );
        _sldBrushSize->SetMinSize( wxSize( 200, -1 ) );
        _sldBrushSize->SetMaxSize( wxSize( 200, -1 ) );
 }
@@ -221,13 +236,13 @@ void wxManualPaintPanel::ConfigureBrushSizeSld( )
 void wxManualPaintPanel::ConfigureDistanceFillSld( )
 {
        _txtDistanceFill = new wxStaticText( this, -1,
-               wxString( _T("  Distance fill  ") ) );
+       wxString( _T("  Distance fill  ") ) );
        _sldDistanceFill = new wxSlider( this, -1, 50, 1, 500, wxDefaultPosition,
-               wxDefaultSize, wxSL_LABELS );
+       wxDefaultSize, wxSL_LABELS );
        _sldDistanceFill->SetMinSize( wxSize( 200, -1 ) );
        _sldDistanceFill->SetMaxSize( wxSize( 200, -1 ) );
        _distancefillCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
-               wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 500, 50 );
+       wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 500, 50 );
        _txtDistanceFill->Disable( );
        _sldDistanceFill->Disable( );
        _distancefillCtrl->Disable( );
@@ -264,17 +279,14 @@ void wxManualPaintPanel::ConfigureEditButtons( )
  */
 void wxManualPaintPanel::ConnectComponents( ) //DFCH
 {
-       this->Connect(
-               _sldBrushSize->GetId( ),
+       this->Connect(_sldBrushSize->GetId( ),
                wxEVT_SCROLL_THUMBRELEASE,
                (wxObjectEventFunction) (void(wxPanel::*)(
-                       wxScrollEvent& )) (&wxManualPaintPanel::OnBrushSize) );this ->Connect (_sldGrayLevel->GetId(),
-                               wxEVT_SCROLL_THUMBRELEASE,
-                               (wxObjectEventFunction) (void(wxPanel::*)(
-                                                               wxScrollEvent&)) &wxManualPaintPanel::OnSldGrayLevel);
-               this->Connect
-               (
-                               _graylevelCtrl->GetId(),
+               wxScrollEvent& )) (&wxManualPaintPanel::OnBrushSize) );this ->Connect (_sldGrayLevel->GetId(),
+               wxEVT_SCROLL_THUMBRELEASE,
+                (wxObjectEventFunction) (void(wxPanel::*)( wxScrollEvent&)) &wxManualPaintPanel::OnSldGrayLevel);
+
+               this->Connect(  _graylevelCtrl->GetId(),
                                wxEVT_COMMAND_TEXT_UPDATED,
                                (wxObjectEventFunction) (void(wxPanel::*)(
                                                                wxCommandEvent&)) &wxManualPaintPanel::OnCtrTxtGrayLevel);
@@ -363,9 +375,23 @@ void wxManualPaintPanel::ConnectComponents( ) //DFCH
                                wxEVT_COMMAND_TEXT_UPDATED,
                                (wxObjectEventFunction) (void(wxPanel::*)(
                                                                wxCommandEvent&)) &wxManualPaintPanel::OnCtrBrushSize);
+               this->Connect
+               (
+                       _activeCB->GetId(),
+                       wxEVT_COMMAND_CHECKBOX_CLICKED, 
+                       (wxObjectEventFunction) (void (wxPanel::*)(wxCommandEvent&))&wxManualPaintPanel::OnActive);
 
        }
 
+
+  //-------------------------------------------------------------------------
+  void wxManualPaintPanel::OnActive(wxCommandEvent& event)
+  {
+       printf("EED wxManualPaintPanel::OnActive \n");
+       SetActive( _activeCB->GetValue() );
+  }
+
+
 //---------------------------------------------------------------------------
 void wxManualPaintPanel::OnBrushSize( wxScrollEvent& event )
 {
index c50729a20f5edf3d87c640251b97e4179d8f48f3..e16fe001f30063ab6dc24b0162c8d67851399d8f 100644 (file)
@@ -41,6 +41,7 @@ public:
        wxManualPaintPanel( wxWindow * parent );
        virtual ~wxManualPaintPanel( );
        //Panel Config
+       void ConfigureActiveCBButton();
        void ConfigureBrushToolRadioButton( );
        void Configure2D3DRadioButton( );
        void ConfigureBrushFormRadioButton( );
@@ -52,6 +53,7 @@ public:
        void ConfigureEditButtons( );
        //Events
        void ConnectComponents( ); //DFCH
+       void OnActive(wxCommandEvent& event);
        void OnBrushSize( wxScrollEvent& event );
        void OnSldGrayLevel( wxScrollEvent& event );
        void OnCtrTxtGrayLevel( wxCommandEvent &event );
@@ -79,29 +81,30 @@ public:
        void onMovedBar( wxCommandEvent& event );
 
 private:
-       wxStaticText *_txtBrushSize;
-       wxSlider *_sldBrushSize;
-       wxSpinCtrl *_BrushSizeCtrl;
+       wxCheckBox      *_activeCB;
+       wxStaticText    *_txtBrushSize;
+       wxSlider        *_sldBrushSize;
+       wxSpinCtrl      *_BrushSizeCtrl;
 
-       wxStaticText *_txtGrayLevel;
-       wxSlider *_sldGrayLevel;
-       wxSpinCtrl *_graylevelCtrl;
-       wxRadioBox *_rbBrushForm;
-       wxRadioBox *_rb2D3D;
-       wxRadioBox *_rbBrushTool;
+       wxStaticText    *_txtGrayLevel;
+       wxSlider        *_sldGrayLevel;
+       wxSpinCtrl      *_graylevelCtrl;
+       wxRadioBox      *_rbBrushForm;
+       wxRadioBox      *_rb2D3D;
+       wxRadioBox      *_rbBrushTool;
 
-       wxStaticText *_txtToleranceFill;
-       wxSlider *_sldToleranceFill;
-       wxSpinCtrl *_tolerancefillCtrl;
+       wxStaticText    *_txtToleranceFill;
+       wxSlider        *_sldToleranceFill;
+       wxSpinCtrl      *_tolerancefillCtrl;
 
-       wxStaticText *_txtDistanceFill;
-       wxSlider *_sldDistanceFill;
-       wxSpinCtrl *_distancefillCtrl;
+       wxStaticText    *_txtDistanceFill;
+       wxSlider        *_sldDistanceFill;
+       wxSpinCtrl      *_distancefillCtrl;
 
-       mBarRange _mBarSlices; //DFCH
-       wxButton *_btnCopy; //DFCH
-       wxButton *_btnUndo; //DFCH
-       wxButton *_btnRedo; //DFCH
+       mBarRange       *_mBarSlices; //DFCH
+       wxButton        *_btnCopy; //DFCH
+       wxButton        *_btnUndo; //DFCH
+       wxButton        *_btnRedo; //DFCH
 
        wxFlexGridSizer *_buttonsSizer; //DFCH
        wxFlexGridSizer *_FillSizer; //DFCH
index a6991c40908ac330e9246135a1b43f39b03331a7..c250f045f0d26060d733ad79f1c17d397993d3cb 100644 (file)
@@ -139,7 +139,7 @@ void  vtkInteractorStyleBaseView::RemoveInteractorStyleMaracas(InteractorStyleMa
                        removed = true;
                } else {
                  iter++;
-               }
+               }               
        }               
 }
 //---------------------------------------------------------------------------
@@ -152,6 +152,8 @@ void vtkInteractorStyleBaseView::InsertInteractorStyleMaracas(int pos, Interacto
 void vtkInteractorStyleBaseView::CallLstInteractorStyleMaracas(int type)
 {
 
+
+printf("EED vtkInteractorStyleBaseView::CallLstInteractorStyleMaracas Start --------\n");
        InteractorStyleMaracas *intStyMar;
 
        int i,size=_lstInteractorStyleMaracas.size();
@@ -366,16 +368,18 @@ bool vtkInteractorStyleBaseView::GetParent_refresh_waiting()
 //---------------------------------------------------------------------------
 void vtkInteractorStyleBaseView::EvaluateToRefresh()
 {
-
+printf("EED vtkInteractorStyleBaseView::EvaluateToRefresh start 1\n");
        if  ( _blockRefresh==false )
        {
                if ( (_refresh_waiting==true) && (_parent_refresh_waiting==false))
                {
+printf("EED vtkInteractorStyleBaseView::EvaluateToRefresh start 2\n");
                        _refresh_waiting                = false;
                        this->_wxvtkbaseview->Refresh();
                }
                if (_parent_refresh_waiting==true)
                {
+printf("EED vtkInteractorStyleBaseView::EvaluateToRefresh start 3\n");
                        _parent_refresh_waiting = false;
                        wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121);  // Refresh
 //CPR 13/01/2010