]> Creatis software - creaContours.git/commitdiff
*** empty log message ***
authorJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Tue, 14 Apr 2009 17:18:58 +0000 (17:18 +0000)
committerJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Tue, 14 Apr 2009 17:18:58 +0000 (17:18 +0000)
appli/wxContourGUIExample/wxContourGUIExample.cxx
bbtk/src/bbCreaContournDimensions.cxx
bbtk/src/bbCreaContournDimensions.h
lib/Interface_Icons_NDimensions/interfMainPanel.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h

index 190111890132816ee0a09fe6d22e10f56ead67c4..201dcbb51b1ca961cfe88f913ad80ef0943a9015 100644 (file)
@@ -47,7 +47,8 @@
 #  define PATH_MAX 2048
 #endif 
 
-
+#include <direct.h>
+#include <stdlib.h>
 
 
 wxContourMainFrame* wxTheApplication::frame = 0;
@@ -280,6 +281,10 @@ void wxAppConsole::OnAssertFailure(char const *,int,char const *,char const *,ch
 bool wxTheApplication :: OnInit()
 {
 
+
+       
+       
+
        wxInitAllImageHandlers();
 
    int image_type = GIMMICK_3D_IMAGE_SELECTION;
index 52aeb2882d3a524ae491283d12666f4ff74fa558..6708db5ec1c9f4ef009aa50368eee0eeca6a5467 100644 (file)
@@ -9,6 +9,8 @@ void nDimensions::Process()
 {
  
        double **vectx, **vecty, **vectz;
+
+       std::vector< void * > vectortemp;
        std::vector<int> size;
        vtkImageData *mask, *value;
 
@@ -19,16 +21,15 @@ void nDimensions::Process()
 
                currentimg=img;
                selectedimages.push_back(img);
-               frame->setVectImages(selectedimages);
+               wxContourMainFrame::getInstance()->setVectImages(selectedimages);
        }
 
 
 
-       if(bbGetInputGet()==1){
-               bbSetInputGet(0);               
-               //eventHandler->checkInformationPanel();
-               //eventHandler->getValuesXYZ(vectx, vecty, vectz, &size);       
-               //eventHandler->getMaskValue(mask, value);
+       if(currentimg != NULL){
+               int contourtype = bbGetInputContourType();              
+               //wxContourMainFrame::getInstance()->getValuesXYZ(vectx, vecty, vectz, &size);
+               wxContourMainFrame::getInstance()->getMaskValue(mask, value, contourtype);              
        }
 
     bbSetOutputX(vectx);
@@ -51,8 +52,17 @@ void nDimensions::CreateWidget(wxWindow* parent)
        //new wxContourMainFrame( frame1, wxID_ANY, _T(""), wxPoint(50,50), wxSize(800, 600),selectedimages ); 
        //frame1->CreateStatusBar();
        //bbSetOutputWidget( frame1 ); 
-       frame = wxContourMainFrame::getInstance(parent, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages );
-       bbSetOutputWidget( frame ); 
+
+       char currentPath[_MAX_PATH];
+       HMODULE hand = GetModuleHandle("bbcreaContours");
+       GetModuleFileName(hand, currentPath, _MAX_PATH);
+
+       std::string path = currentPath;
+
+       path = path.substr(0,path.find_last_of("\\"));
+
+       wxPanel* panel = wxContourMainFrame::getInstance(parent, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages,wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,path );
+       bbSetOutputWidget( panel ); 
        
    
 
@@ -62,7 +72,7 @@ void nDimensions::CreateWidget(wxWindow* parent)
 void nDimensions::bbUserConstructor()
 {
 
-       bbSetInputGet(0);
+       bbSetInputContourType(0);
        bbSetInputIn(NULL);
 
 }
index 1f9989ccee3fd23bc4daf7ce1535e780daacb9b2..ada4f5d822cd19435247e9268f3d8d38eac78c2c 100644 (file)
@@ -32,7 +32,7 @@ virtual void bbUserDestructor();
 //==================================================================
   BBTK_DECLARE_INPUT(WorkDir,std::string);
   BBTK_DECLARE_INPUT(In,vtkImageData*);
-  BBTK_DECLARE_INPUT(Get,int);
+  BBTK_DECLARE_INPUT(ContourType,int);
   BBTK_PROCESS(Process);
   void Process();
   BBTK_CREATE_WIDGET(CreateWidget);
@@ -46,7 +46,7 @@ virtual void bbUserDestructor();
   BBTK_DECLARE_OUTPUT(SizeContour,std::vector <int>);
 
 private:
-       wxContourMainFrame* frame;
+       //wxContourMainFrame* frame;
        vtkImageData* currentimg;
        //wxContourEventHandler * eventHandler;
 
@@ -59,7 +59,7 @@ BBTK_DESCRIPTION("With a given image, the box shows the ndimension application")
 BBTK_CATEGORY("__CategoryBlackBox__");
 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,Get,"Set to 1 when data ready to be exported",int,"");
+BBTK_INPUT(nDimensions,ContourType,"Contour type to be exported: ",int,"");
 
 BBTK_OUTPUT(nDimensions,Mask,"Mask of the contours",vtkImageData*,"");
 BBTK_OUTPUT(nDimensions,Value,"Value of the contours",vtkImageData*,"");
index 08cdc94b62e43ff593b2de6ec32767fb995d0e33..47f763778d560b89a3c950e5344db3b61bb56017 100644 (file)
@@ -608,7 +608,9 @@ void interfMainPanel::onInformationContourLabels(int typeContourGroup,int select
 }
 
 void interfMainPanel::setStringInfoPanel(wxString tmpString){
-       ((interfInformationPanel*)informationPanel)->setStringInfoPanel(tmpString);
+       if(informationPanel!=NULL){
+               ((interfInformationPanel*)informationPanel)->setStringInfoPanel(tmpString);
+       }
 }
 
 void interfMainPanel::setRowLabelInfoPanel(int z, wxString tempString){
index 34182bdfeca0d59f525d589d6bfb145e2f30dcd4..bb5f01f8eab6ec0cf64e949ffde4294ad90b3064 100644 (file)
@@ -2093,7 +2093,10 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
 
 void wxContourMainFrame::onSaveResults(std::string directory,std::string namefile, std::string filename, int typeContourGroup){
     SaveValuesXYZ( directory , namefile, typeContourGroup );
-       SaveImageResult( directory , namefile, typeContourGroup);
+
+       vtkImageData* mask, *value;
+       this->getMaskValue(mask, value, typeContourGroup);
+       this->SaveImageResult( directory , namefile, mask, value);
 
        
        FILE *pFile=fopen(filename.c_str(),"w+");
@@ -2253,8 +2256,7 @@ void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefil
        delete contourextractdata;
 }
 
-void wxContourMainFrame::SaveImageResult(std::string directory,std::string namefile, int typeContourGroup)
-{
+void wxContourMainFrame::getMaskValue(vtkImageData* mask,vtkImageData* value,int typeContourGroup){
        wxBusyCursor wait;
        ContourExtractData      *contourextractdata = new ContourExtractData( true );
        //int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
@@ -2333,20 +2335,19 @@ void wxContourMainFrame::SaveImageResult(std::string directory,std::string namef
                        }
 
                        contourextractdata->SetLstManualContourModel( lstManConModTmp );
-
-
-//                             for (ii=0 ; ii<sizeLstContourThings ; ii++)
-//                             {
-//                                     ContourThing **contourthing = lstContourThings[ii];
-//                                     lstManConMod.push_back( (*contourthing)->getModel() );
-//                             }
-//                             contourextractdata->SetLstManualContourModel( lstManConMod );
-
                        contourextractdata->CalculateImageResult(); // with actual Z
 
                } // for  iContourGroup
        } // for z
 
+       value = contourextractdata->GetVtkImageValueResult();
+       mask = contourextractdata->GetVtkImageMaskResult();
+       delete contourextractdata;
+}
+
+void wxContourMainFrame::SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value)
+{
+       
        std::string temp = directory + "/" + namefile + "-Value.mhd";
 
        wxString filename = crea::std2wx(temp);
@@ -2360,7 +2361,7 @@ void wxContourMainFrame::SaveImageResult(std::string directory,std::string namef
 
 // Image Value
        vtkMetaImageWriter *writerValueImage = vtkMetaImageWriter::New( );
-       writerValueImage->SetInput( contourextractdata->GetVtkImageValueResult() );
+       writerValueImage->SetInput( value );
        writerValueImage->SetFileName( (const char *)filename.mb_str() );
        writerValueImage->SetFileDimensionality( 3 );
        writerValueImage->Write( );
@@ -2379,15 +2380,17 @@ void wxContourMainFrame::SaveImageResult(std::string directory,std::string namef
        filename.append(_T("-Mask.mhd"));*/
 
        vtkMetaImageWriter *writerMaskImage = vtkMetaImageWriter::New( );
-       writerMaskImage->SetInput( contourextractdata->GetVtkImageMaskResult() );
+       writerMaskImage->SetInput( mask );
        writerMaskImage->SetFileName( (const char *)filename.mb_str() );
        writerMaskImage->SetFileDimensionality( 3 );
        writerMaskImage->Write( );
 
        interfMainPanel::getInstance()->setStringInfoPanel( _T("") );
-       delete contourextractdata;
+       
 }
 
+
+
 void wxContourMainFrame::onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow){
        if( name.compare( _theViewPanel->getVerticalConceptName() ) == 0){
                _theViewPanel->setActualVertical( value);
index 80ca4e22caa7914be03f8bf2ceaf041824b4edbf..0bcb36cdab92826964598359697df408eba419e5 100644 (file)
@@ -153,6 +153,10 @@ class wxContourMainFrame : public wxPanel {
        void setInstantChooserPanel(  wxInstantChooserPanel * theInstantChooserPanel );
 
 
+       void getMaskValue(vtkImageData* mask,vtkImageData* value,int typeContourGroup);
+
+       void SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value);
+
 
 //     void setButtonsBar(  wxContour_ButtonsBar * theButtonsBar );
 //     void setGrid(  wxContour_Grid * theGridPanel );
@@ -289,7 +293,7 @@ class wxContourMainFrame : public wxPanel {
 
        void SaveValuesXYZ(std::string directory,std::string namefile, int typeContourGroup);
 
-       void SaveImageResult(std::string directory,std::string namefile, int typeContourGroup);
+       
 
        void onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow);