]> Creatis software - creaImageIO.git/commitdiff
*** empty log message ***
authordonadio <donadio>
Wed, 13 May 2009 11:30:04 +0000 (11:30 +0000)
committerdonadio <donadio>
Wed, 13 May 2009 11:30:04 +0000 (11:30 +0000)
src2/CMakeLists.txt
src2/creaImageIOWxGimmickTools.cpp
src2/creaImageIOWxGimmickTools.h
src2/creaImageIOWxGimmickView.cpp
src2/creaImageIOWxGimmickView.h

index a06a64b5e90af836e1f875c39dc5c36cf3a83db0..709965a91c13e77fb5df5c38cb635cc1927fdaae 100644 (file)
@@ -46,6 +46,7 @@ SET( SRCS
   creaImageIOWxGimmickReaderDialog
   creaImageIOWxGimmickFrame
   creaImageIOWxGimmickPanel
+  creaImageIOWxGimmickTools
 
   # 
   BlockScopeWxApp
@@ -150,4 +151,4 @@ INCLUDE_DIRECTORIES(
 #  ${PROJECT_BINARY_DIR}
   ${PROJECT_SOURCE_DIR}/src2
 #  ${PROJECT_SOURCE_DIR}/src2/CppSQLite3
-  )
+  )
\ No newline at end of file
index aebfbbc7104a3bcc76cfe31c26484b2fa0ad5d5e..44b6390c9e1241c812ae14afe5fb3b3b3aa47638 100644 (file)
@@ -5,50 +5,35 @@ namespace creaImageIO
        /**
        ** Begin of the threshold panel
        **/
-       WxGimmickTools::WxGimmickTools(wxWindow* parent)
-       : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
+       WxGimmickTools::WxGimmickTools(wxWindow* parent, wxString mCurrentDirectory)
+       : wxPanel(parent, -1, wxDefaultPosition, wxSize(300,200), wxBORDER_SUNKEN)
        {
-               wxButton *thresholdGoBtn = new wxButton(this,wxID_ANY,_T("Add Fake Color"), wxDefaultPosition, wxSize(200,30) );
-               wxButton *thresholdRemoveBtn = new wxButton(this,wxID_ANY,_T("Remove Fake Color"), wxDefaultPosition, wxSize(200,30) );
-               _interpolationCheckBox = new wxCheckBox(this, -1, _T("Image interpolation") );
-               _interpolationCheckBox->SetValue(true); 
-               _opacity = new wxSlider(this, wxID_ANY, 6, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-               _thresholdGo = false;
-
-               double range[2];
-               interfMainPanel::getInstance()->getImageRange(range);
+               _currentDir = mCurrentDirectory;
+               _addFiles = true;
                
-               int min = (int)floor (range[0]);
-               int max = (int)ceil (range[1]);
+               _inputPath = new wxTextCtrl(this, wxID_ANY, _T(""), wxDefaultPosition, wxSize(150,30));
+               _outputPath = new wxTextCtrl(this, wxID_ANY, _T(""), wxDefaultPosition, wxSize(150,30));
+               _addCheckBox = new wxCheckBox(this, -1, _T("Add Images to Database?") );
+               _addCheckBox->SetValue(_addFiles);
 
-               _mBarThreshold  =  new mBarRange(this,70,65);
-               _mBarThreshold->SetMin(0);
-               _mBarThreshold->SetStart(0);
-               _mBarThreshold-> SetOrientation( true );
-               _mBarThreshold-> setActiveStateTo(true);
-               _mBarThreshold-> setVisibleLabels( true );
-               _mBarThreshold-> setDeviceEndMargin(10);
-               _mBarThreshold-> setRepresentedValues( min , max );
-               _mBarThreshold-> setDeviceBlitStart(10,10); 
-               _mBarThreshold-> setIfWithActualDrawed( false );
-               _mBarThreshold-> SetStart( min );
-               _mBarThreshold-> SetEnd( max );  
-               
-               Connect( thresholdGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxGimmickTools::onThresholdGo ); 
-               Connect( thresholdRemoveBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxGimmickTools::onThresholdRemove );
-               Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxGimmickTools::onThresholdInterpolation );
+               wxButton *inputDir = new wxButton(this,wxID_ANY,_T("Input Directory"), wxDefaultPosition, wxSize(150,30) );
+               wxButton *outputDir = new wxButton(this,wxID_ANY,_T("Output Directory"), wxDefaultPosition, wxSize(150,30) );
 
-               wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
-               sizer -> Add( new wxStaticText(this,-1,_T("Image Threshold"))  , 1, wxGROW );
-               sizer -> Add( _mBarThreshold, 1, wxGROW );
-               sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW );
-               sizer -> Add( new wxStaticText(this,-1,_T("Opacity Level"))  , 1, wxGROW );
-               sizer -> Add( _opacity, 1, wxGROW );
-               sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW );
-               sizer -> Add( thresholdGoBtn, 1, wxGROW );
-               sizer -> Add( thresholdRemoveBtn, 1, wxGROW );
-               sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW );
-               sizer -> Add( _interpolationCheckBox, 1, wxGROW );
+               
+               Connect( inputDir->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxGimmickTools::onInputDir ); 
+               Connect( outputDir->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxGimmickTools::onOutputDir );
+               Connect( _addCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxGimmickTools::onAddToDatabase );
+
+               wxFlexGridSizer * sizer         = new wxFlexGridSizer(2,5);
+               sizer -> Add( _inputPath, 1, wxGROW, 10 );
+               sizer -> Add( inputDir, 1, wxGROW, 10 );
+               sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW, 10 );
+               sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW, 10 );
+               sizer -> Add( _outputPath, 1, wxGROW, 10 );
+               sizer -> Add( outputDir, 1, wxGROW, 10 );
+               sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW, 10 );
+               sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW, 10 );
+               sizer -> Add( _addCheckBox, 1, wxGROW, 10 );
 
                this->SetSizer( sizer );
                this->SetAutoLayout( true );
