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;
16 _inputPath = new wxTextCtrl(this, wxID_ANY, _T(""), wxDefaultPosition, wxSize(400,30));
17 _outputPath = new wxTextCtrl(this, wxID_ANY, _T(""), wxDefaultPosition, wxSize(400,30));
18 _addCheckBox = new wxCheckBox(this, -1, _T("Add Images to Database?") );
19 _mhdCheckBox = new wxCheckBox(this, -1, _T("Convert to MHD?") );
20 _addCheckBox->SetValue(_addFiles);
21 _mhdCheckBox->SetValue(_mhd);
23 wxButton *inputDir = new wxButton(this, wxID_ANY,_T("Input Directory"), wxDefaultPosition, wxSize(140,30) );
24 wxButton *outputDir = new wxButton(this, wxID_ANY,_T("Output Directory"), wxDefaultPosition, wxSize(140,30) );
26 Connect( inputDir->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxGimmickTools::onInputDir );
27 Connect( outputDir->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxGimmickTools::onOutputDir );
28 Connect( _addCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxGimmickTools::onAddToDatabase );
29 Connect( _mhdCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxGimmickTools::onMHD );
31 wxFlexGridSizer *textSizer = new wxFlexGridSizer(1,2);
32 textSizer->Add( new wxStaticText(this, -1, _T("Transform a Bruker image into Dicom / MHD format.")), 1, wxGROW );
33 textSizer->Add( new wxStaticText(this, -1, _T("If checkbox is selected images will be loaded into the DB.")), 1, wxGROW );
35 wxFlexGridSizer *sizer = new wxFlexGridSizer(2,5);
36 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
37 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
38 sizer->Add( _inputPath, 1, wxGROW );
39 sizer->Add( inputDir, 1, wxGROW );
40 sizer->Add( _outputPath, 1, wxGROW );
41 sizer->Add( outputDir, 1, wxGROW );
42 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
43 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
44 sizer->Add( _addCheckBox, 1, wxGROW );
45 sizer->Add( _mhdCheckBox, 1, wxGROW );
47 wxFlexGridSizer *topSizer = new wxFlexGridSizer(1, 2);
48 topSizer->Add( textSizer, 1, wxGROW );
49 topSizer->Add( sizer, 1, wxGROW );
50 this->SetSizer( topSizer );
51 this->SetAutoLayout( true );
55 WxGimmickTools::~WxGimmickTools()
60 wxString WxGimmickTools::getInputDir()
62 return _inputPath->GetValue();
65 wxString WxGimmickTools::getOutputDir()
67 return _outputPath->GetValue();
70 bool WxGimmickTools::getAddToDBCheckBoxValue()
72 return _addCheckBox->GetValue();
75 bool WxGimmickTools::getMHDCheckBoxValue()
77 return _mhdCheckBox->GetValue();
80 void WxGimmickTools::onInputDir(wxCommandEvent& event)
82 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
83 wxDirDialog* FD = new wxDirDialog( 0, _T("Select the Input Directory"), _currentDir, style);
85 if (FD->ShowModal()==wxID_OK)
87 _inputPath->SetValue(FD->GetPath());
91 void WxGimmickTools::onOutputDir(wxCommandEvent& event)
93 long style = wxDD_DEFAULT_STYLE;
94 wxDirDialog* FD = new wxDirDialog( 0, _T("Select the Output Directory"), _currentDir, style);
96 if (FD->ShowModal()==wxID_OK)
98 _outputPath->SetValue(FD->GetPath());
102 void WxGimmickTools::onAddToDatabase(wxCommandEvent& event)
104 _addFiles = _addCheckBox->GetValue();
107 void WxGimmickTools::onMHD(wxCommandEvent& event)
109 _mhd = _mhdCheckBox->GetValue();
112 } // EO namespace creaImageIO