]> Creatis software - creaContours.git/blobdiff - bbtk/src/bbCreaContournDimensions.cxx
Clean code
[creaContours.git] / bbtk / src / bbCreaContournDimensions.cxx
index d0a4504dc68bcdef88777ba708a2e3712a68bd18..336a7637b53964296a4f5c239c662f6fe72dc369 100644 (file)
@@ -32,51 +32,46 @@ namespace bbcreaContours
 
 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;
-       std::vector<int> size;
-       vtkImageData **mask = 0, **value = 0;
-
-       vtkImageData* img = bbGetInputIn();
-
-       std::vector<vtkImageData*> selectedimages;
-       if(img!=NULL && currentimg!=img)
-       {
-               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(currentimg != NULL)
-   {
-               int contourtype = bbGetInputContourType();
-               //wxContourMainFrame::getInstance()->getValuesXYZ(vectx, vecty, vectz, &size);
-               //wxContourMainFrame::getInstance()->getMaskValue(mask, value, contourtype);
-       }
-
+//    double **vectx = 0, **vecty = 0, **vectz = 0;
+//        std::vector< void * > vectortemp;
+//        std::vector<int> size;
+//        vtkImageData **mask = 0, **value = 0;
+
+    if (firsttime==true)
+    {
+        firsttime=false;
+        std::vector<vtkImageData*> selectedimages;
+        if(bbGetInputIn()!=NULL)
+        {
+            currentimg = bbGetInputIn();
+            selectedimages.push_back( bbGetInputIn() );
+            wxContourMainFrame::getInstance()->ShowToolsPanel(true);
+            wxContourMainFrame::getInstance()->configure(selectedimages);
+        } // if In
+    } else{
+
+        //wxContourMainFrame::getInstance()->getValuesXYZ(vectx, vecty, vectz, &size);
+        //wxContourMainFrame::getInstance()->getMaskValue(mask, value, contourtype);
+
+        if ( currentimg!=bbGetInputIn() )
+        {
+            wxContourMainFrame::getInstance()->changeImage(0, bbGetInputIn() );
+            currentimg=bbGetInputIn();
+        } // if currentimg!=In
+
+        
+    } // if firsttime
     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,22 +105,20 @@ 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" );
 }
 
 //-----------------------------------------------------------------
 void nDimensions::bbUserSetDefaultValues()
 {
+    firsttime   = true;
+    currentimg  = NULL;
        bbSetInputContourType(0);
        bbSetInputIn(NULL);
 }