]> Creatis software - creaMaracasVisu.git/commitdiff
#3335 creaMaracasVisu Feature New Normal - Manual Paint Model Undo Redo from box
authorEduardo DAVILA <davila@localhost.localdomain>
Wed, 8 Jan 2020 08:34:27 +0000 (09:34 +0100)
committerEduardo DAVILA <davila@localhost.localdomain>
Wed, 8 Jan 2020 08:34:27 +0000 (09:34 +0100)
26 files changed:
bbtk/bbs/boxes/ManualPaint2.bbg
bbtk/bbs/boxes/ManualPaint2.bbs
bbtk/src/bbcreaMaracasVisuManualPaint.cxx
bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx
bbtk/src/bbcreaMaracasVisuManualPaint_Model.h
bbtk/src/bbcreaMaracasVisuManualPaint_UndoRedo.cxx [new file with mode: 0644]
bbtk/src/bbcreaMaracasVisuManualPaint_UndoRedo.h [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageDequeUR.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageModificationManager.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageModificationManager.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.cpp
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/ManualPaintControler.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/ManualPaintControler.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.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/vtkInteractorManualPaint.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/wxManualPaintPanel.cpp

index 13b331d5431f51eb9e1e26f0d47238f5ddae888e..1f2c640ee61f88433a5ed2ef3519877d77927857 100644 (file)
@@ -54,7 +54,7 @@ Image2_ManualPaint_Model
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 BoxExecute_ManualPaint_Model
--167.528461:180.349965:-900.000000
+-201.995645:178.771315:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 wxvtkbaseview1
@@ -74,14 +74,14 @@ Tolerance_Fill_ManualPaint_Model
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 colorBarPosition
--192.926981:179.217332:-900.000000
+-180.034675:180.795982:-900.000000
 FIN_COMPLEX_PORT
-BOXES:24
+BOXES:31
 BOX
 creaMaracasVisu:ManualPaint_Model:Box00
 ISEXEC:FALSE
 -95.174180:-58.098371:-900.000000
--49.649180:-68.098371:-900.000000
+-34.534180:-68.098371:-900.000000
 PORT
 2D3D:"1"
 PORT
@@ -125,7 +125,7 @@ BOX
 creaMaracasVisu:ColorLayerImageView:Box03
 ISEXEC:FALSE
 64.897021:-66.295426:-900.000000
-112.822021:-76.295426:-900.000000
+134.777021:-76.295426:-900.000000
 PORT
 TypeControlsInterface:"2"
 PORT
@@ -160,8 +160,8 @@ FIN_BOX
 BOX
 wx:LayoutLine:Box09
 ISEXEC:FALSE
--96.465052:-132.072726:-900.000000
--59.890052:-142.072726:-900.000000
+-100.059182:-162.443123:-900.000000
+-42.499182:-172.443123:-900.000000
 FIN_BOX
 BOX
 std:GetVectorStringElement:Box11
@@ -214,8 +214,8 @@ FIN_BOX
 BOX
 wx:RadioButton:Box18
 ISEXEC:FALSE
--223.537738:36.072184:-900.000000
--130.692204:26.072184:-900.000000
+-242.357156:85.809216:-900.000000
+-178.637156:75.809216:-900.000000
 PORT
 In:"1"
 PORT
@@ -226,8 +226,8 @@ FIN_BOX
 BOX
 wx:LayoutLine:Box19
 ISEXEC:FALSE
--182.190843:-97.578092:-900.000000
--126.138628:-107.578092:-900.000000
+-137.264220:-139.449705:-900.000000
+-79.704220:-149.449705:-900.000000
 PORT
 Orientation:"H"
 FIN_BOX
@@ -262,8 +262,8 @@ FIN_BOX
 BOX
 std:MagicBox:Box24
 ISEXEC:FALSE
-70.058448:54.161651:-900.000000
-106.133448:44.161651:-900.000000
+66.284148:73.033149:-900.000000
+102.359148:63.033149:-900.000000
 FIN_BOX
 BOX
 std:MagicBox:Box25
@@ -293,7 +293,57 @@ ISEXEC:FALSE
 PORT
 Active:"true"
 FIN_BOX
-CONNECTIONS:69
+BOX
+wx:LayoutLine:Box29
+ISEXEC:FALSE
+-234.010495:-17.027092:-900.000000
+-176.450495:-27.027092:-900.000000
+FIN_BOX
+BOX
+wx:CommandButton:Box30
+ISEXEC:FALSE
+-220.568054:36.966713:-900.000000
+-177.793054:26.966713:-900.000000
+PORT
+Label:"Undo"
+FIN_BOX
+BOX
+wx:CommandButton:Box31
+ISEXEC:FALSE
+-211.322007:17.087471:-900.000000
+-168.547007:7.087471:-900.000000
+PORT
+Label:"Redo"
+FIN_BOX
+BOX
+creaMaracasVisu:ManualPaint_UndoRedo:Box32
+ISEXEC:FALSE
+-230.089322:-131.265167:-900.000000
+-180.614322:-141.265167:-900.000000
+PORT
+Type:"2"
+FIN_BOX
+BOX
+creaMaracasVisu:ManualPaint_UndoRedo:Box33
+ISEXEC:FALSE
+-295.989026:-131.212587:-900.000000
+-246.514026:-141.212587:-900.000000
+PORT
+Type:"1"
+FIN_BOX
+BOX
+vtk:UpdateRender:Box34
+ISEXEC:FALSE
+-245.364374:-89.573260:-900.000000
+-205.039374:-99.573260:-900.000000
+FIN_BOX
+BOX
+std:MagicBox:Box38
+ISEXEC:FALSE
+49.639480:114.047399:-900.000000
+85.714480:104.047399:-900.000000
+FIN_BOX
+CONNECTIONS:79
 CONNECTION
 Box01:Out:Box02:In
 NumberOfControlPoints:0
@@ -394,9 +444,6 @@ CONNECTION
 Box17:Out9:Box01:In9
 NumberOfControlPoints:0
 CONNECTION
-Box18:Widget:Box19:Widget1
-NumberOfControlPoints:0
-CONNECTION
 Box01:Widget:Box19:Widget2
 NumberOfControlPoints:0
 CONNECTION
@@ -427,9 +474,6 @@ CONNECTION
 MaxRange_ManualPaint_Model:MaxRange_ManualPaint_Model:Box04:In5
 NumberOfControlPoints:0
 CONNECTION
-Point_ManualPaint_Model:Point_ManualPaint_Model:Box00:Point
-NumberOfControlPoints:0
-CONNECTION
 Image_ManualPaint_Model:Image_ManualPaint_Model:Box00:Image
 NumberOfControlPoints:0
 CONNECTION
@@ -501,4 +545,40 @@ NumberOfControlPoints:0
 CONNECTION
 Box00:BoxChange:Box28:BoxExecute
 NumberOfControlPoints:0
+CONNECTION
+Box18:Widget:Box29:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box29:Widget:Box19:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box30:Widget:Box29:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box31:Widget:Box29:Widget3
+NumberOfControlPoints:0
+CONNECTION
+Box00:Manualpaintmodel:Box32:Manualpaintmodel
+NumberOfControlPoints:0
+CONNECTION
+Box31:BoxChange:Box32:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box30:BoxChange:Box33:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box00:Manualpaintmodel:Box33:Manualpaintmodel
+NumberOfControlPoints:0
+CONNECTION
+Point_ManualPaint_Model:Point_ManualPaint_Model:Box38:In
+NumberOfControlPoints:0
+CONNECTION
+Box38:Out:Box00:Point
+NumberOfControlPoints:0
+CONNECTION
+Box24:Out:Box33:wxvtkbaseview
+NumberOfControlPoints:0
+CONNECTION
+Box24:Out:Box32:wxvtkbaseview
+NumberOfControlPoints:0
 APP_END
index 1f931bcea850de4d19955981fa27eeeabff3571b..7ce9788380cdc6ccb8e27f6ebf5f54927c372d44 100644 (file)
@@ -101,6 +101,24 @@ new vtk:UpdateRender Box27
 new vtk:UpdateRender Box28
   set Box28.Active "true"
 
+new wx:LayoutLine Box29
+
+new wx:CommandButton Box30
+  set Box30.Label "Undo"
+
+new wx:CommandButton Box31
+  set Box31.Label "Redo"
+
+new creaMaracasVisu:ManualPaint_UndoRedo Box32
+  set Box32.Type "2"
+
+new creaMaracasVisu:ManualPaint_UndoRedo Box33
+  set Box33.Type "1"
+
+new vtk:UpdateRender Box34
+
+new std:MagicBox Box38
+
 
 connect Box01.Out Box02.In
 connect Box04.Out0 Box02.In0
@@ -135,7 +153,6 @@ connect Box17.Out6 Box01.In6
 connect Box17.Out7 Box01.In7
 connect Box17.Out8 Box01.In8
 connect Box17.Out9 Box01.In9
-connect Box18.Widget Box19.Widget1
 connect Box01.Widget Box19.Widget2
 connect Box19.Widget Box09.Widget1
 connect Box18.Out Box00.Tool
@@ -155,6 +172,17 @@ connect Box25.Out Box27.Renderer
 connect Box26.Out Box28.Renderer
 connect Box00.BoxChange Box27.BoxExecute
 connect Box00.BoxChange Box28.BoxExecute
+connect Box18.Widget Box29.Widget1
+connect Box29.Widget Box19.Widget1
+connect Box30.Widget Box29.Widget2
+connect Box31.Widget Box29.Widget3
+connect Box00.Manualpaintmodel Box32.Manualpaintmodel
+connect Box31.BoxChange Box32.BoxExecute
+connect Box30.BoxChange Box33.BoxExecute
+connect Box00.Manualpaintmodel Box33.Manualpaintmodel
+connect Box38.Out Box00.Point
+connect Box24.Out Box33.wxvtkbaseview
+connect Box24.Out Box32.wxvtkbaseview
 
 # Complex input ports
 input TitleOptions Box20.In " "
@@ -163,7 +191,6 @@ input SizeDistance_ManualPaint_Model Box04.In2 " "
 input GrayLevel_ManualPaint_Model Box04.In3 " "
 input MinRange_ManualPaint_Model Box04.In4 " "
 input MaxRange_ManualPaint_Model Box04.In5 " "
-input Point_ManualPaint_Model Box00.Point " "
 input Image_ManualPaint_Model Box00.Image " "
 input BoxExecute_ManualPaint_Model Box00.BoxExecute " "
 input Tolerance_Fill_ManualPaint_Model Box04.In6 " "
@@ -172,6 +199,7 @@ input Image2_ManualPaint_Model Box22.In " "
 input wxvtkbaseview1 Box24.In " "
 input wxvtkbaseview2 Box25.In " "
 input wxvtkbaseview3 Box26.In " "
+input Point_ManualPaint_Model Box38.In " "
 
 # Complex output ports
 output widgetOut Box09.Widget " "
index ea86236f47f39f6ad2f93c6f462e1199b298243b..e463b82b86cf00d719d17a80e3956fcef47483d2 100644 (file)
@@ -52,83 +52,31 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint,bbtk::WxBlackBox);
 //=====
 void ManualPaint::Process()
 {
-
-/*
-   std::string msg;
-    if (bbGetInputTitle()!="")
-      {
-       msg = bbGetInputTitle()+": " + bbGetInputIn();
-      }
-    else
-      {
-       msg = bbGetInputIn();
-      }
-   ((wxStaticText*)bbGetOutputWidget())->SetLabel( bbtk::std2wx( msg ) );
-  */
-
     if (bbGetInputWxVtkBaseView1()==NULL)
     {
       wxMessageDialog(NULL,  bbtk::std2wx("(ManualPaint) Input 'WxVtkBaseView' is not set"),  bbtk::std2wx(bbGetFullName()) ).ShowModal();
     }
-
     if (bbGetInputIn()==NULL)
     {
       wxMessageDialog(NULL,  bbtk::std2wx("(ManualPaint) Input 'vtkImageData' is not set"),  bbtk::std2wx(bbGetFullName()) ).ShowModal();
     }
-
-
     if (firsttime==true)
     {
         firsttime=false;
-
-        ManualPaintModel        *mpModel                       = new ManualPaintModel();
+        ManualPaintModel        *mpModel               = new ManualPaintModel();
+        ManualPaintControler    *mpControler    = new ManualPaintControler();
         mpModel->SetImages( bbGetInputIn() , bbGetInputIn2() );
-
+        mpControler->SetManualPaintModel(mpModel);
+        mpControler->SetWxVtk2DBaseView( 1, (wxVtk2DBaseView*)bbGetInputWxVtkBaseView1() );
+        mpControler->SetWxVtk2DBaseView( 2, (wxVtk2DBaseView*)bbGetInputWxVtkBaseView2() );
+        mpControler->SetWxVtk2DBaseView( 3, (wxVtk2DBaseView*)bbGetInputWxVtkBaseView3() );
+        mpControler->SetWxVtk2DBaseView( 4, (wxVtk2DBaseView*)bbGetInputWxVtkBaseView4() );
+               mpControler->Config();
         wxManualPaintPanel       *mpPanel                      = (wxManualPaintPanel*)bbGetOutputWidget();
-
-        if (bbGetInputWxVtkBaseView1()!=NULL)
-        {
-            ManualPaintControler    *mpControler    = new ManualPaintControler();
-            mpControler->SetManualPaintModel(mpModel);
-//            mpControler->SetManualPaintPanel(mpPanel);
-            mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView1() );
-            mpControler->Config();
-               mpPanel->SetManualPaintControler(mpControler);
-        }
-
-        if (bbGetInputWxVtkBaseView2()!=NULL)
-        {
-            ManualPaintControler    *mpControler    = new ManualPaintControler();
-            mpControler->SetManualPaintModel(mpModel);
-//            mpControler->SetManualPaintPanel(mpPanel);
-            mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView2() );
-            mpControler->Config();
-               mpPanel->SetManualPaintControler(mpControler);
-        }
-
-        if (bbGetInputWxVtkBaseView3()!=NULL)
-        {
-            ManualPaintControler    *mpControler    = new ManualPaintControler();
-            mpControler->SetManualPaintModel(mpModel);
-//            mpControler->SetManualPaintPanel(mpPanel);
-            mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView3() );
-            mpControler->Config();
-               mpPanel->SetManualPaintControler(mpControler);
-        }
-
-        if (bbGetInputWxVtkBaseView4()!=NULL)
-        {
-            ManualPaintControler    *mpControler    = new ManualPaintControler();
-            mpControler->SetManualPaintModel(mpModel);
-//            mpControler->SetManualPaintPanel(mpPanel);
-            mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView4() );
-            mpControler->Config();
-               mpPanel->SetManualPaintControler(mpControler);
-        }
-
+           mpPanel->SetManualPaintControler(mpControler);
     } // firsttime
