]> Creatis software - creaContours.git/commitdiff
#3321 creaContours Feature New Normal - Connection with bbtk
authorEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Wed, 4 Dec 2019 16:23:10 +0000 (17:23 +0100)
committerEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Wed, 4 Dec 2019 16:23:10 +0000 (17:23 +0100)
bbtk/src/bbCreaContournDimensions.cxx
bbtk/src/bbCreaContournDimensions.h
bbtk/src/bbcreaContoursSetViewerPosition.cxx [new file with mode: 0644]
bbtk/src/bbcreaContoursSetViewerPosition.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h
lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx
lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h

index d0a4504dc68bcdef88777ba708a2e3712a68bd18..251d4ff5d12186ed4bcfe4e58ac9612358d96712 100644 (file)
@@ -34,7 +34,6 @@ BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaContours,nDimensions)
 BBTK_BLACK_BOX_IMPLEMENTATION(nDimensions,bbtk::WxBlackBox);
 void nDimensions::Process()
 {
-printf("EED nDimensions::Process Start \n" );
        double **vectx = 0, **vecty = 0, **vectz = 0;
 
        std::vector< void * > vectortemp;
@@ -49,34 +48,26 @@ printf("EED nDimensions::Process Start \n" );
                wxContourMainFrame::getInstance()->ShowToolsPanel(true);
                currentimg=img;
                selectedimages.push_back(img);
-printf("EED nDimensions::Process 1 \n" );
                wxContourMainFrame::getInstance()->setVectImages(selectedimages);
-printf("EED nDimensions::Process 2 \n" );
-       }
+       } // if img
 
        if(currentimg != NULL)
    {
                int contourtype = bbGetInputContourType();
                //wxContourMainFrame::getInstance()->getValuesXYZ(vectx, vecty, vectz, &size);
                //wxContourMainFrame::getInstance()->getMaskValue(mask, value, contourtype);
-       }
+       } // if currentimg
 
     wxContourMainFrame::getInstance()->RefreshInterface();
 
 
-printf("EED nDimensions::Process 3.1 \n" );
+    bbSetOutputwxContourMainFrame( wxContourMainFrame::getInstance() );
 //     bbSetOutputX(vectx);
-printf("EED nDimensions::Process 3.2 \n" );
 //     bbSetOutputY(vecty);
-printf("EED nDimensions::Process 3.3 \n" );
 //     bbSetOutputZ(vectz);
-printf("EED nDimensions::Process 3.4 \n" );
 //     bbSetOutputSizeContour(size);
-printf("EED nDimensions::Process 3.5 \n" );
 //     bbSetOutputMask(*mask);
-printf("EED nDimensions::Process 3.6 \n" );
 //     bbSetOutputValue(*value);
-printf("EED nDimensions::Process End \n" );
 }
 
 //-----------------------------------------------------------------
@@ -110,17 +101,13 @@ printf("EED WARNING Verify that GetDllAppPath in  nDimensions::CreateWidget bbCr
 #endif // MACOSX       
        
        
-printf("EED nDimensions::CreateWidget path=%s\n",datadir.c_str() );
+//printf("EED nDimensions::CreateWidget path=%s\n",datadir.c_str() );
 
        wxContourMainFrame* wxcontourmainframe = wxContourMainFrame::getInstance(parent, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages,wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir );
-printf("EED nDimensions::CreateWidget 1 \n" );
        wxContourMainFrame::getInstance()->ShowToolsPanel(false);
-printf("EED nDimensions::CreateWidget 2 \n" );
 
 //             bbSetOutputWidget( new wxPanel(parent,-1) );
                bbSetOutputWidget( wxcontourmainframe    );
-
-printf("EED nDimensions::CreateWidget 3 \n" );
 }
 
 //-----------------------------------------------------------------
index a4f6178ca3c80634f28eb20597b230cbc3871872..a5f7013bf1a8a9179ba8e18c6223e5867cb93dcf 100644 (file)
@@ -63,6 +63,8 @@ class /*BBTK_EXPORT*/ nDimensions
   BBTK_DECLARE_OUTPUT(Y,double**);
   BBTK_DECLARE_OUTPUT(Z,double**);
   BBTK_DECLARE_OUTPUT(SizeContour,std::vector <int>);
+  BBTK_DECLARE_OUTPUT(wxContourMainFrame,wxContourMainFrame*);
+
 
 private:
        //wxContourMainFrame* frame;
