]> Creatis software - creaMaracasVisu.git/commitdiff
#3512 Mesh application External Mask
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Mon, 19 Jun 2023 15:51:15 +0000 (17:51 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Mon, 19 Jun 2023 15:51:15 +0000 (17:51 +0200)
bbtk/bbs/boxes/Mesh_tool_ApplyExternalMask.bbg
bbtk/bbs/boxes/Mesh_tool_ApplyExternalMask.bbs
lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h

index 134ff6648c1bd51d0e0970e7a59f2df1f27e6588..9c3134d4b9d6b64f13fa25d58b9977666ce24a07 100644 (file)
@@ -336,18 +336,10 @@ ISEXEC:FALSE
 -333.693930:-87.639621:-900.000000
 FIN_BOX
 BOX
-wx:ButtonSelectFilesDirectory:Box52
-ISEXEC:FALSE
--424.946739:18.218955:-900.000000
--395.146739:15.718955:-900.000000
-PORT
-Label:"Read .mhd"
-FIN_BOX
-BOX
 vtk:MetaImageReader:Box53
 ISEXEC:FALSE
--439.937827:4.474274:-900.000000
--417.477827:1.974274:-900.000000
+-359.018805:-24.910953:-900.000000
+-336.558805:-27.410953:-900.000000
 FIN_BOX
 BOX
 creaMaracasVisu:ColorLayerImageView:Box54
@@ -359,6 +351,10 @@ ColorBarPosition:"-100 -100"
 PORT
 TypeControlsInterface:"2"
 PORT
+lstBaseColor:"0 0 0   1 1 0"
+PORT
+lstGreyLevelBoundaries:"0  128  256"
+PORT
 lstTransparenceBoundaries:"0"
 FIN_BOX
 BOX
@@ -492,8 +488,8 @@ FIN_BOX
 BOX
 std:ConcatStrings:Box102
 ISEXEC:FALSE
--296.237448:88.437715:-900.000000
--273.477448:85.937715:-900.000000
+-295.693747:83.725640:-900.000000
+-272.933747:81.225640:-900.000000
 PORT
 In1:"start /b  "
 FIN_BOX
@@ -580,8 +576,8 @@ FIN_BOX
 BOX
 std:MultipleInputs:Box117
 ISEXEC:FALSE
--373.321430:16.060843:-900.000000
--351.241430:13.560843:-900.000000
+-375.858701:14.248506:-900.000000
+-353.778701:11.748506:-900.000000
 FIN_BOX
 BOX
 std:ConcatStrings:Box120
@@ -597,7 +593,15 @@ ISEXEC:FALSE
 PORT
 Type:"1"
 FIN_BOX
-CONNECTIONS:113
+BOX
+std:ConcatStrings:Box122
+ISEXEC:FALSE
+-345.507935:-17.289218:-900.000000
+-322.747935:-19.789218:-900.000000
+PORT
+In2:"/contour-tmp2-Imge.mhd"
+FIN_BOX
+CONNECTIONS:114
 CONNECTION
 Box08:Widget:widget:widget
 NumberOfControlPoints:0
@@ -755,9 +759,6 @@ CONNECTION
 Box40:Widget:Box81:Widget4
 NumberOfControlPoints:0
 CONNECTION
-Box52:Out:Box53:In
-NumberOfControlPoints:0
-CONNECTION
 Box64:Out:Box54:WxVtkBaseView
 NumberOfControlPoints:0
 CONNECTION
@@ -767,9 +768,6 @@ CONNECTION
 Box69:Out:Box54:WxVtkBaseView2
 NumberOfControlPoints:0
 CONNECTION
-Box52:BoxChange:Box56:BoxExecute
-NumberOfControlPoints:0
-CONNECTION
 Box97:Out:Box60:In
 NumberOfControlPoints:0
 CONNECTION
@@ -821,9 +819,6 @@ CONNECTION
 Box88:Widget:Box49:Widget2
 NumberOfControlPoints:0
 CONNECTION
-Box52:Widget:Box50:Widget3
-NumberOfControlPoints:0
-CONNECTION
 Box91:Widget:Box50:Widget2
 NumberOfControlPoints:0
 CONNECTION
@@ -937,4 +932,16 @@ NumberOfControlPoints:0
 CONNECTION
 Box108:BoxChange:Box94:BoxExecute
 NumberOfControlPoints:0
+CONNECTION
+Box94:BoxChange:Box53:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box105:Out:Box122:In1
+NumberOfControlPoints:0
+CONNECTION
+Box122:Out:Box53:In
+NumberOfControlPoints:0
+CONNECTION
+Box94:BoxChange:Box56:BoxExecute
+NumberOfControlPoints:0
 APP_END
index fdb68b80d81d2f6d8f0d9d6ad463fa7a84cc40a0..3a2a253f88def31ca84797f14f409c5d68e2527a 100644 (file)
@@ -117,14 +117,13 @@ new wx:LayoutTab Box49
 
 new wx:LayoutLine Box50
 
-new wx:ButtonSelectFilesDirectory Box52
-  set Box52.Label "Read .mhd"
-
 new vtk:MetaImageReader Box53
 
 new creaMaracasVisu:ColorLayerImageView Box54
   set Box54.ColorBarPosition "-100 -100"
   set Box54.TypeControlsInterface "2"
+  set Box54.lstBaseColor "0 0 0   1 1 0"
+  set Box54.lstGreyLevelBoundaries "0  128  256"
   set Box54.lstTransparenceBoundaries "0"
 
 new vtk:BinaryOperations Box56
@@ -213,6 +212,9 @@ new std:ConcatStrings Box120
 new std:ConcatStrings_tool Box121
   set Box121.Type "1"
 
+new std:ConcatStrings Box122
+  set Box122.In2 "/contour-tmp2-Imge.mhd"
+
 
 connect Box66.Out Box11.Renderer
 connect Box35.Out Box68.In
@@ -257,11 +259,9 @@ connect Box39.Out Box93.Mesh
 connect Box43.Widget Box44.Widget2
 connect Box49.Widget Box81.Widget1
 connect Box40.Widget Box81.Widget4
-connect Box52.Out Box53.In
 connect Box64.Out Box54.WxVtkBaseView
 connect Box65.Out Box54.WxVtkBaseView1
 connect Box69.Out Box54.WxVtkBaseView2
-connect Box52.BoxChange Box56.BoxExecute
 connect Box97.Out Box60.In
 connect Box60.Out Box56.In2
 connect Box56.Out Box61.In
@@ -279,7 +279,6 @@ connect Box50.Widget Box88.Widget1
 connect Box89.Widget Box88.Widget2
 connect Box90.Widget Box88.Widget3
 connect Box88.Widget Box49.Widget2
-connect Box52.Widget Box50.Widget3
 connect Box91.Widget Box50.Widget2
 connect Box77.Widget Box82.Widget4
 connect Box42.Widget Box77.Widget2
@@ -315,6 +314,10 @@ connect Box116.BoxChange Box117.In5
 connect Box121.BoxChange Box117.In2
 connect Box108.BoxChange Box117.In6
 connect Box108.BoxChange Box94.BoxExecute
+connect Box94.BoxChange Box53.BoxExecute
+connect Box105.Out Box122.In1
+connect Box122.Out Box53.In
+connect Box94.BoxChange Box56.BoxExecute
 
 # Complex input ports
 input mesh Box67.In " "
index a7a08401f8967e042f0ffb4eeb3d18ba36f29b5c..698a1965dc9c246cc47fdbcaf3e08e8cea2e7d70 100644 (file)
        {
                // Widget interface
 //             askPointLabel                                       = new wxStaticText(panel, -1, _T("Label:")); // JPR
-               textCtrl                                                    = new wxTextCtrl(panel, -1, wxEmptyString   ,    wxDefaultPosition, sizeButton);
+               textCtrl                                                    = new wxTextCtrl(panel, -1, wxEmptyString   ,   wxDefaultPosition, sizeButton);
+               wxButton    *btnBackPoint                   = new wxButton( panel, -1, _T("<")          ,   wxDefaultPosition, sizeButton );
+               wxButton    *btnNextPoint                   = new wxButton( panel, -1, _T(">")          ,   wxDefaultPosition, sizeButton );
+        wxButton    *btnAddPoint            = new wxButton( panel, -1, _T("+")          ,   wxDefaultPosition, sizeButton );
+        wxButton    *btnInsertPoint         = new wxButton( panel, -1, _T("(+)")        ,   wxDefaultPosition, sizeButton );
                     cbAutoAddPoints         = new wxCheckBox(panel,-1, _T("Auto")       ,   wxDefaultPosition, sizeButton );
-               wxButton    *btnAddPoint                    = new wxButton( panel, -1, _T("+")          ,   wxDefaultPosition, sizeButton );
-               wxButton    *btnInsertPoint                 = new wxButton( panel, -1, _T("(+)")        ,   wxDefaultPosition, sizeButton );//CFT
-               wxButton    *btnSetPositionPoint    = new wxButton( panel, -1, _T("Set")        ,   wxDefaultPosition, sizeButton );
+        wxButton    *btnMovePointUp         = new wxButton( panel, -1, _T("<-")         ,   wxDefaultPosition, sizeButton );
+        wxButton    *btnMovePointDown       = new wxButton( panel, -1, _T("->")         ,   wxDefaultPosition, sizeButton );
+
+        wxButton    *btnSetPositionPoint    = new wxButton( panel, -1, _T("Set")        ,   wxDefaultPosition, sizeButton );
                      cbTrackPoint           = new wxCheckBox(panel,-1, _T("Tra.")       ,   wxDefaultPosition, sizeButton );
         wxButton    *btnRenamePoint                = new wxButton( panel, -1, _T("Ren.")       ,   wxDefaultPosition, sizeButton );
         wxButton    *btnErasePoint          = new wxButton( panel, -1, _T("-")          ,   wxDefaultPosition, sizeButton );
                wxButton    *btnSavePoints                  = NULL;
                wxButton    *btnLoadPoints                  = NULL;
                 
-        cbAutoAddPoints     -> SetToolTip( _T("Auto Add point")          );
-        btnAddPoint         -> SetToolTip( _T("+  Add point")          );
-        btnInsertPoint      -> SetToolTip( _T("(-)  Insert point")       );
-        btnErasePoint       -> SetToolTip( _T("-  Erase point")        );
-        btnEraseLastPoint   -> SetToolTip( _T("- lst  Erase last point")   );
-        btnDeleteAllPoints  -> SetToolTip( _T("-- Erase all points")   );
+
+        btnBackPoint         -> SetToolTip( _T("Select befor point")                        );
+        btnNextPoint         -> SetToolTip( _T("Select next point")                         );
+        cbAutoAddPoints     -> SetToolTip( _T("Auto Add point")                             );
+        btnAddPoint         -> SetToolTip( _T("+  Add point")                               );
+        btnInsertPoint      -> SetToolTip( _T("(-)  Insert point")                          );
+        btnMovePointUp      -> SetToolTip( _T("Move point Up in the normal direction")      );
+        btnMovePointDown    -> SetToolTip( _T("Move point Down in the normal direction")    );
+
+        btnErasePoint       -> SetToolTip( _T("-  Erase point")                             );
+        btnEraseLastPoint   -> SetToolTip( _T("- lst  Erase last point")                    );
+        btnDeleteAllPoints  -> SetToolTip( _T("-- Erase all points")                        );
         
                if ( mtype==0 )
                {
             Connect(sdrRadio->GetId()            , wxEVT_COMMAND_SLIDER_UPDATED    , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
         } // if mtype 0 3
         Connect(cbAutoAddPoints->GetId()    , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WidgetShowNPoints::OnAutoAddPoints);
+        Connect(btnBackPoint->GetId()       , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnBackPoint);
+        Connect(btnNextPoint->GetId()       , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnNextPoint);
                Connect(btnAddPoint->GetId()            , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnAddPoint);
                Connect(btnInsertPoint->GetId()         , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnInsertPoint);//CFT
                Connect(btnSetPositionPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint);
         Connect(btnRedo->GetId()            , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnRedo);
         wxFlexGridSizer *sizer0 = new wxFlexGridSizer(1);
         wxFlexGridSizer *sizer1 = new wxFlexGridSizer(2);
-        wxFlexGridSizer *sizer2 = new wxFlexGridSizer(2);
+        wxFlexGridSizer *sizer2 = new wxFlexGridSizer(3);
         wxFlexGridSizer *sizer3 = new wxFlexGridSizer(2);
-        wxFlexGridSizer *sizer4 = new wxFlexGridSizer(2);
+        wxFlexGridSizer *sizer4 = new wxFlexGridSizer(3);
         wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
+        wxFlexGridSizer *sizer6 = new wxFlexGridSizer(2);
+        wxFlexGridSizer *sizer7 = new wxFlexGridSizer(2);
         sizer1->Add( textCtrl               );
         sizer1->Add( btnRenamePoint         );
-        sizer2->Add( cbAutoAddPoints        );
-        sizer2->Add( new wxStaticText(panel, -1, _T(" "))            );
+  //      sizer2->Add( cbAutoAddPoints        );
+  //      sizer2->Add( new wxStaticText(panel, -1, _T(" "))            );
         sizer2->Add( btnAddPoint            );
         sizer2->Add( btnInsertPoint         );//CFT
+        sizer2->Add( cbAutoAddPoints        );
         sizer3->Add( btnSetPositionPoint    );
         sizer3->Add( cbTrackPoint           );
         sizer4->Add( btnErasePoint          );
         sizer4->Add( btnDeleteAllPoints     );
         sizer5->Add( btnUndo                );
         sizer5->Add( btnRedo                );
-//             sizer0->Add(askPointLabel); // JPR
+        sizer6->Add( btnBackPoint           );
+        sizer6->Add( btnNextPoint           );
+        sizer7->Add( btnMovePointUp        );
+        sizer7->Add( btnMovePointDown      );
+
+        //             sizer0->Add(askPointLabel); // JPR
         sizer0->Add(txtNrPoints);
+        sizer0->Add(sizer6);
         sizer0->Add(sizer2);
-        sizer0->Add(sizer1);
+        sizer0->Add(sizer7);
                sizer0->Add(sizer3);
         sizer0->Add(sizer4);
+        sizer0->Add(sizer1);
         sizer0->Add(sizer5);
         if ( (mtype==0) || (mtype==3) )
         {
@@ -516,6 +539,27 @@ void WidgetShowNPoints::AddVtkPoint()
  */
 
 
+void WidgetShowNPoints::SetCurrentPoint(int idCurrentPoint )
+{
+    int size = GetModelShowNPoints()->GetLstPointsSize();
+    if (idCurrentPoint<0)       { idCurrentPoint = size-1;  }
+    if (idCurrentPoint>=size )  { idCurrentPoint = 0;       }
+    GetModelShowNPoints()->SetIdCurrentPoint( idCurrentPoint );
+    RefreshCollectionText();
+    RefreshColourCollection();
+}
+
+void WidgetShowNPoints::OnBackPoint(wxCommandEvent &event)
+{
+    SetCurrentPoint(  GetModelShowNPoints()->GetIdCurrentPoint() + 1 );
+}
+
+void WidgetShowNPoints::OnNextPoint(wxCommandEvent &event)
+{
+    SetCurrentPoint(  GetModelShowNPoints()->GetIdCurrentPoint() - 1 );
+}
+
+
 //------------------------------------------------------------------------
 void WidgetShowNPoints::AddPoint(double x, double y, double z, std::string label)
 {
@@ -1253,6 +1297,11 @@ void WidgetShowNPoints::CreatePointsIntoNewCollection()
             i=50;  x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
             i=75;  x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
             i=sc-1;x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
+            
+            RefreshCollectionText();
+            RefreshColourCollection();
+
+            
         } // if size of c1LstX c2LstX
     }  // if c1 && c2
 
@@ -1330,7 +1379,8 @@ void WidgetShowNPoints::OnBackCollection(wxCommandEvent &event)
     mActualCollection--;
     if ( mActualCollection <0  )
     {
-        mActualCollection=0;
+//        mActualCollection=0;
+         mActualCollection = lstModelShowNPoints.size()-1;
     } //if <=0
     RefreshCollectionText();
     RefreshColourCollection();
@@ -1344,8 +1394,9 @@ void WidgetShowNPoints::OnNextCollection(wxCommandEvent &event)
     mActualCollection++;
     if ( mActualCollection >=lstModelShowNPoints.size() )
     {
-        mActualCollection = lstModelShowNPoints.size()-1;
-    } //if <=0
+//        mActualCollection = lstModelShowNPoints.size()-1;
+         mActualCollection = 0;
+    } //if mActualCollection >= size
     RefreshCollectionText();
     RefreshColourCollection();
     StopTrackPoint();
index 193f287ea1700bad888ce65dc36283394e975333..fed8ea63199fdca3890255c0fa5750da91e2be47 100644 (file)
@@ -17,14 +17,17 @@ class WidgetShowNPoints : public wxPanel
   public:
          WidgetShowNPoints( wxWindow *parent , int type );
          ~WidgetShowNPoints();
+      void SetCurrentPoint(int idCurrentPoint );
+      void OnBackPoint(wxCommandEvent &event);
+      void OnNextPoint(wxCommandEvent &event);
       void StopAutoAddPoints();
       void AutoAddPoints();
       void OnAutoAddPoints_tool();
       void OnAutoAddPoints_();
       void OnAutoAddPoints(wxCommandEvent& event);
-         void OnAddPoint(wxCommandEvent &event);
       void OnAddPoint_();
       void OnAddPoint__();
+      void OnAddPoint(wxCommandEvent &event);
          void OnInsertPoint(wxCommandEvent& event);//CFT
       void OnSetPoint_();
          void OnSetPoint(wxCommandEvent& event);