-
 }
+
 //=====
 // Don't edit this file. This file is generated from xml description..
 //=====
@@ -142,7 +90,7 @@ void ManualPaint::CreateWidget(wxWindow* parent)
 //=====
 void ManualPaint::bbUserSetDefaultValues()
 {
-    firsttime=true;
+    firsttime = true;
     bbSetInputIn(NULL);
     bbSetInputWxVtkBaseView1(NULL);
     bbSetInputWxVtkBaseView2(NULL);
index 856a509587e02650d95d5e00199a78336d7c5807..5ff2df72310c391dd2a8ea588ca2ab52a9f8b676 100644 (file)
@@ -51,6 +51,7 @@ void ManualPaint_Model::Process()
                if (bbGetInputPoint().size()==3)
                {
                        manualpaintmodel->PaintImage( bbGetInputPoint()[0] , bbGetInputPoint()[1] , bbGetInputPoint()[2] );
+                       manualpaintmodel->SetUndoImage();
                } // if Points
                if ( bbGetInputByLstPointsX().size()!=0 )
                {
@@ -58,6 +59,7 @@ void ManualPaint_Model::Process()
                        for (i=0;i<size;i++)
                        {
                                manualpaintmodel->PaintImage( bbGetInputByLstPointsX()[i] , bbGetInputByLstPointsY()[i] , bbGetInputByLstPointsZ()[i] );
+//                     _manualPaintModel->SetUndoImage();     // Probably needed.   Here is ok.
                        } // for
                }// if ByLstPointsX
                if ((bbGetInputByImagePoints()!=NULL) && (bbGetInputImage2()!=NULL) )
@@ -95,6 +97,7 @@ void ManualPaint_Model::Process()
                                                        if (vI2==0)
                                                        {
                                                                manualpaintmodel->PaintImage(i,j,k);
+//                                                             manualpaintmodel->SetUndoImage();     // Probably needed.   Here is ok.
                                                        } // vI2                
                                                } // vBIP 
                                                pBIP = pBIP + sSBIP;                            
@@ -116,6 +119,7 @@ void ManualPaint_Model::Process()
        } else { 
                bbSetOutputOut( NULL );
        } 
+       bbSetOutputManualpaintmodel( manualpaintmodel );
 }
 //===== 
 // 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 ddeb4fa76a03db5067d48e0b1d55f5064d858c11..4e7e008abc6f60ebb1c636661320f62010843f97 100644 (file)
@@ -38,6 +38,7 @@ class bbcreaMaracasVisu_EXPORT ManualPaint_Model
   BBTK_DECLARE_INPUT(ByLstPointsZ,std::vector<int>);
   BBTK_DECLARE_INPUT(Range,std::vector<double>);
   BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
+  BBTK_DECLARE_OUTPUT(Manualpaintmodel,ManualPaintModel*);
   BBTK_PROCESS(Process);
   void Process();
 
@@ -73,6 +74,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ManualPaint_Model,bbtk::AtomicBlackBox);
   BBTK_INPUT(ManualPaint_Model,ByLstPointsZ,"Z Lst of points to run the Manual Paint",std::vector<int>,"");
   BBTK_INPUT(ManualPaint_Model,Range,"min-max range [0 200] default",std::vector<double>,"");
   BBTK_OUTPUT(ManualPaint_Model,Out,"Output image. Is the same pointer of input Image or Image2 with the modifications",vtkImageData*,"");
+  BBTK_OUTPUT(ManualPaint_Model,Manualpaintmodel,"ManualPaintModel",ManualPaintModel*,"");
 
 BBTK_END_DESCRIBE_BLACK_BOX(ManualPaint_Model);
 //===== 