@@ -71,20 +73,21 @@ private:
 };
 
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(nDimensions, bbtk::WxBlackBox);
-BBTK_NAME("nDimensions");
-BBTK_AUTHOR("car-prie@uniandes.edu.co");
-BBTK_DESCRIPTION("With a given image, the box shows the nDimension application");
-BBTK_CATEGORY("contours");
-BBTK_INPUT(nDimensions,WorkDir,"Working data directory where config and data files are located",std::string,"");
-BBTK_INPUT(nDimensions,In,"Image to be shown",vtkImageData*,"");
-BBTK_INPUT(nDimensions,ContourType,"(default 0) Contour type to be exported: ",int,"");
+  BBTK_NAME("nDimensions");
+  BBTK_AUTHOR("car-prie@uniandes.edu.co");
+  BBTK_DESCRIPTION("With a given image, the box shows the nDimension application");
+  BBTK_CATEGORY("contours");
+  BBTK_INPUT(nDimensions,WorkDir,"Working data directory where config and data files are located",std::string,"");
+  BBTK_INPUT(nDimensions,In,"Image to be shown",vtkImageData*,"");
+  BBTK_INPUT(nDimensions,ContourType,"(default 0) Contour type to be exported: ",int,"");
 
-BBTK_OUTPUT(nDimensions, Mask, "Mask of the contours",vtkImageData*,"");
-BBTK_OUTPUT(nDimensions, Value, "Value of the contours",vtkImageData*,"");
-BBTK_OUTPUT(nDimensions, X, "Array of arrays that contains the X coordinates of each contour", double**, "");
-BBTK_OUTPUT(nDimensions, Y, "Array of arrays that contains the Y coordinates of each contour", double**, "");
-BBTK_OUTPUT(nDimensions, Z, "Array of arrays that contains the Z coordinates of each contour", double**, "");
-BBTK_OUTPUT(nDimensions, SizeContour, "Vector that contains the coordinates of each contour", std::vector <int>, "");
+  BBTK_OUTPUT(nDimensions, Mask, "Mask of the contours",vtkImageData*,"");
+  BBTK_OUTPUT(nDimensions, Value, "Value of the contours",vtkImageData*,"");
+  BBTK_OUTPUT(nDimensions, X, "Array of arrays that contains the X coordinates of each contour", double**, "");
+  BBTK_OUTPUT(nDimensions, Y, "Array of arrays that contains the Y coordinates of each contour", double**, "");
+  BBTK_OUTPUT(nDimensions, Z, "Array of arrays that contains the Z coordinates of each contour", double**, "");
+  BBTK_OUTPUT(nDimensions, SizeContour, "Vector that contains the coordinates of each contour", std::vector <int>, "");
+  BBTK_OUTPUT(nDimensions, wxContourMainFrame, "wxContourMainFrame", wxContourMainFrame*, "");
 
 BBTK_END_DESCRIBE_BLACK_BOX(nDimensions);
 }