@@ -58,67 +43,48 @@ namespace creaImageIO
        WxGimmickTools::~WxGimmickTools(){
        }
 
-
-
-       void WxGimmickTools::onThresholdChange(wxCommandEvent& event)
+       wxString WxGimmickTools::getInputDir()
        {
-               if (_thresholdGo)
-               {
-                       //interfMainPanel::getInstance()->onThresholdChange();
-               }
+               return _inputPath->GetLabel();
        }
-
-       void WxGimmickTools::onThresholdGo(wxCommandEvent& event)
+               
+       wxString WxGimmickTools::getOutputDir()
        {
-               if (!_thresholdGo)
-               {
-                       //interfMainPanel::getInstance()->onThreshold();
-                       _thresholdGo=true;
-               }
+               return _outputPath->GetLabel();
        }
-
-       void WxGimmickTools::onThresholdRemove(wxCommandEvent& event)
+               
+       bool WxGimmickTools::getCheckBoxValue()
        {
-               if (_thresholdGo)
-               {       
-                       //interfMainPanel::getInstance()->onThresholdRemove( );
-                       _thresholdGo=false;             
-               }
+               return _addCheckBox->GetValue();
        }
-
-       void WxGimmickTools::onThresholdStop()
+               
+       void WxGimmickTools::onInputDir(wxCommandEvent& event)
        {
-               if (_thresholdGo)
-               {       
-                       //interfMainPanel::getInstance()->onThresholdRemove( );
-                       _thresholdGo=false;             
+               long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
+               wxDirDialog* FD = new wxDirDialog( 0, _T("Select the Input Directory"), _currentDir, style);
+           
+               if (FD->ShowModal()==wxID_OK)
+               {
+                       _inputPath->SetLabel(FD->GetPath());
                }
        }
 
-       void WxGimmickTools::onThresholdInstantChange(double range[])
+       void WxGimmickTools::onOutputDir(wxCommandEvent& event)
        {
-               range[0] = _mBarThreshold->GetStart();
-               range[1] = _mBarThreshold->GetEnd();
-       }
-
-       void WxGimmickTools::onThresholdInterpolation(wxCommandEvent& event)
-       {
-               //interfMainPanel::getInstance()->onThresholdInterpolation(_interpolationCheckBox->GetValue());
+               long style = wxDD_DEFAULT_STYLE;
+               wxDirDialog* FD = new wxDirDialog( 0, _T("Select the Output Directory"), _currentDir, style);
+           
+               if (FD->ShowModal()==wxID_OK)
+               {
+                       _outputPath->SetLabel(FD->GetPath());
+               }
        }
 
-       void WxGimmickTools::onChangeOpacity(wxScrollEvent& event)
+       void WxGimmickTools::onAddToDatabase(wxCommandEvent& event)
        {
-               int opacity = _opacity->GetValue();
-               //interfMainPanel::getInstance()->onThresholdChangeOpacity(opacity);
+               _addFiles = _addCheckBox->GetValue();
        }
 
-       BEGIN_EVENT_TABLE(WxGimmickTools, wxPanel)
-               EVT_COMMAND(wxID_ANY, wxEVT_TSBAR_START, WxGimmickTools :: onThresholdChange)
-               EVT_COMMAND(wxID_ANY, wxEVT_TSBAR_END, WxGimmickTools :: onThresholdChange)
-               EVT_COMMAND(wxID_ANY, wxEVT_TSBAR_MOVED, WxGimmickTools :: onThresholdChange)   
-               EVT_SCROLL(WxGimmickTools :: onChangeOpacity)
-       END_EVENT_TABLE()
-
 } // EO namespace creaImageIO
 
 
