creaImageIO_lib
creaImageIOWxGimmickPanel.cpp
Go to the documentation of this file.
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # pour la Santé)
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
9 #
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.
16 #
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
21 # liability.
22 #
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 # ------------------------------------------------------------------------
26 */
27 
28 
30 #include <creaImageIOSystem.h>
31 #include <creaImageIOGimmick.h>
32 #ifdef _DEBUG
33 #define new DEBUG_NEW
34 #endif
35 namespace creaImageIO
36 {
37  // CTor
38  WxGimmickPanel::WxGimmickPanel(wxWindow *parent,
39  wxWindowID id,
40  const wxPoint& pos,
41  const wxSize& size,
42  const std::string i_namedescp,
43  const std::string i_namedb,
44  int threads)
45  : wxPanel( parent,
46  id,
47  pos,
48  size,
49  wxRESIZE_BORDER |
50  wxSYSTEM_MENU |
51  wxCLOSE_BOX |
52  wxMAXIMIZE_BOX |
53  wxMINIMIZE_BOX |
54  wxCAPTION
55  ),
56  //mGimmick(0),
57  mView(0)
58  {
59  GimmickDebugMessage(1,"WxGimmickPanel::WxGimmickPanel"
60  <<std::endl);
61  wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
62 
63  try {
64  mGimmick = boost::shared_ptr<Gimmick>(new Gimmick());
65  mGimmick->Initialize(i_namedescp,i_namedb);
66  int min_dim = GIMMICK_2D_IMAGE_SELECTION;
67  int max_dim = GIMMICK_3D_IMAGE_SELECTION;
69  this,
70  -1,
71  wxDefaultPosition,
72  size,
73  min_dim,
74  max_dim,
75  threads);
76  mView->Initialize();
77  // Connect the AddProgress callback
78  mView->ConnectValidationObserver ( boost::bind( &WxGimmickPanel::OnSelectedImage , this, _1 ) );
79  }
80  catch (crea::Exception e)
81  {
82  e.Print();
83  return;
84  }
85 
86  topsizer->Add( mView,1,wxGROW,0);
87 
88  SetSizer( topsizer );
89  Layout();
90  }
91 
94  {
95  GimmickDebugMessage(1,"WxGimmickPanel::~WxGimmickPanel"
96  <<std::endl);
97  if (mView)
98  {
99  delete mView;
100  }
101  if (mGimmick)
102  {
103  mGimmick->Finalize();
104  }
105  }
106 
107 //======================================================================
108 
109 //======================================================================
110 
113  {
114  mSendImageSignal(t);
115  }
116 
117  void WxGimmickPanel::AddImagesToDB(std::string dir)
118  {
119  mView->AddDir(dir);
120  }
121 
122  //================================================================
123  // BEGIN_EVENT_TABLE(WxGimmickPanel, wxDialog)
124  // END_EVENT_TABLE()
125  //================================================================
126 
127 
128  //====================================================================
129 
130  //====================================================================
132  {
133  mSendImageSignal.connect(callback);
134  }
135 
136 } // EO namespace creaImageIO
137 
138