diff --git a/bbtk/src/bbcreaMaracasVisuManualPaint_UndoRedo.cxx b/bbtk/src/bbcreaMaracasVisuManualPaint_UndoRedo.cxx
new file mode 100644 (file)
index 0000000..11c935b
--- /dev/null
@@ -0,0 +1,105 @@
+//===== 
+// 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)
+//===== 
+#include "bbcreaMaracasVisuManualPaint_UndoRedo.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+#include <wxMPRBaseData.h>
+
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualPaint_UndoRedo)
+BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint_UndoRedo,bbtk::AtomicBlackBox);
+//===== 
+// 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)
+//===== 
+void ManualPaint_UndoRedo::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+//   Here we simply set the input 'In' value to the output 'Out'
+//   And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+//    void bbSet{Input|Output}NAME(const TYPE&)
+//    const TYPE& bbGet{Input|Output}NAME() const 
+//    Where :
+//    * NAME is the name of the input/output
+//      (the one provided in the attribute 'name' of the tag 'input')
+//    * TYPE is the C++ type of the input/output
+//      (the one provided in the attribute 'type' of the tag 'input')
+//    bbSetOutputOut( bbGetInputIn() );
+//    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+  
+       if (bbGetInputManualpaintmodel()!=NULL)
+       {
+               if ( bbGetInputType()==1 )
+               {       
+                       bbGetInputManualpaintmodel()->Undo();
+               } // if Type 1
+               if ( bbGetInputType()==2 )
+               {       
+                       bbGetInputManualpaintmodel()->Redo();
+               } // if Type 2
+
+
+               if (bbGetInputwxvtkbaseview()!=NULL)
+               {
+
+                       vtkMPRBaseData* vtkmprbasedata = (vtkMPRBaseData*) (bbGetInputwxvtkbaseview()->GetVtkBaseData());
+                       vtkmprbasedata->SetX( bbGetInputManualpaintmodel()->GetRestorBaseInitialPointX() );
+                       vtkmprbasedata->SetY( bbGetInputManualpaintmodel()->GetRestorBaseInitialPointY() );
+                       vtkmprbasedata->SetZ( bbGetInputManualpaintmodel()->GetRestorBaseInitialPointZ() );
+                       wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121);  // Refresh
+                       //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+                       #if wxMAJOR_VERSION <= 2
+                                       bbGetInputwxvtkbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent( newevent );
+                       #else
+                                       bbGetInputwxvtkbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessWindowEvent( newevent );
+                       #endif                          
+               } // if bbGetInputwxvtkbaseview()
+
+
+       } // if bbGetInputManualpaintmodel()
+
+
+
+
+}
+//===== 
+// 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)
+//===== 
+void ManualPaint_UndoRedo::bbUserSetDefaultValues()
+{
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputType(1);
+   bbSetInputManualpaintmodel(NULL);
+   bbSetInputwxvtkbaseview(NULL);
+}
+
+//===== 
+// 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)
+//===== 
+void ManualPaint_UndoRedo::bbUserInitializeProcessing()
+{
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any 
+}
+
+//===== 
+// 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)
+//===== 
+void ManualPaint_UndoRedo::bbUserFinalizeProcessing()
+{
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any 
+}
+
+} // EO namespace bbcreaMaracasVisu
+
+
diff --git a/bbtk/src/bbcreaMaracasVisuManualPaint_UndoRedo.h b/bbtk/src/bbcreaMaracasVisuManualPaint_UndoRedo.h
new file mode 100644 (file)
index 0000000..90831b3
--- /dev/null
@@ -0,0 +1,55 @@
+//===== 
+// 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)
+//===== 
+#ifndef __bbcreaMaracasVisuManualPaint_UndoRedo_h_INCLUDED__
+#define __bbcreaMaracasVisuManualPaint_UndoRedo_h_INCLUDED__
+
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "wxVtkBaseView.h"
+#include <ManualPaintModel.h>
+
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT ManualPaint_UndoRedo
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(ManualPaint_UndoRedo,bbtk::AtomicBlackBox);
+//===== 
+// 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)
+//===== 
+  BBTK_DECLARE_INPUT(Manualpaintmodel,ManualPaintModel*);
+  BBTK_DECLARE_INPUT(Type,int);
+  BBTK_DECLARE_INPUT(wxvtkbaseview,wxVtkBaseView*);
+
+//  BBTK_DECLARE_OUTPUT(Out,double);
+  BBTK_PROCESS(Process);
+  void Process();
+//===== 
+// 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)
+//===== 
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(ManualPaint_UndoRedo,bbtk::AtomicBlackBox);
+  BBTK_NAME("ManualPaint_UndoRedo");
+  BBTK_AUTHOR("InfoDev");
+  BBTK_DESCRIPTION("No Description.");
+  BBTK_CATEGORY("empty");
+  BBTK_INPUT(ManualPaint_UndoRedo,Manualpaintmodel,"ManualPaintModel",ManualPaintModel*,"");
+  BBTK_INPUT(ManualPaint_UndoRedo,Type,"(Default 1) 1:Undo  2:Redo",int,"");
+  BBTK_INPUT(ManualPaint_UndoRedo,wxvtkbaseview,"wxVtkBaseView",wxVtkBaseView*,"");
+//  BBTK_OUTPUT(ManualPaint_UndoRedo,Out,"First output",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(ManualPaint_UndoRedo);
+//===== 
+// 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)
+//===== 
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuManualPaint_UndoRedo_h_INCLUDED__
+
index ab6b614c5388864116659ba291cf31e1e3f3c7d4..a9bc413c4316e51546da57dc58c730845cd2238a 100755 (executable)
 // ----------------------------------------------------------------------------------
 Image3DDequeUR::Image3DDequeUR( )
 {
+       const void * address = static_cast<const void*>(this);
+       std::stringstream ss;
+       ss << address;  
+       m_PrivateID = ss.str(); 
+
 #ifdef _WIN32
        this->m_GlobalPath = std::getenv("TEMP");
 #endif
@@ -69,6 +74,7 @@ void Image3DDequeUR::AddImagesToURContainer( VTKImageDataPointerType imgUndo,
        imageInfo->SetImageName( this->GetImageName( this->m_ImgURDeque.size( ) ) );
        imageInfo->SetImages( imgUndo, imgRedo );
        imageInfo->SetImageMManager( imMManager );
+       
        //Adding to deque
        this->m_ImgURDeque.push_back( imageInfo );
        this->m_CurrentURPos = this->m_ImgURDeque.size( ) - 1;
@@ -177,9 +183,9 @@ Image3DDequeUR::StringType Image3DDequeUR::GetImageName( const int & pos )
 //Giving a name to an image using the date and time
        if( this->m_IDImages.empty( ) )
        {
-               time_t rawtime;
-               struct tm timeinfo;
-               char buffer[ 80 ];
+               time_t          rawtime;
+               struct tm       *timeinfo;
+               char            buffer[ 80 ];
                time( &rawtime );
                timeinfo = localtime( &rawtime );
                strftime( buffer, 80, "%H%M%S_%a_%d_%b_%y_", timeinfo );
@@ -189,7 +195,7 @@ Image3DDequeUR::StringType Image3DDequeUR::GetImageName( const int & pos )
        }
        std::stringstream ss; //create a stringstream
        ss << pos; //add number to the stream
-       StringType imageName = this->m_IDImages + ss.str( );
+       StringType imageName = this->m_IDImages + ss.str( )+ "_"+m_PrivateID;
        return ( imageName );
 }
 
index b013172a2c38998a4b200496d35f1c2641aab311..416ce6b886e929aba3ea97821d3de98c4b4495cd 100755 (executable)
@@ -128,6 +128,7 @@ protected:
        int                     m_CurrentURPos; //!<This is the index where is located the undo and redo state.
        StringType              m_GlobalPath;   //!<This is the string with the global path.
        StringType              m_IDImages;     //!<This is the string with the ID of the images (For the filenames).
+       StringType              m_PrivateID;    //!<This is the string with the private ID of the images (For the filenames).
 };
 
 #endif /* IMAGE3DDEQUEUR_H_ */
index 121b37f01364c496eea46597210128ecf221b607..5af276acec2721c5c8bf371bb8a2ea73534f5e1e 100755 (executable)
 
 #include "imageInfoUR.h"
 
-//#include <iostream>
-//#include <string>
-//#include <vtkImageData.h>
-//#include <vtkSmartPointer.h>
-//#include "imageModificationManager.h"
-
 /*! @class ImageDequeUR imageDequeUR.h "imageDequeUR.cxx"
  *     @brief This class contains the management of the undo/redo - Abstract Class
  */
index ca2f43544bb6ae10259b9e2c5b7b339feadd33c7..109b1f2d228810244b685d34ac57ff202edca009 100755 (executable)
@@ -104,11 +104,10 @@ void ImageInfoUR::SetImages(VTKImageDataPointerType imgUndo, VTKImageDataPointer
 // ----------------------------------------------------------------------------------
 void ImageInfoUR::LoadImagesToMemory(const StringType& gPath) 
 {
-printf("EED ImageInfoUR::LoadImagesToMemory Start\n");
        //setting paths
-       StringType filename = gPath + this->m_ImageName;
-       StringType undoImagePath = filename + "_Undo.mhd";
-       StringType redoImagePath = filename + "_Redo.mhd";
+       StringType filename             = gPath + this->m_ImageName;
+       StringType undoImagePath        = filename + "_Undo.mhd";
+       StringType redoImagePath        = filename + "_Redo.mhd";
        //Loading Undo Image
        VTKMetaImageReaderPointerType readerUndo = VTKMetaImageReaderPointerType::New();
        readerUndo->SetFileName(undoImagePath.c_str());
@@ -145,9 +144,6 @@ printf("EED ImageInfoUR::LoadImagesToMemory Start\n");
 #endif
        //Updating status
        this->m_OnMemory = true;
-
-printf("EED ImageInfoUR::LoadImagesToMemory End\n");
-
 }
 
 // ----------------------------------------------------------------------------------
index aa8000325af703aaec71877e013990a49a054ed9..8002f5f15cfb1c9a2ebb0f13bcb5c6c318d07e58 100755 (executable)
@@ -181,13 +181,12 @@ public:
        bool GetStatus();
        // ----------------------------------------------------------------------------------
 private:
-       VTKImageDataPointerType m_UndoImage; //!<This is the undo image.
-       VTKImageDataPointerType m_RedoImage; //!<This is the redo image
-       StringType m_ImageName; //!<This is the base name of the images.
-       ImageMManagerType* m_ImageMManager; //!<This is the modification manager of the images.
-       bool m_OnMemory; //!<This is true if the images are in memory.
-       bool m_OnDisk; //!<This is true if the images are in disk.
-
+       VTKImageDataPointerType m_UndoImage;            //!<This is the undo image.
+       VTKImageDataPointerType m_RedoImage;            //!<This is the redo image
+       StringType                              m_ImageName;            //!<This is the base name of the images.
+       ImageMManagerType               *m_ImageMManager;       //!<This is the modification manager of the images.
+       bool                                    m_OnMemory;             //!<This is true if the images are in memory.
+       bool                                    m_OnDisk;                       //!<This is true if the images are in disk.
 };
 
 #endif /* IMAGEINFO_H_ */
