2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
29 #include <creaImageIOWxGimmickTools.h>
35 ** Begin of the threshold panel
37 WxGimmickTools::WxGimmickTools(wxWindow* parent, wxString mCurrentDirectory)
38 : wxPanel(parent, -1, wxDefaultPosition, wxSize(300,250), wxBORDER_SUNKEN)
40 _currentDir = mCurrentDirectory;
44 _inputPath = new wxTextCtrl(this, wxID_ANY, _T(""), wxDefaultPosition, wxSize(400,30));
45 _outputPath = new wxTextCtrl(this, wxID_ANY, _T(""), wxDefaultPosition, wxSize(400,30));
46 _addCheckBox = new wxCheckBox(this, -1, _T("Add Images to Database?") );
47 _mhdCheckBox = new wxCheckBox(this, -1, _T("Convert to MHD?") );
48 _addCheckBox->SetValue(_addFiles);
49 _mhdCheckBox->SetValue(_mhd);
51 wxButton *inputDir = new wxButton(this, wxID_ANY,_T("Input Directory"), wxDefaultPosition, wxSize(140,30) );
52 wxButton *outputDir = new wxButton(this, wxID_ANY,_T("Output Directory"), wxDefaultPosition, wxSize(140,30) );
54 Connect( inputDir->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxGimmickTools::onInputDir );
55 Connect( outputDir->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxGimmickTools::onOutputDir );
56 Connect( _addCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxGimmickTools::onAddToDatabase );
57 Connect( _mhdCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxGimmickTools::onMHD );
59 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
60 #if wxMAJOR_VERSION <= 2
61 wxFlexGridSizer *textSizer = new wxFlexGridSizer(1,2);
63 wxFlexGridSizer *textSizer = new wxFlexGridSizer(2);
66 textSizer->Add( new wxStaticText(this, -1, _T("Transform a Bruker 'Serie'/'Study'/'set of Studies' directory into Dicom / MHD format.")), 1, wxGROW );
67 textSizer->Add( new wxStaticText(this, -1, _T("If checkbox is selected images will be loaded into the DB.")), 1, wxGROW );
69 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
70 #if wxMAJOR_VERSION <= 2
71 wxFlexGridSizer *sizer = new wxFlexGridSizer(2,5);
73 wxFlexGridSizer *sizer = new wxFlexGridSizer(5);
75 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
76 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
77 sizer->Add( _inputPath, 1, wxGROW );
78 sizer->Add( inputDir, 1, wxGROW );
79 sizer->Add( _outputPath, 1, wxGROW );
80 sizer->Add( outputDir, 1, wxGROW );
81 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
82 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
83 sizer->Add( _addCheckBox, 1, wxGROW );
84 sizer->Add( _mhdCheckBox, 1, wxGROW );
86 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
87 #if wxMAJOR_VERSION <= 2
88 wxFlexGridSizer *topSizer = new wxFlexGridSizer(1, 2);
90 wxFlexGridSizer *topSizer = new wxFlexGridSizer(2);
92 topSizer->Add( textSizer, 1, wxGROW );
93 topSizer->Add( sizer, 1, wxGROW );
94 this->SetSizer( topSizer );
95 this->SetAutoLayout( true );
99 WxGimmickTools::~WxGimmickTools()
104 wxString WxGimmickTools::getInputDir()
106 return _inputPath->GetValue();
109 wxString WxGimmickTools::getOutputDir()
111 return _outputPath->GetValue();
114 bool WxGimmickTools::getAddToDBCheckBoxValue()
116 return _addCheckBox->GetValue();
119 bool WxGimmickTools::getMHDCheckBoxValue()
121 return _mhdCheckBox->GetValue();
124 void WxGimmickTools::onInputDir(wxCommandEvent& event)
126 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
127 wxDirDialog* FD = new wxDirDialog( 0, _T("Select the Input Directory"), _currentDir, style);
129 if (FD->ShowModal()==wxID_OK)
131 _inputPath->SetValue(FD->GetPath());
135 void WxGimmickTools::onOutputDir(wxCommandEvent& event)
137 long style = wxDD_DEFAULT_STYLE;
138 wxDirDialog* FD = new wxDirDialog( 0, _T("Select the Output Directory"), _currentDir, style);
140 if (FD->ShowModal()==wxID_OK)
142 _outputPath->SetValue(FD->GetPath());
146 void WxGimmickTools::onAddToDatabase(wxCommandEvent& event)
148 _addFiles = _addCheckBox->GetValue();
151 void WxGimmickTools::onMHD(wxCommandEvent& event)
153 _mhd = _mhdCheckBox->GetValue();
156 } // EO namespace creaImageIO