creaImageIO_lib
creaImageIOWxPACSConnectionPanel.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 
30 #include <creaImageIOSystem.h>
31 #if defined (USE_GDCM2)
32 #include "gdcmCompositeNetworkFunctions.h"
33 #endif
34 namespace creaImageIO
35 {
36  // CTor
37  WxPACSConnectionPanel::WxPACSConnectionPanel(wxWindow *parent, wxDialog* dial, WxGimmickView* view)
38  : wxPanel( parent,
39  -1, wxDefaultPosition,
40  wxDefaultSize,
41  wxRESIZE_BORDER |
42  wxSYSTEM_MENU |
43  wxCLOSE_BOX |
44  wxMAXIMIZE_BOX |
45  wxMINIMIZE_BOX |
46  wxCAPTION
47  ),
48  dialog(dial),
49  mView(view)
50  {
51  GimmickDebugMessage(1,"WxPACSConnectionPanel::WxPACSConnectionPanel"
52  <<std::endl);
54  wxStaticText * dicId=new wxStaticText(this,-1,_T(" DICOM Identification: "), wxPoint(5,5));
55  wxStaticText * aet=new wxStaticText(this,-1,_T(" AETitle: "), wxPoint(5,25));
56  aeTitle=new wxTextCtrl(this, wxID_ANY, _T("MyAeTitle"), wxPoint(75,25), wxSize(220,20));
57 
58  wxStaticText * pn=new wxStaticText(this,-1,_T(" Port Number: "), wxPoint(5,53));
59  pNumber=new wxTextCtrl(this, wxID_ANY, _T("3306"), wxPoint(75,50), wxSize(220,20));
60  wxStaticText * adv1=new wxStaticText(this,-1,_T(" (1 - 131072) "), wxPoint(300,53));
61 
62  wxStaticText * ad=new wxStaticText(this,-1,_T(" Address: "), wxPoint(5,80));
63  address=new wxTextCtrl(this, wxID_ANY, _T("localhost"), wxPoint(75,75), wxSize(220,20));
64 
65  wxButton *query = new wxButton(this,wxID_ANY,_T("Query PACS Server"), wxPoint(5,110) );
66  Connect( query->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxPACSConnectionPanel::OnQueryPACS );
67 
68  Layout();
69  }
70 
73  {
74  GimmickDebugMessage(1,"WxPACSConnectionPanel::~WxPACSConnectionPanel"
75  <<std::endl);
76  }
77 
78  void WxPACSConnectionPanel::OnQueryPACS(wxCommandEvent& event)
79  {
80  #if defined (USE_GDCM2)
81  bool didItWork = gdcm::CompositeNetworkFunctions::CEcho( crea::wx2std(address->GetValue()).c_str(), 3600,
82  "CREATIS", crea::wx2std(aeTitle->GetValue()).c_str() );
83  gdcm::Tag tag;
84  tag.ReadFromCommaSeparatedString("10,10");
85  /* tag.SetElement(8);
86  tag.SetGroup(8);*/
87  std::vector< std::pair<gdcm::Tag, std::string> > keys;
88 
89  std::pair<gdcm::Tag, std::string> pa;
90  pa.first = tag;
91  pa.second = "";
92  keys.push_back(std::make_pair(tag, ""));
93  gdcm::EQueryLevel theLevel = gdcm::ePatient;
94  gdcm::ERootType theRoot = gdcm::ePatientRootType;
95  gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery = gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,keys);
96 
97 
98  std::vector<gdcm::DataSet> theDataSet;
99  gdcm::CompositeNetworkFunctions::CFind(crea::wx2std(address->GetValue()).c_str(), 3600, theQuery, theDataSet,
100  "CREATIS", crea::wx2std(aeTitle->GetValue()).c_str());
101 #endif
102  }
103 
104 //======================================================================
105 
106 //======================================================================
107 
108 } // EO namespace creaImageIO
109 
110