index 32b0f6994eb62f7713c0cb494afa9cfb1338bfa5..d8a7dc01551136027bb897384b85b99cf9f7bca4 100644 (file)
 // ----------------------------------------------------------------------------------
 ImageMManager::ImageMManager() 
 {
+       baseInitialPointX=-9999;
+       baseInitialPointY=-9999;
+       baseInitialPointZ=-9999;
 }
+
 // ----------------------------------------------------------------------------------
 ImageMManager::ImageMManager(ImageMManager* manager) 
 {
-printf("EED ImageMManager::ImageMManager  Start\n");
-       this->m_RegionStruct = manager->GetModifiedRegion();
-       this->m_ValidRegion  = manager->ValidateRegion();
-
-if (manager->ValidateRegion()==true) printf("EED ImageMManager::ImageMManager  manager->ValidateRegion true \n");
-if (manager->ValidateRegion()==false) printf("EED ImageMManager::ImageMManager  manager->ValidateRegion false \n");
-printf("EED ImageMManager::ImageMManager  End\n");
+       this->m_RegionStruct    = manager->GetModifiedRegion();
+       this->m_ValidRegion     = manager->ValidateRegion();
+       this->baseInitialPointX = manager->GetBaseInitialPointX();
+       this->baseInitialPointY = manager->GetBaseInitialPointY();
+       this->baseInitialPointZ = manager->GetBaseInitialPointZ();
 }
 // ----------------------------------------------------------------------------------
 ImageMManager::~ImageMManager() 
@@ -90,7 +92,6 @@ void ImageMManager::CalculateMinMaxRegion(const int& i, const int& j, const int&
 // ----------------------------------------------------------------------------------
 void ImageMManager::AddModifiedPixel(const int& i, const int& j, const int& k) 
 {
-//printf("EED ImageMManager::AddModifiedPixel \n");
        this->CalculateMinMaxRegion(i, j, k);
 }
 // ----------------------------------------------------------------------------------
@@ -104,3 +105,26 @@ RegionStructUR ImageMManager::GetModifiedRegion()
        return (this->m_RegionStruct);
 }
 // ----------------------------------------------------------------------------------
+
+void ImageMManager::BaseInitialPoint(int x, int y, int z)
+{
+       baseInitialPointX = x;  
+       baseInitialPointY = y;  
+       baseInitialPointZ = z;  
+}
+
+int ImageMManager::GetBaseInitialPointX()
+{
+       return baseInitialPointX;
+}
+
+int ImageMManager::GetBaseInitialPointY()
+{
+       return baseInitialPointY;
+}
+
+int ImageMManager::GetBaseInitialPointZ()
+{
+       return baseInitialPointZ;
+}
+
index 24ae8f72931c82dd8a9d5318daa82febb84dc74f..d9796de75fa0ed6bc3248a2ae848f36905a46ed4 100644 (file)
@@ -85,6 +85,12 @@ public:
         */
        RegionStructUR GetModifiedRegion();
        // ----------------------------------------------------------------------------------
+
+       void BaseInitialPoint(int x, int y, int z);
+       int GetBaseInitialPointX();
+       int GetBaseInitialPointY();
+       int GetBaseInitialPointZ();
+       
 private:
        // ----------------------------------------------------------------------------------
        /*! @fn
@@ -93,8 +99,12 @@ private:
        void CalculateMinMaxRegion(const int& i, const int& j, const int& k);
        // ----------------------------------------------------------------------------------
 private:
-       RegionStructUR m_RegionStruct; //!< This is the Region structure.
-       bool m_ValidRegion; //!< This is true if the region is valid.
+       RegionStructUR  m_RegionStruct; //!< This is the Region structure.
+       bool                    m_ValidRegion; //!< This is true if the region is valid.
+       int                     baseInitialPointX;
+       int                     baseInitialPointY;
+       int                     baseInitialPointZ;
+       
 };
 
 #endif /* IMAGEMANAGEMENT_H_ */
index 0054735ef663557ac7b0a5d08e49407a7522486c..cba183cac36e253477109ac70bcdc0734dc50be8 100755 (executable)
 #include "imageUndoRedo.h"
 
 // ----------------------------------------------------------------------------------
-ImageUndoRedo::ImageUndoRedo( )
+ImageUndoRedo::ImageUndoRedo()
 {
        this->m_ImagesDeque = new IDequeType( );
 }
+
 // ----------------------------------------------------------------------------------
 //virtual
 ImageUndoRedo::~ImageUndoRedo( )
 {
-
 }
+
 // ----------------------------------------------------------------------------------
 //virtual
 void ImageUndoRedo::Undo( )
 {
-printf("EED ImageUndoRedo::Undo Start\n");
        ImageInfoUR* imageInfo = this->m_ImagesDeque->Undo( );
        if( imageInfo != NULL)
        {
                this->DrawUR( imageInfo, true );
                this->UpdateUndoImage( );
        } //if  imageInfo
-printf("EED ImageUndoRedo::Undo End\n");
-
 }
 // ----------------------------------------------------------------------------------
 //virtual
@@ -73,7 +71,6 @@ void ImageUndoRedo::Redo( )
 void ImageUndoRedo::SetImage( VTKImageDataPointerType image )
 {
        this->m_CurrentImage = image;
-
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
        this->m_CurrentImage->Update( );
@@ -123,12 +120,8 @@ void ImageUndoRedo::UpdateUndoImage( )
 // ----------------------------------------------------------------------------------
 ImageUndoRedo::VTKImageDataPointerType ImageUndoRedo::GetImageRegion( const RegionSType& region, VTKImageDataPointerType img )
 {
-printf("EED ImageUndoRedo::GetImageRegion Start\n");
        VTKExtractVOIPointerType extract = VTKExtractVOIPointerType::New( );
        extract->SetVOI( region.minX, region.maxX, region.minY, region.maxY,region.minZ, region.maxZ );
-
-printf("EED ImageUndoRedo::GetImageRegion region %d %d   %d %d   %d %d\n", region.minX, region.maxX, region.minY, region.maxY,region.minZ, region.maxZ );
-
        extract->SetSampleRate( 1, 1, 1 );
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
@@ -138,15 +131,12 @@ printf("EED ImageUndoRedo::GetImageRegion region %d %d   %d %d   %d %d\n", regio
        extract->Update();
 #endif
        VTKImageDataPointerType imgResult = extract->GetOutput( );
-
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
        imgResult->Update( );
 #else
        imgResult->Modified( );
 #endif
-
-printf("EED ImageUndoRedo::GetImageRegion End\n");
        return ( imgResult );
 }
 // ----------------------------------------------------------------------------------
@@ -158,7 +148,6 @@ void ImageUndoRedo::SetCurrentImage( VTKImageDataPointerType img )
 //virtual
 void ImageUndoRedo::DrawUR( ImageInfoUR* imageInfo, const bool& undo )
 {
-printf("EED ImageUndoRedo::DrawUR Start\n");
        VTKImageDataPointerType img;
        if( undo )
        {
@@ -166,14 +155,14 @@ printf("EED ImageUndoRedo::DrawUR Start\n");
        } else {
                img = imageInfo->GetRedoImage( );
        } //else
-       RegionSType region = imageInfo->GetImageMManager( )->GetModifiedRegion( );
+       RegionSType region                      = imageInfo->GetImageMManager()->GetModifiedRegion();
+       m_RestorBaseInitialPointX       = imageInfo->GetImageMManager()->GetBaseInitialPointX();
+       m_RestorBaseInitialPointY       = imageInfo->GetImageMManager()->GetBaseInitialPointY();
+       m_RestorBaseInitialPointZ       = imageInfo->GetImageMManager()->GetBaseInitialPointZ();
+
        if( img != NULL)
        {
-               int *dim                        = img->GetDimensions( );
-printf("EED ImageUndoRedo::DrawUR dim = %d %d %d\n", dim[0],dim[1],dim[2]);
-               int ext[6]; img->GetExtent( ext );
-printf("EED ImageUndoRedo::DrawUR ext = %d %d   %d %d    %d %d\n", ext[0],ext[1],ext[2],ext[3],ext[4],ext[5] );
-       
+               int *dim                        = img->GetDimensions( );        
                int sizeXImageIn        = dim[ 0 ];
                size_t linesize         = sizeXImageIn * sizeof(unsigned short);
                for( int j = region.minY, y = 0; j <= region.maxY; j++, y++ )
@@ -188,6 +177,21 @@ printf("EED ImageUndoRedo::DrawUR ext = %d %d   %d %d    %d %d\n", ext[0],ext[1]
                this->m_CurrentImage->Modified( );
        } // if img
        this->m_ImagesDeque->ManageMemory( );
-printf("EED ImageUndoRedo::DrawUR End\n");
 }
 // ----------------------------------------------------------------------------------
+
+int ImageUndoRedo::GetRestorBaseInitialPointX() 
+{
+       return  m_RestorBaseInitialPointX;
+}
+
+int ImageUndoRedo::GetRestorBaseInitialPointY() 
+{
+       return  m_RestorBaseInitialPointY;
+}
+
+int ImageUndoRedo::GetRestorBaseInitialPointZ() 
+{
+       return  m_RestorBaseInitialPointZ;
+}
+
index defc487efb09d80c711a191fd48caa12d3bde0ee..38414d7b01aaa88f3b2e29b6c8ed4c422fd5e385 100755 (executable)
@@ -96,8 +96,12 @@ public:
         VTKImageDataPointerType img);
         * @brief This method extract from an image the region of interest (In the undo/redo returns the volume of the modified or t-1 image).
         */
-       VTKImageDataPointerType GetImageRegion(const RegionSType& region,
-                       VTKImageDataPointerType img);
+       VTKImageDataPointerType GetImageRegion(const RegionSType& region,VTKImageDataPointerType img);
+
+       int GetRestorBaseInitialPointX();
+       int GetRestorBaseInitialPointY();
+       int GetRestorBaseInitialPointZ();
+
 protected:
        // ----------------------------------------------------------------------------------
        /*! @fn virtual void DrawUR(ImageInfoUR* imageInfo, const bool& undo);
@@ -105,12 +109,17 @@ protected:
         */
        virtual void DrawUR(ImageInfoUR* imageInfo, const bool& undo);
        // ----------------------------------------------------------------------------------
+
 protected:
 
        IDequeType                                      *m_ImagesDeque;         //!<The manager of the ImagesDeque.
        VTKImageDataPointerType         m_UndoImage;            //!< This is the image for undo t(m_CurrentImage - 1).
        VTKImageDataPointerType         m_CurrentImage;         //!< This is the current image (The modification image).
 
+       int                                             m_RestorBaseInitialPointX;
+       int                                             m_RestorBaseInitialPointY;
+       int                                             m_RestorBaseInitialPointZ;
+
 };
 
 #endif /* IMAGEUNDOREDO_H_ */
index b9f970c4703fc4b4de1c6a7d545a97e652a510b0..f7feac9fc4e6c81e533e115fcc8b1d605d148360 100644 (file)
@@ -87,6 +87,8 @@ void BrushFilter::Run() // virtual
 {
        if (_image != NULL)
        {
+               this->_IMManager->BaseInitialPoint(_px, _py ,_pz);
+
                float value = (float) _graylevel;
                int i, j, k;
 
index d584e3a5ed0e6983c9fc65aa90453830a1f84e01..0bf97b99bc0540d496687ac483454882364674d5 100644 (file)
@@ -34,9 +34,6 @@ FillFilter::FillFilter()
 {
        _tolerancefill          = 125;
        _distancefill           = 5;
-/*
-       _limitRecursionFill = 50000;
-*/
        _auxImageFill           = NULL;
        _maxXback                       = 0;
        _maxYback                       = 0;
@@ -49,7 +46,7 @@ FillFilter::~FillFilter()
        if (_auxImageFill != NULL)
        {
                _auxImageFill->Delete();
-       }
+       }//_auxImageFill
 }
 
 //---------------------------------------------------------------------------
@@ -92,22 +89,9 @@ void FillFilter::Run() // virtual
        if ((_px >= _minX) && (_px <= _maxX) && (_py >= _minY) && (_py <= _maxY)
                        && (_pz >= _minZ) && (_pz <= _maxZ)) 
        {
+               this->_IMManager->BaseInitialPoint(_px, _py ,_pz);
                _graylevelbasefill                      = _image->GetScalarComponentAsDouble(_px, _py, _pz,0);
                _distbasefill                           = _distancefill * _distancefill;
-/*
-               _pxfill                                         = _px;
-               _pyfill                                         = _py;
-               _pzfill                                         = _pz;
-               _countRecursiveFill             = 0;
-               _countRecursiveFillProblem      = 0;
-               _countProgressingFill           = 0;
-               DEF_POINTER_IMAGE_VTK_CREA_set(v_image,ss_image,p_image,st_image,_image)                
-               if (_image2!=NULL)
-               {
-                       DEF_POINTER_IMAGE_VTK_CREA_set(v_image2,ss_image2,p_image2,st_image2,_image2)           
-               } // if _image2
-*/
-//             _usingAuxImageFill                      = false;
                ivi                                             = _px + _py*(_maxX+1) + _pz*(_maxX+1)*(_maxY+1);  // index vector image
                FillToolLoop(_px, _py, _pz, ivi);
        } //if _minX _maxX _minY _maxY _minZ _maxZ
@@ -263,286 +247,23 @@ void FillFilter::FillToolLoop(int px, int py, int pz,long int iviA)
        } // while _lstX.size
 }
 
