diff --git a/invesalius/control.py b/invesalius/control.py index ff270b9..aa85968 100755 --- a/invesalius/control.py +++ b/invesalius/control.py @@ -486,7 +486,8 @@ class Controller(): if file_range != None and file_range[1] > file_range[0]: filelist = filelist[file_range[0]:file_range[1] + 1] - + + print ">>>>>>>>>>>>>>>>>>",filelist zspacing = dicom_group.zspacing * interval size = dicom.image.size bits = dicom.image.bits_allocad diff --git a/invesalius/gui/frame.py b/invesalius/gui/frame.py index d10b15a..53617c0 100755 --- a/invesalius/gui/frame.py +++ b/invesalius/gui/frame.py @@ -458,7 +458,7 @@ class MenuBar(wx.MenuBar): file_menu = wx.Menu() app = file_menu.Append app(const.ID_DICOM_IMPORT, _("Import DICOM...\tCtrl+I")) - app(const.ID_DICOM_NETWORK, _("Retrieve DICOM from PACS")) + #####app(const.ID_DICOM_NETWORK, _("Retrieve DICOM from PACS")) file_menu.AppendMenu(const.ID_IMPORT_OTHERS_FILES, _("Import Others Files"), others_file_menu) app(const.ID_PROJECT_OPEN, _("Open Project...\tCtrl+O")) app(const.ID_PROJECT_SAVE, _("Save Project\tCtrl+S")) diff --git a/invesalius/gui/import_network_panel.py b/invesalius/gui/import_network_panel.py index f136d52..7613b85 100644 --- a/invesalius/gui/import_network_panel.py +++ b/invesalius/gui/import_network_panel.py @@ -220,6 +220,7 @@ class TextPanel(wx.Panel): def __bind_pubsub_evt(self): #ps.Publisher().subscribe(self.SelectSeries, 'Select series in import panel') ps.Publisher().subscribe(self.Populate, 'Populate tree') + ps.Publisher().subscribe(self.SetHostsList, 'Set FindPanel hosts list') def __bind_events_wx(self): self.Bind(wx.EVT_SIZE, self.OnSize) @@ -314,7 +315,7 @@ class TextPanel(wx.Panel): tree.SetItemText(parent, "%s" % age, 2) tree.SetItemText(parent, "%s" % gender, 3) tree.SetItemText(parent, "%s" % study_description, 4) - tree.SetItemText(parent, "%s" % modality, 5) + tree.SetItemText(parent, "%s" % "", 5) tree.SetItemText(parent, "%s" % date + " " + time, 6) tree.SetItemText(parent, "%s" % str(n_amount_images), 7) tree.SetItemText(parent, "%s" % institution, 8) @@ -330,18 +331,24 @@ class TextPanel(wx.Panel): n_images = patients[patient][series]['n_images'] date = patients[patient][series]['acquisition_date'] time = patients[patient][series]['acquisition_time'] + modality = patients[patient][series]['modality'] - child = tree.AppendItem(parent, serie_description) + child = tree.AppendItem(parent, series) tree.SetItemPyData(child, series) tree.SetItemText(child, "%s" % serie_description, 0) #tree.SetItemText(child, "%s" % dicom.acquisition.protocol_name, 4) - #tree.SetItemText(child, "%s" % dicom.acquisition.modality, 5) + tree.SetItemText(child, "%s" % modality, 5) tree.SetItemText(child, "%s" % date + " " + time, 6) tree.SetItemText(child, "%s" % n_images , 7) - self.idserie_treeitem[child] = (patient, series) + self.idserie_treeitem[(patient, series)] = child + + tree.Expand(self.root) + #tree.SelectItem(parent_select) + tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate) + #tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged) """ @@ -394,6 +401,13 @@ class TextPanel(wx.Panel): tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate) tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged)""" + def SetHostsList(self, evt_pub): + self.hosts = evt_pub.data + + def GetHostList(self): + ps.Publisher().sendMessage('Get NodesPanel host list') + return self.hosts + def OnSelChanged(self, evt): item = self.tree.GetSelection() if self._selected_by_user: @@ -418,10 +432,31 @@ class TextPanel(wx.Panel): def OnActivate(self, evt): item = evt.GetItem() - group = self.tree.GetItemPyData(item) - my_evt = SelectEvent(myEVT_SELECT_SERIE_TEXT, self.GetId()) - my_evt.SetItemData(group) - self.GetEventHandler().ProcessEvent(my_evt) + item_parent = self.tree.GetItemParent(item) + + patient_id = self.tree.GetItemPyData(item_parent) + serie_id = self.tree.GetItemPyData(item) + + hosts = self.GetHostList() + + for key in hosts.keys(): + if key != 0: + dn = dcm_net.DicomNet() + dn.SetHost(self.hosts[key][1]) + dn.SetPort(self.hosts[key][2]) + dn.SetAETitleCall(self.hosts[key][3]) + dn.SetAETitle(self.hosts[0][3]) + dn.RunCMove((patient_id, serie_id)) + #dn.SetSearchWord(self.find_txt.GetValue()) + + #ps.Publisher().sendMessage('Populate tree', dn.RunCFind()) + + + + #my_evt = SelectEvent(myEVT_SELECT_SERIE_TEXT, self.GetId()) + #my_evt.SetItemData(group) + #self.GetEventHandler().ProcessEvent(my_evt) + def OnSize(self, evt): self.tree.SetSize(self.GetSize()) diff --git a/invesalius/invesalius.py b/invesalius/invesalius.py index d208d78..f5ced95 100755 --- a/invesalius/invesalius.py +++ b/invesalius/invesalius.py @@ -34,6 +34,7 @@ else: wxversion.select('2.8-unicode', optionsRequired=True) import wx +from wx.lib.pubsub import setupv1 import wx.lib.pubsub as ps import wx.lib.agw.advancedsplash as agw diff --git a/invesalius/net/dicom.py b/invesalius/net/dicom.py index 9a22643..b5c5eb6 100644 --- a/invesalius/net/dicom.py +++ b/invesalius/net/dicom.py @@ -51,7 +51,7 @@ class DicomNet: tags = [(0x0010, 0x0010), (0x0010, 0x1010), (0x0010,0x0040), (0x0008,0x1030),\ (0x0008,0x0060), (0x0008,0x0022), (0x0008,0x0080), (0x0010,0x0030),\ (0x0008,0x0050), (0x0008,0x0090), (0x0008,0x103E), (0x0008,0x0033),\ - (0x0008,0x0032)] + (0x0008,0x0032), (0x0020,0x000d)] ds = gdcm.DataSet() @@ -109,6 +109,9 @@ class DicomNet: acquisition_time = utils.format_time(self.GetValueFromDICOM(rt, (0x0008,0x0032))) acquisition_date = utils.format_date(self.GetValueFromDICOM(rt, (0x0008,0x0022))) + teste = self.GetValueFromDICOM(rt, (0x0020,0x000d)) + print ">>>>>>>>>>>>>>>>>>>>", teste + patients[patient_id][serie_id] = {'name':name, 'age':age, 'gender':gender,\ 'study_description':study_description,\ 'modality':modality, \ @@ -125,3 +128,66 @@ class DicomNet: patients[patient_id][serie_id]['n_images'] += 1 return patients + + + def RunCMove(self, values): + + ds = gdcm.DataSet() + + #for v in values: + + + tg_patient = gdcm.Tag(0x0010, 0x0020) + tg_serie = gdcm.Tag(0x0020, 0x000e) + + de_patient = gdcm.DataElement(tg_patient) + de_serie = gdcm.DataElement(tg_serie) + + patient_id = str(values[0]) + serie_id = str(values[1]) + + print "(0x0010, 0x0020)",patient_id + + print "(0x0020, 0x000e)",serie_id + print "\n\n" + + de_patient.SetByteValue(patient_id, gdcm.VL(len(patient_id))) + de_serie.SetByteValue(serie_id, gdcm.VL(len(serie_id))) + + ds.Insert(de_patient) + ds.Insert(de_serie) + + + cnf = gdcm.CompositeNetworkFunctions() + theQuery = cnf.ConstructQuery(gdcm.ePatientRootType, gdcm.eImageOrFrame, ds) + #ret = gdcm.DataSetArrayType() + + """ + CMove (const char *remote, + uint16_t portno, + const BaseRootQuery *query, + + uint16_t portscp, + const char *aetitle=NULL, + const char *call=NULL, + const char *outputdir=NULL)""" + + + + cnf.CMove(self.address, int(self.port), theQuery, 11113, self.aetitle,\ + self.aetitle_call, "/home/phamorim/Desktop/output/") + + + ret = gdcm.DataSetArrayType() + + cnf.CFind(self.address, int(self.port), theQuery, ret, self.aetitle,\ + self.aetitle_call) + + print "aetitle",self.aetitle + print "call",self.aetitle_call + print "Baixados..........." + + + for r in ret: + print r + print "\n" -- libgit2 0.21.2