diff --git a/bbtk/src/bbcreaContoursSetViewerPosition.cxx b/bbtk/src/bbcreaContoursSetViewerPosition.cxx
new file mode 100644 (file)
index 0000000..67c824e
--- /dev/null
@@ -0,0 +1,94 @@
+//===== 
+// 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 "bbcreaContoursSetViewerPosition.h"
+#include "bbcreaContoursPackage.h"
+namespace bbcreaContours
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaContours,SetViewerPosition)
+BBTK_BLACK_BOX_IMPLEMENTATION(SetViewerPosition,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 SetViewerPosition::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 (bbGetInputwxContourMainFrame()!=NULL)
+       {
+               if (bbGetInputPosition().size()==3 )
+               {
+                       int x = bbGetInputPosition()[0];
+                       int y = bbGetInputPosition()[1];
+                       int z = bbGetInputPosition()[2];
+
+                       vtkImageData *img = bbGetInputwxContourMainFrame()->getImageData();
+                       int ext[6];
+                       img->GetExtent(ext);
+                       int dimY=ext[3]-ext[2]+1;
+
+                       bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", y );
+                       bbGetInputwxContourMainFrame()->SetXY(x,dimY-z-1);
+
+                       bbGetInputwxContourMainFrame()->showAxis(true);
+                       bbGetInputwxContourMainFrame()->changeInstant();
+                       bbGetInputwxContourMainFrame()->RefreshInterface();
+               }
+       }
+
+}
+//===== 
+// 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 SetViewerPosition::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputwxContourMainFrame(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 SetViewerPosition::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 SetViewerPosition::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+}
+// EO namespace bbcreaContours
+
+
diff --git a/bbtk/src/bbcreaContoursSetViewerPosition.h b/bbtk/src/bbcreaContoursSetViewerPosition.h
new file mode 100644 (file)
index 0000000..d279eda
--- /dev/null
@@ -0,0 +1,52 @@
+//===== 
+// 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 __bbcreaContoursSetViewerPosition_h_INCLUDED__
+#define __bbcreaContoursSetViewerPosition_h_INCLUDED__
+
+#include "bbcreaContours_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "wxContourMainFrame.h"
+
+namespace bbcreaContours
+{
+
+class bbcreaContours_EXPORT SetViewerPosition
+        :public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(SetViewerPosition,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(wxContourMainFrame,wxContourMainFrame*);
+  BBTK_DECLARE_INPUT(Position,std::vector<int>);
+//  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(SetViewerPosition,bbtk::AtomicBlackBox);
+  BBTK_NAME("SetViewerPosition");
+  BBTK_AUTHOR("InfoDev");
+  BBTK_DESCRIPTION("No Description.");
+  BBTK_CATEGORY("empty");
+
+  BBTK_INPUT(SetViewerPosition,wxContourMainFrame,"wxContourMainFrame",wxContourMainFrame*,"");
+  BBTK_INPUT(SetViewerPosition,Position,"vector px py pz",std::vector<int>,"");
+
+  //BBTK_OUTPUT(SetViewerPosition,Out,"First output",double,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(SetViewerPosition);
+//===== 
+// 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 bbcreaContours
+
+#endif // __bbcreaContoursSetViewerPosition_h_INCLUDED__
+
index a3f199a412109c5c46f425a5fe230be2e1804256..e55f2842c30928e00f0b311233f1ff988c3331ee 100644 (file)
@@ -725,13 +725,14 @@ void wxContourMainFrame::updateInstantImageData()
        _instantPanel->getInstant(inst);
 
        vtkImageData* img = kernelManager->getImageAtInstant(inst);
-       if(img!=NULL){
+       if(img!=NULL)
+       {
                _theViewPanel->changeImage(img);
                showAxis(false);
        }else{
                int z = _instantPanel->getConceptDataOf("Axe Depth")->getActualValue();
                _theViewPanel->setImageSlice(z);
-       }
+       } // if img
 }
 
 void wxContourMainFrame::updateInstantAxes()
@@ -3513,6 +3514,11 @@ void wxContourMainFrame::FlipContours(int typeContourFlip, int flipDirection)
 }
 
 
+void wxContourMainFrame::SetXY(int x, int y)
+{
+       _theViewPanel->SetXY(x,y);
+}
+
 
 
 
index d9445631743d9c1169aaa4358c4dd39bfb127a08..d752f4ac857294ef8f874f0882971df63c7fd9d0 100644 (file)
@@ -343,6 +343,9 @@ class wxContourMainFrame : public wxPanel {
 
 //------------------------------------------------------------------------------------------------------------
 
+       void SetXY(int x,int y);
+
+
 private:
        //------------------------------------------------------------------------------------------------------------
        //  Private methods
index 0115b33cbb411d4947cd29b5b429a575547c1a63..1da23fc1608255c5ce64e5b2e4934806f890f210 100644 (file)
@@ -224,6 +224,13 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
        }
 
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourViewPanel::SetXY(int x, int y)
+       {
+               GetwxVtkMPR2DView()->GetVtkmprbasedata()->SetX(x);
+               GetwxVtkMPR2DView()->GetVtkmprbasedata()->SetY(y);
+       }
+
        //------------------------------------------------------------------------------------------------------------
        void wxContourViewPanel::Refresh()
        {
index 60d66f23de40d14d7a6a2087dc6822a639c149b0..59011577de3225012eadad1e7c8e0558595fffd3 100644 (file)
@@ -295,6 +295,7 @@ class wxContourViewPanel : public wxPanel
        int             GetX();
        int             GetY();
        int             GetZ();
+       void    SetXY(int x, int y);
        void    Refresh();
 
 
@@ -345,6 +346,8 @@ class wxContourViewPanel : public wxPanel
        void changeDeep();
 
        void setImageSlice(int z);
+
+
 private:
        
        //------------------------------------------------------------------------------------------------------------