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 wxFlexGridSizer *textSizer = new wxFlexGridSizer(1,2);
60 textSizer->Add( new wxStaticText(this, -1, _T("Transform a Bruker 'Serie'/'Study'/'set of Studies' directory into Dicom / MHD format.")), 1, wxGROW );
61 textSizer->Add( new wxStaticText(this, -1, _T("If checkbox is selected images will be loaded into the DB.")), 1, wxGROW );
63 wxFlexGridSizer *sizer = new wxFlexGridSizer(2,5);
64 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
65 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
66 sizer->Add( _inputPath, 1, wxGROW );
67 sizer->Add( inputDir, 1, wxGROW );
68 sizer->Add( _outputPath, 1, wxGROW );
69 sizer->Add( outputDir, 1, wxGROW );
70 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
71 sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW );
72 sizer->Add( _addCheckBox, 1, wxGROW );
73 sizer->Add( _mhdCheckBox, 1, wxGROW );
75 wxFlexGridSizer *topSizer = new wxFlexGridSizer(1, 2);
76 topSizer->Add( textSizer, 1, wxGROW );
77 topSizer->Add( sizer, 1, wxGROW );
78 this->SetSizer( topSizer );
79 this->SetAutoLayout( true );
83 WxGimmickTools::~WxGimmickTools()
88 wxString WxGimmickTools::getInputDir()
90 return _inputPath->GetValue();
93 wxString WxGimmickTools::getOutputDir()
95 return _outputPath->GetValue();
98 bool WxGimmickTools::getAddToDBCheckBoxValue()
100 return _addCheckBox->GetValue();
103 bool WxGimmickTools::getMHDCheckBoxValue()
105 return _mhdCheckBox->GetValue();
108 void WxGimmickTools::onInputDir(wxCommandEvent& event)
110 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
111 wxDirDialog* FD = new wxDirDialog( 0, _T("Select the Input Directory"), _currentDir, style);
113 if (FD->ShowModal()==wxID_OK)
115 _inputPath->SetValue(FD->GetPath());
119 void WxGimmickTools::onOutputDir(wxCommandEvent& event)
121 long style = wxDD_DEFAULT_STYLE;
122 wxDirDialog* FD = new wxDirDialog( 0, _T("Select the Output Directory"), _currentDir, style);
124 if (FD->ShowModal()==wxID_OK)
126 _outputPath->SetValue(FD->GetPath());
130 void WxGimmickTools::onAddToDatabase(wxCommandEvent& event)
132 _addFiles = _addCheckBox->GetValue();
135 void WxGimmickTools::onMHD(wxCommandEvent& event)
137 _mhd = _mhdCheckBox->GetValue();
140 } // EO namespace creaImageIO