-
-/*
-
-
-//---------------------------------------------------------------------------
-void FillFilter::Run2() // virtual
-{
-
-       long int ivi;
-       if ((_px >= _minX) && (_px <= _maxX) && (_py >= _minY) && (_py <= _maxY)
-                       && (_pz >= _minZ) && (_pz <= _maxZ)) 
-       {
-               _graylevelbasefill                      = _image->GetScalarComponentAsDouble(_px, _py, _pz,0);
-               _pxfill                                         = _px;
-               _pyfill                                         = _py;
-               _pzfill                                         = _pz;
-               _distbasefill                           = _distancefill * _distancefill;
-               _countRecursiveFill             = 0;
-               _countRecursiveFillProblem      = 0;
-               _countProgressingFill           = 0;
-               _usingAuxImageFill                      = false;
-
-               ivi                                             = _px + _py*(_maxX+1) + _pz*(_maxX+1)*(_maxY+1);  // index vector image
-
-DEF_POINTER_IMAGE_VTK_CREA_set(v_image,ss_image,p_image,st_image,_image)               
-if (_image2!=NULL)
-{
-       DEF_POINTER_IMAGE_VTK_CREA_set(v_image2,ss_image2,p_image2,st_image2,_image2)           
-}
-
-//EED01
-//             FillToolRecursive(_px, _py, _pz);
-               FillToolRecursive(_px, _py, _pz, ivi);
-               unsigned char *pImage;
-               pImage                                          = (unsigned char *) _auxImageFill->GetScalarPointer();
-               int ii, jj, kk;
-               ivi                                                     = 0;
-
-               while (_countRecursiveFillProblem != 0) 
-               {
-                       _countRecursiveFillProblem  = 0;
-                       _usingAuxImageFill                      = true;
-                       for (kk = 0; kk <= _maxZ; kk++) 
-                       {
-                               for (jj = 0; jj <= _maxY; jj++) 
-                               {
-                                       for (ii = 0; ii <= _maxX; ii++) 
-                                       {
-                                               if (pImage[ivi] == 1) 
-                                               {
-//EED01
-//                                                     FillToolRecursive(ii, jj, kk);
-                                                       FillToolRecursive(ii, jj, kk, ivi);
-                                               }  // if
-                                               ivi++;
-                                       } // for ii
-                               } // for jj
-                       } //for kk
-//                     printf("-\n");
-               } // while
-       } //if _minX _maxX _minY _maxY _minZ _maxZ
-}
-
-
-
 //---------------------------------------------------------------------------
-void FillFilter::FillToolRecursive(int px, int py, int pz,long int ivi
+void FillFilter::SetToleranceFill(double tolerancefill
 {
-//ups ??EED   DEF_POINTER_IMAGE_VTK_CREA(v_image,ss_image,p_image,st_image,_image)             
-//ups ??EED   DEF_POINTER_IMAGE_VTK_CREA(v_image2,ss_image2,p_image2,st_image2,_image2)                
-
-       _countRecursiveFill++;
-       _countProgressingFill++;
-       if (_countProgressingFill > 200000) 
-       {
-               printf("R %ld \n", _countRecursiveFill);
-               _countProgressingFill = 0;
-       }
-
-       if ((px >= _minX) && (px <= _maxX) && (py >= _minY) && (py <= _maxY)
-                       && (pz >= _minZ) && (pz <= _maxZ)) 
-       {
-               if (_usingAuxImageFill == true) 
-               {
-//UPS ??EED                    this->_IMManager->AddModifiedPixel(px, py, pz); //DFCH
-//EED01
-//                     _auxImageFill->SetScalarComponentFromFloat(px, py, pz, 0, 0);
-                       _ptrAuxImageFill[ ivi ]=0;
-               }
-               difX=px-_pxfill;
-               difY=py-_pyfill;
-               difZ=pz-_pzfill;
-               _tmpDistfill = difX*difX + difY*difY + difZ*difZ;
-//             _tmpDistfill = (px-_pxfill)*(px-_pxfill)
-//                                     +  (py-_pyfill)*(py-_pyfill)
-//                                     +  (pz-_pzfill)*(pz-_pzfill);
-
-//if (_countRecursiveFill >1 )
-//{
-//     printf("   -> %d %d %d   cr=%ld  r=%f\n", px,py,pz,_countRecursiveFill , _tmpDistfill);
-//}
-
-//EED01 
-//             _tmpiglfill     = _image->GetScalarComponentAsDouble(px, py, pz, 0);
-GETVALUE2_VTK_CREA(_tmpiglfill,p_image,st_image,ivi)   
-
-               if (_image2!=NULL)
-               {
-//EED01
-//                     _tmpiglfill2    =       _image2->GetScalarComponentAsDouble(px, py, pz, 0);
-GETVALUE2_VTK_CREA(_tmpiglfill2,p_image2,st_image2,ivi)        
-               } else {
-                       _tmpiglfill2    =       _tmpiglfill;
-               }
-
-               float grayLBFMTOL       = _graylevelbasefill - _tolerancefill;
-               float grayLBFPTOL       = _graylevelbasefill + _tolerancefill;
-               bool isInRange          = false;
-               //DFCH
-               if (_RangeMin <= grayLBFMTOL && _RangeMax >= grayLBFPTOL) {
-                       isInRange               = true;
-               } //fi esle
-               else if (_RangeMin > grayLBFMTOL && _RangeMax >= grayLBFPTOL) {
-                       grayLBFMTOL     = _RangeMin;
-                       isInRange               = true;
-               } //fi esle
-               else if (_RangeMin <= grayLBFMTOL && _RangeMax < grayLBFPTOL) {
-                       grayLBFPTOL     = _RangeMax;
-                       isInRange               = true;
-               } //fi esle
-               else if ((_RangeMin <= _graylevelbasefill) && (_graylevelbasefill <= _RangeMax)) {
-                       grayLBFMTOL     = _RangeMin;
-                       grayLBFPTOL     = _RangeMax;
-                       isInRange               = true;
-               } //fi Range
-
-               if (isInRange) 
-               {
-                       _auxGrayLevelValidationFill = (_tmpiglfill != _graylevel)
-                                       && (_tmpiglfill2 != _graylevel)
-                                       && (_tmpiglfill >= grayLBFMTOL)
-                                       && (_tmpiglfill <= grayLBFPTOL)
-                                       && (_tmpDistfill <= _distbasefill); //DFCH
-               } else {
-                       _auxGrayLevelValidationFill = false;
-               } // if isInRange
-
-
-               if (_auxGrayLevelValidationFill == true) 
-               {
-//UPS ??EED                    this->_IMManager->AddModifiedPixel(px, py, pz); //DFCH
-                       if (_image2!=NULL)
-                       {
-//EED01
-//                             _image2->SetScalarComponentFromFloat(px, py, pz, 0,(float) _graylevel);
-SETVALUE2_VTK_CREA(_graylevel,p_image2,st_image2,ivi)
-                       } else {
-//EED01
-//                             _image->SetScalarComponentFromFloat(px, py, pz, 0,(float) _graylevel);
-SETVALUE2_VTK_CREA(_graylevel,p_image,st_image,ivi)
-                       }
-
-                       if (_countRecursiveFill < _limitRecursionFill) 
-                       {
-
-                               if (_2D3D == 0) //2D
-                               {
-                                       if (_direction == 0) // YZ
-                                       {
-                                               //FillToolRecursive(px+1,py,pz);
-                                               //FillToolRecursive(px-1,py,pz);
-                                               FillToolRecursive(px, py + 1, pz, ivi+_OneLine  );
-                                               FillToolRecursive(px, py - 1, pz, ivi-_OneLine  );
-                                               FillToolRecursive(px, py, pz - 1, ivi-_OnePlane );
-                                               FillToolRecursive(px, py, pz + 1, ivi+_OnePlane );
-                                       }
-                                       if (_direction == 1) // XZ
-                                                       {
-                                               FillToolRecursive(px + 1, py, pz, ivi+_OneColumn);
-                                               FillToolRecursive(px - 1, py, pz, ivi-_OneColumn);
-                                               //FillToolRecursive(px,py+1,pz);
-                                               //FillToolRecursive(px,py-1,pz);
-                                               FillToolRecursive(px, py, pz - 1, ivi-_OnePlane );
-                                               FillToolRecursive(px, py, pz + 1, ivi+_OnePlane );
-                                       }
-                                       if (_direction == 2) // XY
-                                                       {
-                                               FillToolRecursive(px + 1, py, pz, ivi+_OneColumn);
-                                               FillToolRecursive(px, py + 1, pz, ivi+_OneLine);
-                                               FillToolRecursive(px - 1, py, pz, ivi-_OneColumn);
-                                               FillToolRecursive(px, py - 1, pz, ivi-_OneLine);
-                                               //FillToolRecursive(px,py,pz-1);
-                                               //FillToolRecursive(px,py,pz+1);
-                                       }
-                               } else { // 3D
-                                       FillToolRecursive(px + 1, py, pz, ivi+_OneColumn );
-                                       FillToolRecursive(px - 1, py, pz, ivi-_OneColumn );
-                                       FillToolRecursive(px, py + 1, pz, ivi+_OneLine );
-                                       FillToolRecursive(px, py - 1, pz, ivi-_OneLine );
-                                       FillToolRecursive(px, py, pz - 1, ivi-_OnePlane );
-                                       FillToolRecursive(px, py, pz + 1, ivi+_OnePlane );
-                               } // 2D 3D
-
-                       } //_countRecursiveFill
-               } // _graylevel
-
-               if ((_auxGrayLevelValidationFill == true) && (_countRecursiveFill >= _limitRecursionFill)) 
-               {
-                       _countRecursiveFillProblem++;
-                       if (_2D3D == 0) //2D
-                       {
-                               if (_direction == 0) // YZ
-                               {
-                                       //SetAuxImageFill(px+1,py,pz);
-                                       //SetAuxImageFill(px-1,py,pz);
-                                       SetAuxImageFill(px, py + 1, pz,ivi+_OneLine);
-                                       SetAuxImageFill(px, py - 1, pz,ivi-_OneLine);
-                                       SetAuxImageFill(px, py, pz - 1,ivi-_OnePlane);
-                                       SetAuxImageFill(px, py, pz + 1,ivi+_OnePlane);
-                               }
-                               if (_direction == 1) // XZ
-                               {
-                                       SetAuxImageFill(px + 1, py, pz,ivi+_OneColumn);
-                                       SetAuxImageFill(px - 1, py, pz,ivi-_OneColumn);
-                                       //SetAuxImageFill(px,py+1,pz);
-                                       //SetAuxImageFill(px,py-1,pz);
-                                       SetAuxImageFill(px, py, pz - 1,ivi-_OnePlane);
-                                       SetAuxImageFill(px, py, pz + 1,ivi+_OnePlane);
-                               }
-                               if (_direction == 2) // XY
-                               {
-                                       SetAuxImageFill(px + 1, py, pz,ivi+_OneColumn);
-                                       SetAuxImageFill(px - 1, py, pz,ivi-_OneColumn);
-                                       SetAuxImageFill(px, py + 1, pz,ivi+_OneLine);
-                                       SetAuxImageFill(px, py - 1, pz,ivi-_OneLine);
-                                       //SetAuxImageFill(px,py,pz-1);
-                                       //SetAuxImageFill(px,py,pz+1);
-                               }
-                       } else { // 3D
-                               SetAuxImageFill(px + 1, py, pz,ivi+_OneColumn);
-                               SetAuxImageFill(px - 1, py, pz,ivi-_OneColumn);
-                               SetAuxImageFill(px, py + 1, pz,ivi+_OneLine);
-                               SetAuxImageFill(px, py - 1, pz,ivi-_OneLine);
-                               SetAuxImageFill(px, py, pz - 1,ivi-_OnePlane);
-                               SetAuxImageFill(px, py, pz + 1,ivi+_OnePlane);
-                       } // 2D 3D
-
-               } // _graylevel   //_limitRecursionFill
-
-       } //if _minX _maxX _minY _maxY _minZ _maxZ
-       _countRecursiveFill--;
+       _tolerancefill = tolerancefill;
 }
 
-
 //---------------------------------------------------------------------------
-void FillFilter::SetAuxImageFill(int px, int py, int pz, long int ivi
+void FillFilter::SetDistanceFill(int distancefill
 {
-       if ((px >= _minX) && (px <= _maxX) && (py >= _minY) && (py <= _maxY)
-                       && (pz >= _minZ) && (pz <= _maxZ)) 
-       {
-               this->_IMManager->AddModifiedPixel(px, py, pz); //DFCH
-//EED01
-//             _auxImageFill->SetScalarComponentFromFloat(px, py, pz, 0, 1);
-                       _ptrAuxImageFill[ ivi ]=1;
-       } // if px py pz
+       _distancefill = distancefill;
 }
-*/
-
 
 //---------------------------------------------------------------------------
