1 #include <creaImageIOWxGimmickTools.h>
7 ** Begin of the threshold panel
9 WxGimmickTools::WxGimmickTools(wxWindow* parent, wxString mCurrentDirectory)
10 : wxPanel(parent, -1, wxDefaultPosition, wxSize(300,250), wxBORDER_SUNKEN)
12 _currentDir = mCurrentDirectory;
15 _inputPath = new wxTextCtrl(this, wxID_ANY, _T(""), wxDefaultPosition, wxSize(400,30));
16 _outputPath = new wxTextCtrl(this, wxID_ANY, _T(""), wxDefaultPosition, wxSize(400,30));
17 _addCheckBox = new wxCheckBox(this, -1, _T("Add Images to Database?") );
18 _addCheckBox->SetValue(_addFiles);
20 wxButton *inputDir = new wxButton(this,wxID_ANY,_T("Input Directory"), wxDefaultPosition, wxSize(140,30) );
21 wxButton *outputDir = new wxButton(this,wxID_ANY,_T("Output Directory"), wxDefaultPosition, wxSize(140,30) );
23 Connect( inputDir->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxGimmickTools::onInputDir );
24 Connect( outputDir->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxGimmickTools::onOutputDir );
25 Connect( _addCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxGimmickTools::onAddToDatabase );
27 wxFlexGridSizer *textSizer = new wxFlexGridSizer(1,2);
28 textSizer->Add( new wxStaticText(this, -1, _T("Transform a Bruker image into Dicom format.")), 1, wxGROW );
29 textSizer->Add( new wxStaticText(this, -1, _T("If checkbox is selected images will be loaded into the DB.")), 1, wxGROW );
31 wxFlexGridSizer *sizer = new wxFlexGridSizer(2,5);
32 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
33 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
34 sizer->Add( _inputPath, 1, wxGROW );
35 sizer->Add( inputDir, 1, wxGROW );
36 sizer->Add( _outputPath, 1, wxGROW );
37 sizer->Add( outputDir, 1, wxGROW );
38 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
39 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
40 sizer->Add( _addCheckBox, 1, wxGROW );
42 wxFlexGridSizer *topSizer = new wxFlexGridSizer(1, 2);
43 topSizer->Add( textSizer, 1, wxGROW );
44 topSizer->Add( sizer, 1, wxGROW );
45 this->SetSizer( topSizer );
46 this->SetAutoLayout( true );
50 WxGimmickTools::~WxGimmickTools()
55 wxString WxGimmickTools::getInputDir()
57 return _inputPath->GetValue();
60 wxString WxGimmickTools::getOutputDir()
62 return _outputPath->GetValue();
65 bool WxGimmickTools::getCheckBoxValue()
67 return _addCheckBox->GetValue();
70 void WxGimmickTools::onInputDir(wxCommandEvent& event)
72 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
73 wxDirDialog* FD = new wxDirDialog( 0, _T("Select the Input Directory"), _currentDir, style);
75 if (FD->ShowModal()==wxID_OK)
77 _inputPath->SetValue(FD->GetPath());
81 void WxGimmickTools::onOutputDir(wxCommandEvent& event)
83 long style = wxDD_DEFAULT_STYLE;
84 wxDirDialog* FD = new wxDirDialog( 0, _T("Select the Output Directory"), _currentDir, style);
86 if (FD->ShowModal()==wxID_OK)
88 _outputPath->SetValue(FD->GetPath());
92 void WxGimmickTools::onAddToDatabase(wxCommandEvent& event)
94 _addFiles = _addCheckBox->GetValue();
97 } // EO namespace creaImageIO