]> Creatis software - creaImageIO.git/blob - src/creaImageIOWxPACSConnectionPanel.cpp
5fdb5697a5ff0ad33b235335a14341df2c5bf9bd
[creaImageIO.git] / src / creaImageIOWxPACSConnectionPanel.cpp
1 #include <creaImageIOWxPACSConnectionPanel.h>
2 #include <creaImageIOPACSConnection.h>
3 #include <creaImageIOSystem.h>
4 #if defined (USE_GDCM2)
5 #include "gdcmCompositeNetworkFunctions.h"
6 #endif
7 namespace creaImageIO
8 {
9   // CTor
10   WxPACSConnectionPanel::WxPACSConnectionPanel(wxWindow *parent, wxDialog* dial, WxGimmickView* view)
11  :   wxPanel( parent, 
12                   -1, wxDefaultPosition, 
13                   wxDefaultSize,
14                   wxRESIZE_BORDER | 
15               wxSYSTEM_MENU  |
16                   wxCLOSE_BOX |
17                   wxMAXIMIZE_BOX | 
18                   wxMINIMIZE_BOX | 
19                   wxCAPTION  
20                ),       
21                    dialog(dial),
22                    mView(view)
23   {
24     GimmickDebugMessage(1,"WxPACSConnectionPanel::WxPACSConnectionPanel"
25                         <<std::endl);
26         wxStaticText * dicId=new wxStaticText(this,-1,_T(" DICOM Identification: "), wxPoint(5,5));
27         wxStaticText * aet=new wxStaticText(this,-1,_T(" AETitle: "), wxPoint(5,25));
28         aeTitle=new wxTextCtrl(this, wxID_ANY, _T("MyAeTitle"), wxPoint(75,25), wxSize(220,20));
29
30         wxStaticText * pn=new wxStaticText(this,-1,_T(" Port Number: "), wxPoint(5,53));
31         pNumber=new wxTextCtrl(this, wxID_ANY, _T("3306"), wxPoint(75,50), wxSize(220,20));
32         wxStaticText * adv1=new wxStaticText(this,-1,_T(" (1 - 131072) "), wxPoint(300,53));
33
34         wxStaticText * ad=new wxStaticText(this,-1,_T(" Address: "), wxPoint(5,80));
35         address=new wxTextCtrl(this, wxID_ANY, _T("localhost"), wxPoint(75,75), wxSize(220,20));
36         
37         wxButton *query = new wxButton(this,wxID_ANY,_T("Query PACS Server"), wxPoint(5,110) );
38         Connect( query->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxPACSConnectionPanel::OnQueryPACS ); 
39    
40     Layout(); 
41   }
42
43   /// Destructor
44   WxPACSConnectionPanel::~WxPACSConnectionPanel()
45   {
46     GimmickDebugMessage(1,"WxPACSConnectionPanel::~WxPACSConnectionPanel"
47                         <<std::endl);
48   }
49
50   void WxPACSConnectionPanel::OnQueryPACS(wxCommandEvent& event)
51   {
52           #if defined (USE_GDCM2)
53             bool didItWork = gdcm::CompositeNetworkFunctions::CEcho( crea::wx2std(address->GetValue()).c_str(), 3600,
54                         "CREATIS", crea::wx2std(aeTitle->GetValue()).c_str() );
55                   gdcm::Tag tag;
56                   tag.ReadFromCommaSeparatedString("10,10"); 
57                 /*  tag.SetElement(8);
58                   tag.SetGroup(8);*/
59                 std::vector< std::pair<gdcm::Tag, std::string> > keys;
60
61                 std::pair<gdcm::Tag, std::string> pa;
62                 pa.first = tag;
63                 pa.second = "";
64                 keys.push_back(std::make_pair(tag, ""));
65                         gdcm::EQueryLevel theLevel  = gdcm::ePatient;
66                 gdcm::ERootType theRoot  = gdcm::ePatientRootType;
67                     gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,keys);
68
69         
70                     std::vector<gdcm::DataSet> theDataSet;
71   gdcm::CompositeNetworkFunctions::CFind(crea::wx2std(address->GetValue()).c_str(), 3600, theQuery, theDataSet,
72        "CREATIS", crea::wx2std(aeTitle->GetValue()).c_str());
73 #endif
74   }
75   
76 //======================================================================
77   
78 //====================================================================== 
79
80 } // EO namespace creaImageIO
81
82