-void FillFilter::SetToleranceFill(double tolerancefill
+vtkImageData* FillFilter::GetAuxImageFill(
 {
-       _tolerancefill = tolerancefill;
+       return _auxImageFill;
 }
 
-//---------------------------------------------------------------------------
-void FillFilter::SetDistanceFill(int distancefill) 
-{
-       _distancefill = distancefill;
-}
 
 
index 415e682a3bed4b8ce787875a05b399e63118c287..03ac7a3a7e6d0a193a1dca961bf03a748b10b6f4 100644 (file)
@@ -33,70 +33,38 @@ class FillFilter : public baseFilterManualPaint {
 public:
        FillFilter();
        virtual ~FillFilter();
-
     void                       Run();
        void                    FillToolLoop(int px, int py, int pz,long int iviA) ;
-
-/*
-    void                       Run2();
-    void                       FillToolRecursive(int px,int py, int pz, long int ivi);
-    void               SetAuxImageFill(int px,int py, int pz,long int ivi);
-*/
-
     void                       SetToleranceFill(double tolerancefill);
     void                       SetDistanceFill(int distancefill);
     virtual void       SetImages(vtkImageData *image,vtkImageData *image2);
-
+       vtkImageData*   GetAuxImageFill();
 private:
     double          _tolerancefill;
     int             _distancefill;
     double          _graylevelbasefill;
-
     double          _distbasefill;
     double          _tmpiglfill;
     double          _tmpiglfill2;
     vtkImageData    *_auxImageFill;
-
     bool            _auxGrayLevelValidationFill;
-
-
        int                     _maxXback;
        int                     _maxYback;
        int                     _maxZback;
-
-/*
-//EED01
-    int             _pxfill;
-    int             _pyfill;
-    int             _pzfill;
-    long int        _countRecursiveFill;
-    long int        _countRecursiveFillProblem;
-       unsigned char   *_ptrAuxImageFill;
-    long int        _countProgressingFill;
-    long int        _limitRecursionFill;
-    bool            _usingAuxImageFill;
-    double          _tmpDistfill;
-       int                     difX;
-       int                     difY;
-       int                     difZ;
-*/
-
-
 protected:
 
-
 //DEF_POINTER_IMAGE_VTK_CREA_definition( v_image , ss_image , p_image , st_image )             
-       double  v_image                 ;
-       int     ss_image                ;
-       char    *p_image                ;
-       int             st_image                ;
+       double                  v_image;
+       int                     ss_image;
+       char                    *p_image;
+       int                             st_image;
 
 //macro not working ???    
 //   DEF_POINTER_IMAGE_VTK_CREA_definition(v_image2,ss_image2,p_image2,st_image2)              
-       double  v_image2                ;
-       int     ss_image2               ;
-       char    *p_image2               ;
-       int             st_image2               ;
+       double                  v_image2;
+       int                     ss_image2;
+       char                    *p_image2;
+       int                             st_image2;
 
 };
 
index 4674d2d7d98a8abf257e16267ad5127c6506b64d..4e841bec6fdef474304c4eb38600004f0553f95a 100644 (file)
 ManualPaintControler::ManualPaintControler() 
 {
        auxZ                            = 0;
-       _wxvtk2Dbaseview        = NULL;
+//     _wxvtk2Dbaseview        = NULL;
+       _wxvtk2Dbaseview1       = NULL;
+       _wxvtk2Dbaseview2       = NULL;
+       _wxvtk2Dbaseview3       = NULL;
+       _wxvtk2Dbaseview4       = NULL;
 }
 
 //---------------------------------------------------------------------------
@@ -54,31 +58,43 @@ ManualPaintModel* ManualPaintControler::GetManualPaintModel( )
 }
 
 //---------------------------------------------------------------------------
-//void ManualPaintControler::SetManualPaintPanel( ManualPaintPanel* manualPaintPanel ) 
-//{
-//     _manualPaintPanel       = manualPaintPanel;
-//}
-
-//---------------------------------------------------------------------------
-void ManualPaintControler::SetWxVtk2DBaseView( wxVtk2DBaseView *wxvtk2Dbaseview )
+void ManualPaintControler::SetWxVtk2DBaseView( int id, wxVtk2DBaseView *wxvtk2Dbaseview )
 {
-       _wxvtk2Dbaseview        = wxvtk2Dbaseview;
+       if (id==1) { _wxvtk2Dbaseview1  = wxvtk2Dbaseview; }
+       if (id==2) { _wxvtk2Dbaseview2  = wxvtk2Dbaseview; }
+       if (id==3) { _wxvtk2Dbaseview3  = wxvtk2Dbaseview; }
+       if (id==4) { _wxvtk2Dbaseview4  = wxvtk2Dbaseview; }
 }
 
 //---------------------------------------------------------------------------
 void ManualPaintControler::Config() 
 {
-       if (_wxvtk2Dbaseview != NULL) 
+       if (_wxvtk2Dbaseview1 != NULL) 
+       {
+               vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*) (_wxvtk2Dbaseview1->GetInteractorStyleBaseView());
+               isbv->AddInteractorStyleMaracas(new vtkInteractorManualPaint(this));
+       } // if _wxvtk2Dbaseview
+       if (_wxvtk2Dbaseview2 != NULL) 
+       {
+               vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*) (_wxvtk2Dbaseview2->GetInteractorStyleBaseView());
+               isbv->AddInteractorStyleMaracas(new vtkInteractorManualPaint(this));
+       } // if _wxvtk2Dbaseview
+       if (_wxvtk2Dbaseview3 != NULL) 
+       {
+               vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*) (_wxvtk2Dbaseview3->GetInteractorStyleBaseView());
+               isbv->AddInteractorStyleMaracas(new vtkInteractorManualPaint(this));
+       } // if _wxvtk2Dbaseview
+       if (_wxvtk2Dbaseview4 != NULL) 
        {
-               vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*) (_wxvtk2Dbaseview->GetInteractorStyleBaseView());
+               vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*) (_wxvtk2Dbaseview4->GetInteractorStyleBaseView());
                isbv->AddInteractorStyleMaracas(new vtkInteractorManualPaint(this));
        } // if _wxvtk2Dbaseview
 }
 
 //---------------------------------------------------------------------------