index 0cc976a06c28e4010881a15a2982617730c30a2d..31ba5e0b3aad2359c5c701fdcd6157a6a7b80bf3 100644 (file)
@@ -17,30 +17,33 @@ namespace creaImageIO
   class WxGimmickTools : public wxPanel
   {
        public:
-               WxGimmickTools(wxWindow * parent);              
+               WxGimmickTools(wxWindow * parent, wxString mCurrentDirectory);          
                ~WxGimmickTools();
                
-               void onThresholdStop();
-               void onThresholdInstantChange(double range[]);
+               wxString getInputDir();
+               
+               wxString getOutputDir();
+               
+               bool getCheckBoxValue();
+               
 
        private:
 
-               mBarRange* _mBarThreshold;
-               wxSlider* _opacity;
-               bool _thresholdGo;
-               wxCheckBox* _interpolationCheckBox;     
+               wxCheckBox * _addCheckBox;      
 
-               void onThresholdChange(wxCommandEvent& event);
+               wxTextCtrl * _inputPath;
 
-               void onThresholdGo(wxCommandEvent& event);
-
-               void onThresholdRemove(wxCommandEvent& event);
+               wxTextCtrl * _outputPath;
+               
+               wxString _currentDir;
+               
+               bool _addFiles;
 
-               void onThresholdInterpolation(wxCommandEvent& event);
+               void onInputDir(wxCommandEvent& event);
 
-               void onChangeOpacity(wxScrollEvent& event);
+               void onOutputDir(wxCommandEvent& event);
 
-               DECLARE_EVENT_TABLE()
+               void onAddToDatabase(wxCommandEvent& event);
     
        };
   
index 1a423ebc3c52be0efee184b18ed5d7f6a709bfd1..b445d82955383e73fc4855fe525c3401579f507a 100644 (file)
@@ -1,4 +1,4 @@
-#include <creaImageIOWxGimmickView.h>
+#include <creaImageIOWxGimmickView.h>
 #include <creaImageIOWxTreeView.h>
 #include <creaImageIOSystem.h>
 using namespace crea;
