creaImageIOWxPACSConnectionPanel.cpp

Go to the documentation of this file.
00001 #include <creaImageIOWxPACSConnectionPanel.h>
00002 #include <creaImageIOPACSConnection.h>
00003 #include <creaImageIOSystem.h>
00004 #if defined (USE_GDCM2)
00005 #include "gdcmCompositeNetworkFunctions.h"
00006 #endif
00007 namespace creaImageIO
00008 {
00009   // CTor
00010   WxPACSConnectionPanel::WxPACSConnectionPanel(wxWindow *parent, wxDialog* dial, WxGimmickView* view)
00011  :   wxPanel( parent, 
00012                   -1, wxDefaultPosition, 
00013                   wxDefaultSize,
00014                   wxRESIZE_BORDER | 
00015               wxSYSTEM_MENU  |
00016                   wxCLOSE_BOX |
00017                   wxMAXIMIZE_BOX | 
00018                   wxMINIMIZE_BOX | 
00019                   wxCAPTION  
00020                ),       
00021                    dialog(dial),
00022                    mView(view)
00023   {
00024     GimmickDebugMessage(1,"WxPACSConnectionPanel::WxPACSConnectionPanel"
00025                         <<std::endl);
00026         wxStaticText * dicId=new wxStaticText(this,-1,_T(" DICOM Identification: "), wxPoint(5,5));
00027         wxStaticText * aet=new wxStaticText(this,-1,_T(" AETitle: "), wxPoint(5,25));
00028         aeTitle=new wxTextCtrl(this, wxID_ANY, _T("MyAeTitle"), wxPoint(75,25), wxSize(220,20));
00029 
00030         wxStaticText * pn=new wxStaticText(this,-1,_T(" Port Number: "), wxPoint(5,53));
00031         pNumber=new wxTextCtrl(this, wxID_ANY, _T("3306"), wxPoint(75,50), wxSize(220,20));
00032         wxStaticText * adv1=new wxStaticText(this,-1,_T(" (1 - 131072) "), wxPoint(300,53));
00033 
00034         wxStaticText * ad=new wxStaticText(this,-1,_T(" Address: "), wxPoint(5,80));
00035         address=new wxTextCtrl(this, wxID_ANY, _T("localhost"), wxPoint(75,75), wxSize(220,20));
00036         
00037         wxButton *query = new wxButton(this,wxID_ANY,_T("Query PACS Server"), wxPoint(5,110) );
00038         Connect( query->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxPACSConnectionPanel::OnQueryPACS ); 
00039    
00040     Layout(); 
00041   }
00042 
00044   WxPACSConnectionPanel::~WxPACSConnectionPanel()
00045   {
00046     GimmickDebugMessage(1,"WxPACSConnectionPanel::~WxPACSConnectionPanel"
00047                         <<std::endl);
00048   }
00049 
00050   void WxPACSConnectionPanel::OnQueryPACS(wxCommandEvent& event)
00051   {
00052           #if defined (USE_GDCM2)
00053             bool didItWork = gdcm::CompositeNetworkFunctions::CEcho( crea::wx2std(address->GetValue()).c_str(), 3600,
00054                         "CREATIS", crea::wx2std(aeTitle->GetValue()).c_str() );
00055                   gdcm::Tag tag;
00056                   tag.ReadFromCommaSeparatedString("10,10"); 
00057                 /*  tag.SetElement(8);
00058                   tag.SetGroup(8);*/
00059                 std::vector< std::pair<gdcm::Tag, std::string> > keys;
00060 
00061                 std::pair<gdcm::Tag, std::string> pa;
00062                 pa.first = tag;
00063                 pa.second = "";
00064                 keys.push_back(std::make_pair(tag, ""));
00065                         gdcm::EQueryLevel theLevel  = gdcm::ePatient;
00066                 gdcm::ERootType theRoot  = gdcm::ePatientRootType;
00067                     gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery =  gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,keys);
00068 
00069         
00070                     std::vector<gdcm::DataSet> theDataSet;
00071   gdcm::CompositeNetworkFunctions::CFind(crea::wx2std(address->GetValue()).c_str(), 3600, theQuery, theDataSet,
00072        "CREATIS", crea::wx2std(aeTitle->GetValue()).c_str());
00073 #endif
00074   }
00075   
00076 //======================================================================
00077   
00078 //====================================================================== 
00079 
00080 } // EO namespace creaImageIO
00081 
00082