-void ManualPaintControler::PaintImage(int px, int py, int pz) 
+void ManualPaintControler::PaintImage(int px, int py, int pz,int direction
 {
-       _manualPaintModel->SetDirection(_wxvtk2Dbaseview->GetDirection());
+       _manualPaintModel->SetDirection( direction );
        _manualPaintModel->PaintImage(px, py, pz);
        // The refresh mechanisme is made in the vtkInteractorManualPaint
        //    RefreshView();
@@ -90,40 +106,39 @@ void ManualPaintControler::SetImageUndo()
        _manualPaintModel->SetUndoImage();
 }
 
-
-
 //---------------------------------------------------------------------------
 void ManualPaintControler::Undo()
 {
        _manualPaintModel->Undo();
-       Refresh();
+       Refresh_UndoRedo();
 }
 
 void ManualPaintControler::Redo()
 {
        _manualPaintModel->Redo();
-       Refresh();
+       Refresh_UndoRedo();
 }
 
-
-void ManualPaintControler::Refresh()
+void ManualPaintControler::Refresh_UndoRedo()
 {
-       if (_wxvtk2Dbaseview!=NULL)
+       wxVtk2DBaseView *wxvtk2Dbaseview = NULL;
+       if (_wxvtk2Dbaseview1!=NULL){ wxvtk2Dbaseview=_wxvtk2Dbaseview1; }
+       if (_wxvtk2Dbaseview2!=NULL){ wxvtk2Dbaseview=_wxvtk2Dbaseview2; }
+       if (_wxvtk2Dbaseview3!=NULL){ wxvtk2Dbaseview=_wxvtk2Dbaseview3; }
+       if (_wxvtk2Dbaseview4!=NULL){ wxvtk2Dbaseview=_wxvtk2Dbaseview4; }
+       if (wxvtk2Dbaseview!=NULL)
        {
-               vtkMPRBaseData* vtkmprbasedata = (vtkMPRBaseData*) (_wxvtk2Dbaseview->GetVtkBaseData());
-//             if (bbGetInputPoint().size()==3)
-//             {
-//                     vtkmprbasedata->SetX( bbGetInputPoint()[0] );
-//                     vtkmprbasedata->SetY( bbGetInputPoint()[1] );
-//                     vtkmprbasedata->SetZ( bbGetInputPoint()[2] );
-                       wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121);  // Refresh
+               vtkMPRBaseData* vtkmprbasedata = (vtkMPRBaseData*) (wxvtk2Dbaseview->GetVtkBaseData());
+               vtkmprbasedata->SetX( _manualPaintModel->GetRestorBaseInitialPointX() );
+               vtkmprbasedata->SetY( _manualPaintModel->GetRestorBaseInitialPointY() );
+               vtkmprbasedata->SetZ( _manualPaintModel->GetRestorBaseInitialPointZ() );
+               wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121);  // Refresh
 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
 #if wxMAJOR_VERSION <= 2
-                       _wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessEvent( newevent );
+               wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessEvent( newevent );
 #else
-                       _wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessWindowEvent( newevent );
+               wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessWindowEvent( newevent );
 #endif                         
-//             } // if Position
        } // _wxvtk2Dbaseview
 }
 
index 9a9993b25f2d96ad82ac990abde8ce44e60034fc..e3c5c0f3648f6fd9bdc37dc7d741ed625c4c28dd 100644 (file)
@@ -38,20 +38,21 @@ public:
 
     void                               SetManualPaintModel(ManualPaintModel* manualPaintModel);
     ManualPaintModel*  GetManualPaintModel();
-//    void                             SetManualPaintPanel(ManualPaintPanel* manualPaintPanel);
-    void                               SetWxVtk2DBaseView(wxVtk2DBaseView *wxvtk2Dbaseview);
+    void                               SetWxVtk2DBaseView(int id, wxVtk2DBaseView *wxvtk2Dbaseview);
     void                               Config();
-    void                               PaintImage(int px,int py, int pz);
+    void                               PaintImage(int px,int py, int pz, int direction);
     void                               SetImageUndo();
     void                               Undo();
     void                               Redo();
-    void                               Refresh();
+    void                               Refresh_UndoRedo();
 
 private:
     int                 auxZ;
        ManualPaintModel        *_manualPaintModel;
-//     ManualPaintPanel        *_manualPaintPanel;
-       wxVtk2DBaseView     *_wxvtk2Dbaseview;
+       wxVtk2DBaseView     *_wxvtk2Dbaseview1;
+       wxVtk2DBaseView     *_wxvtk2Dbaseview2;
+       wxVtk2DBaseView     *_wxvtk2Dbaseview3;
+       wxVtk2DBaseView     *_wxvtk2Dbaseview4;
 
 protected:
 
index 8736b835eba01931628c52d2a247cefabcc6d888..e57d3eb61dc21c8314a8f12a483f1eec17d79238 100644 (file)
 
 ManualPaintModel::ManualPaintModel() 
 {
-       _active                 = true;
-       _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();
+       _imageUndoRedo_visited  = new ImageUndoRedo();
 }
 
 //---------------------------------------------------------------------------
@@ -75,8 +76,8 @@ void ManualPaintModel::SetTool(int tool)
 //---------------------------------------------------------------------------
 void ManualPaintModel::Set2D3D(int dim2D3D) 
 {
-       _brushfilter->Set2D3D(dim2D3D);
-       _fillfilter->Set2D3D(dim2D3D);
+       _brushfilter -> Set2D3D(dim2D3D);
+       _fillfilter  -> Set2D3D(dim2D3D);
 }
 
 //---------------------------------------------------------------------------
@@ -86,7 +87,13 @@ void ManualPaintModel::SetImages(vtkImageData *image,vtkImageData *image2)
        {
                _brushfilter -> SetImages(image,image2);
                _fillfilter  -> SetImages(image,image2);
-               _imageUndoRedo->SetImage(image);
+               if (image2!=NULL)
+               {
+                       _imageUndoRedo->SetImage(image2);
+               } else {
+                       _imageUndoRedo->SetImage(image);
+               }
+               _imageUndoRedo_visited->SetImage( _fillfilter->GetAuxImageFill() );
        } else {
                printf("EED Warning image=NULL in ManualPaintModel::SetImage(image)\n ");
        }
@@ -162,18 +169,38 @@ void ManualPaintModel::SetUndoImage()
        {
                imMManager = this->_fillfilter->GetImageMManager();
        } // if 1