@@ -690,24 +690,56 @@ namespace creaImageIO
   //AndresDonadio
   void WxGimmickView::OnTools(wxCommandEvent& event)
   {
-    wxDialog* dial= new wxDialog (this,-1,_T("Tools"),wxDefaultPosition, wxDefaultSize);
-               wxBoxSizer      *siz = new wxBoxSizer(wxVERTICAL);
+               mViewer->StopPlayer();
                
-               wxButton *inBtn = new wxButton(dial,-1,_T("Input Directory"), wxDefaultPosition, wxSize(200,30) );
-               wxButton *outBtn = new wxButton(dial,-1,_T("Output Directory"), wxDefaultPosition, wxSize(200,30) );
+               wxDialog* dial= new wxDialog (this,-1,"Tools",wxDefaultPosition, wxSize(300,200));
 
-               dial->SetSizer(siz);
+
+               WxGimmickTools * gimmickTools = new WxGimmickTools(dial, mCurrentDirectory);
+
+               wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL);      
+               
+
+               wxSizer* bsizer = dial->CreateSeparatedButtonSizer(wxOK|wxCANCEL);
+               topsizer->Add(gimmickTools,1,wxGROW,0);
+               topsizer->Add(bsizer,0,wxGROW);
+
+               dial->SetSizer(topsizer, true);
+               dial->Layout();
                dial->ShowModal();
+               
+               if (dial->GetReturnCode() == wxID_OK)
+               {
+                       wxString inputDir = gimmickTools->getInputDir();
+                       wxString outputDir = gimmickTools->getOutputDir();
+                       bool addToDB = gimmickTools->getCheckBoxValue();        
+/*
+                       Bruker2Dicom b2d;    
+                       b2d.SetInputDirectory(crea::wx2std(inputDir));
+                       b2d.SetOutputDirectory(crea::wx2std(outputDir));
+                       b2d.SetConvertModeToDicom();
+                       b2d.Execute();
+*/                     
+                       if (addToDB)
+                       {
+                               mProgressDialog = new wxProgressDialog(_T("Adding directory"),_T(""),1000,this,wxPD_ELAPSED_TIME |wxPD_CAN_ABORT );
+                               mCurrentDirectory = outputDir;  
+                               mGimmick->AddDir(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),crea::wx2std(outputDir),true);
+                               mProgressDialog->Pulse(_T("Updating view..."));
+                               
+                               UpdateTreeViewLevel(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),1);
+                               delete mProgressDialog;
+                               DisplayAddSummary();
+                       }       
+               }
+               
+               mViewer->StartPlayer();
 
                /*
-                       mViewer->StopPlayer();
+                       
                std::string name = crea::wx2std(mNotebook->GetCurrentPage()->GetName());
                long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
-               wxDirDialog* FD = 
-               new wxDirDialog( 0, 
-                               _T("Select directory"),
-                               mCurrentDirectory,
-                               style);
+               wxDirDialog* FD = new wxDirDialog( 0, _T("Select directory"), mCurrentDirectory, style);
            
                if (FD->ShowModal()==wxID_OK)
                {
@@ -743,7 +775,7 @@ namespace creaImageIO
                        DisplayAddSummary();
 
                }
-               mViewer->StartPlayer();
+               
                */
   }
   //=================================================
index a9cef83f9a04602bc098e4e0a5068f0b444609f4..e2b71ba378d2386dda86f2336b5fbdb9fa978b4e 100644 (file)
@@ -5,7 +5,10 @@
 
 #include <creaImageIOGimmickView.h>
 #include <creaImageIOWxViewer.h>
+#include <creaImageIOWxGimmickTools.h>
 #include <creaWx.h>
+#include "wx/wx.h"
+//#include "bruker2dicom.h"
 
 #include <wx/splitter.h>
 #include <wx/toolbar.h>