-       this->_imageUndoRedo->SetURImages(imMManager);
-       this->_brushfilter->CleanImageMManager();
-       this->_fillfilter->CleanImageMManager();
+       this->_imageUndoRedo                    -> SetURImages(imMManager);
+       this->_imageUndoRedo_visited    -> SetURImages(imMManager);
+       this->_brushfilter                              -> CleanImageMManager();
+       this->_fillfilter                               -> CleanImageMManager();
 }
 //---------------------------------------------------------------------------
 
 void ManualPaintModel::Undo() 
 {
        this->_imageUndoRedo->Undo();
+       this->_imageUndoRedo_visited->Undo();
 }
 
 void ManualPaintModel::Redo() 
 {
        this->_imageUndoRedo->Redo();
+       this->_imageUndoRedo_visited->Redo();
 }
+
+
+int ManualPaintModel::GetRestorBaseInitialPointX() 
+{
+       return  this->_imageUndoRedo->GetRestorBaseInitialPointX();
+}
+
+int ManualPaintModel::GetRestorBaseInitialPointY() 
+{
+       return  this->_imageUndoRedo->GetRestorBaseInitialPointY();
+}
+
+int ManualPaintModel::GetRestorBaseInitialPointZ() 
+{
+       return  this->_imageUndoRedo->GetRestorBaseInitialPointZ();
+}
+
index eb6f10a483859626f2224f33585422e687204b0a..a99749abce977d42e0d357ededac2dad877b3b07 100644 (file)
 #include "BrushFilter.h"
 #include "FillFilter.h"
 
-//#include "regionStructUR.h"
-//#include "imageUndoRedo.h"
-
 #include "imageModificationManager.h"
 #include "imageUndoRedo.h"
 
-
 class ManualPaintModel {
 public:
        ManualPaintModel();
        virtual ~ManualPaintModel();
-
        void SetActive(bool active);
        void SetTool(int tool);
        void Set2D3D(int dim2D3D);
@@ -55,9 +50,13 @@ public:
        void SetRangeMin(int min);
        void SetRangeMax(int max);
        void GetScalarRange(double * range);
-       void SetUndoImage(); //DFCH
-       void Undo(); //DFCH
-       void Redo(); //DFCH
+       void SetUndoImage();    //DFCH
+       void Undo();                    //DFCH
+       void Redo();                    //DFCH
+
+       int GetRestorBaseInitialPointX();
+       int GetRestorBaseInitialPointY();
+       int GetRestorBaseInitialPointZ();
 
 private:
        int                     _tool;
@@ -65,9 +64,8 @@ private:
        BrushFilter     *_brushfilter;
        FillFilter              *_fillfilter;
        ImageUndoRedo   *_imageUndoRedo;
-
+       ImageUndoRedo   *_imageUndoRedo_visited;
 protected:
-
 };
 
 #endif // _MANUAL_PAINT_MODEL_H_
index f24066a9a84537871ad1a2add76bb5897749d22b..4bd2c34312d1923a0f72825395d6c5c4119db3a9 100644 (file)
@@ -38,7 +38,6 @@ class baseFilterManualPaint {
 public:
        baseFilterManualPaint();
        virtual ~baseFilterManualPaint();
-
        virtual void SetImages(vtkImageData *image,vtkImageData *image2);
        void SetPoint(int px, int py, int pz);
        void Set2D3D(int dim2D3D);
@@ -47,18 +46,14 @@ public:
        void ResetGeneralMinMax();
        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();
-
 private:
-
 protected:
        ImageMManager   *_IMManager; //Saves the last modified region (MinX, MaxX, MinY, MaxY, MinZ, MaxZ).
        vtkImageData    *_image;
@@ -86,8 +81,6 @@ protected:
        double                  _graylevel;
     int                        _RangeMin;
     int                        _RangeMax;
-
-
 };
 
 #endif // _BASE_FILTER_MANUAL_PAINT_H_
index e7b081d82743a4e28cd63407a13b54b4ab4f003a..609acfe51020464111eacd4572f98761f6fd3eb3 100644 (file)
@@ -44,7 +44,6 @@ vtkInteractorManualPaint::~vtkInteractorManualPaint()
 //---------------------------------------------------------------------------
 bool vtkInteractorManualPaint::OnChar() 
 {
-printf("EED vtkInteractorManualPaint::OnChar \n");
        vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
        if (interactor->GetKeyCode() == 97) 
        {
@@ -59,8 +58,8 @@ bool vtkInteractorManualPaint::OnLeftButtonDown()
        vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
        if (interactor->GetControlKey() == 1) {
                _state = true;
-//        wxVtk2DBaseView             *wxvtk2Dbaseview    = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
-//        _Z      =   wxvtk2Dbaseview->GetActualSlice();
+//      wxVtk2DBaseView             *wxvtk2Dbaseview    = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+//      _Z      =   wxvtk2Dbaseview->GetActualSlice();
        }
        return true;
 }
@@ -68,7 +67,6 @@ bool vtkInteractorManualPaint::OnLeftButtonDown()
 //---------------------------------------------------------------------------
 bool vtkInteractorManualPaint::OnLeftButtonUp() 
 {
-printf("EED vtkInteractorManualPaint::OnLeftButtonUp \n");
     if((_state == true) || (_stateKey == true))
        {
 //     _manualPaintControler->SetImageUndo();
@@ -90,11 +88,9 @@ bool vtkInteractorManualPaint::OnMouseMove()
                double Y = (double) py;
                double Z = wxvtk2Dbaseview->GetActualSlice();
                wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z, true);
-               _manualPaintControler->PaintImage((int) X, (int) Y, (int) Z);
+               _manualPaintControler->PaintImage((int) X, (int) Y, (int) Z,  wxvtk2Dbaseview->GetDirection() );
                this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-
        _manualPaintControler->SetImageUndo();
-
        } // if _state
        return true;
 }
index 0fb3c372c74a2956117d29e3ff6b4c6e4bd5c25d..9276f5975e0f4133c1677a5400ca07bc8c417220 100644 (file)
@@ -378,7 +378,6 @@ void wxManualPaintPanel::ConnectComponents( ) //DFCH
                        _activeCB->GetId(),
                        wxEVT_COMMAND_CHECKBOX_CLICKED, 
                        (wxObjectEventFunction) (void (wxPanel::*)(wxCommandEvent&))&wxManualPaintPanel::OnActive);
-
        }
 
 
@@ -402,7 +401,6 @@ void wxManualPaintPanel::OnBrushSize( wxScrollEvent& event )
 void wxManualPaintPanel::OnSldGrayLevel( wxScrollEvent& event )
 {
        SetGrayLevel( (double) ( _sldGrayLevel->GetValue( )) );
-
        wxString text;
        text.Printf( wxT("%d"), _sldGrayLevel->GetValue( ) );
        _graylevelCtrl->SetValue( text );
@@ -420,7 +418,6 @@ void wxManualPaintPanel::OnCtrTxtGrayLevel( wxCommandEvent &event )
 void wxManualPaintPanel::OnSldDistanceFill( wxScrollEvent& event )
 {
        SetDistanceFill( (double) ( _sldDistanceFill->GetValue( )) );
-
        wxString text;
        text.Printf( wxT("%d"), _sldDistanceFill->GetValue( ) );
        _distancefillCtrl->SetValue( text );
@@ -445,7 +442,6 @@ void wxManualPaintPanel::OnCtrBrushSize( wxCommandEvent &event )
 void wxManualPaintPanel::OnSldToleranceFill( wxScrollEvent& event )
 {
        SetToleranceFill( (double) ( _sldToleranceFill->GetValue( )) );
-
        wxString text;
        text.Printf( wxT("%d"), _sldToleranceFill->GetValue( ) );
        _tolerancefillCtrl->SetValue( text );
@@ -490,7 +486,6 @@ void wxManualPaintPanel::OnBrushForm( wxCommandEvent &event )
 //---------------------------------------------------------------------------
 void wxManualPaintPanel::OnTool( wxCommandEvent &event )
 {
-printf("EED wxManualPaintPanel::OnTool Start\n");
        DisableControls( );
        SetTool( _rbBrushTool->GetSelection( ) );
 
@@ -506,26 +501,15 @@ printf("EED wxManualPaintPanel::OnTool Start\n");
 
        if( _rbBrushTool->GetSelection( ) == 1 ) //Fill tool
        {
-printf("EED wxManualPaintPanel::OnTool 1\n");
                _txtToleranceFill->Enable( );
-printf("EED wxManualPaintPanel::OnTool 2\n");
                _sldToleranceFill->Enable( );
-printf("EED wxManualPaintPanel::OnTool 3\n");
                _tolerancefillCtrl->Enable( );
-
-printf("EED wxManualPaintPanel::OnTool 4\n");
                _txtDistanceFill->Enable( );
-printf("EED wxManualPaintPanel::OnTool 5\n");
                _sldDistanceFill->Enable( );
-printf("EED wxManualPaintPanel::OnTool 6\n");
                _distancefillCtrl->Enable( );
-printf("EED wxManualPaintPanel::OnTool 7\n");
                _FillSizer->Show( true );
-printf("EED wxManualPaintPanel::OnTool 8\n");
                _brushSizer->Show( false );
-printf("EED wxManualPaintPanel::OnTool 9\n");
                this->Layout( );
-printf("EED wxManualPaintPanel::OnTool 10\n");
        }
 }
 
@@ -552,11 +536,13 @@ void wxManualPaintPanel::OnRedo( wxCommandEvent &event )
 void wxManualPaintPanel::onBarrange( wxCommandEvent& event )
 {
 }
+
 void wxManualPaintPanel::onActualChange_Bar( wxCommandEvent& event )
 {
        /*mbbtkSliderMinMax->bbSetOutputOutActual(modBarRange->GetActual());
         mbbtkSliderMinMax->bbSignalOutputModification(std::string("OutActual"));*/
 }
+
 void wxManualPaintPanel::onStartChange_Bar( wxCommandEvent& event )
 {
        SetRangeMin( _mBarSlices->GetStart( ) );