Commit e3be96b9c28c57119a76cab97fd3be9c61fbe027
1 parent
52b8819f
Exists in
master
and in
67 other branches
ENH: Removed shortcut to pacs temporarily
Showing
5 changed files
with
114 additions
and
11 deletions
Show diff stats
invesalius/control.py
... | ... | @@ -486,7 +486,8 @@ class Controller(): |
486 | 486 | |
487 | 487 | if file_range != None and file_range[1] > file_range[0]: |
488 | 488 | filelist = filelist[file_range[0]:file_range[1] + 1] |
489 | - | |
489 | + | |
490 | + print ">>>>>>>>>>>>>>>>>>",filelist | |
490 | 491 | zspacing = dicom_group.zspacing * interval |
491 | 492 | size = dicom.image.size |
492 | 493 | bits = dicom.image.bits_allocad | ... | ... |
invesalius/gui/frame.py
... | ... | @@ -458,7 +458,7 @@ class MenuBar(wx.MenuBar): |
458 | 458 | file_menu = wx.Menu() |
459 | 459 | app = file_menu.Append |
460 | 460 | app(const.ID_DICOM_IMPORT, _("Import DICOM...\tCtrl+I")) |
461 | - app(const.ID_DICOM_NETWORK, _("Retrieve DICOM from PACS")) | |
461 | + #####app(const.ID_DICOM_NETWORK, _("Retrieve DICOM from PACS")) | |
462 | 462 | file_menu.AppendMenu(const.ID_IMPORT_OTHERS_FILES, _("Import Others Files"), others_file_menu) |
463 | 463 | app(const.ID_PROJECT_OPEN, _("Open Project...\tCtrl+O")) |
464 | 464 | app(const.ID_PROJECT_SAVE, _("Save Project\tCtrl+S")) | ... | ... |
invesalius/gui/import_network_panel.py
... | ... | @@ -220,6 +220,7 @@ class TextPanel(wx.Panel): |
220 | 220 | def __bind_pubsub_evt(self): |
221 | 221 | #ps.Publisher().subscribe(self.SelectSeries, 'Select series in import panel') |
222 | 222 | ps.Publisher().subscribe(self.Populate, 'Populate tree') |
223 | + ps.Publisher().subscribe(self.SetHostsList, 'Set FindPanel hosts list') | |
223 | 224 | |
224 | 225 | def __bind_events_wx(self): |
225 | 226 | self.Bind(wx.EVT_SIZE, self.OnSize) |
... | ... | @@ -314,7 +315,7 @@ class TextPanel(wx.Panel): |
314 | 315 | tree.SetItemText(parent, "%s" % age, 2) |
315 | 316 | tree.SetItemText(parent, "%s" % gender, 3) |
316 | 317 | tree.SetItemText(parent, "%s" % study_description, 4) |
317 | - tree.SetItemText(parent, "%s" % modality, 5) | |
318 | + tree.SetItemText(parent, "%s" % "", 5) | |
318 | 319 | tree.SetItemText(parent, "%s" % date + " " + time, 6) |
319 | 320 | tree.SetItemText(parent, "%s" % str(n_amount_images), 7) |
320 | 321 | tree.SetItemText(parent, "%s" % institution, 8) |
... | ... | @@ -330,18 +331,24 @@ class TextPanel(wx.Panel): |
330 | 331 | n_images = patients[patient][series]['n_images'] |
331 | 332 | date = patients[patient][series]['acquisition_date'] |
332 | 333 | time = patients[patient][series]['acquisition_time'] |
334 | + modality = patients[patient][series]['modality'] | |
333 | 335 | |
334 | - child = tree.AppendItem(parent, serie_description) | |
336 | + child = tree.AppendItem(parent, series) | |
335 | 337 | tree.SetItemPyData(child, series) |
336 | 338 | |
337 | 339 | tree.SetItemText(child, "%s" % serie_description, 0) |
338 | 340 | #tree.SetItemText(child, "%s" % dicom.acquisition.protocol_name, 4) |
339 | - #tree.SetItemText(child, "%s" % dicom.acquisition.modality, 5) | |
341 | + tree.SetItemText(child, "%s" % modality, 5) | |
340 | 342 | tree.SetItemText(child, "%s" % date + " " + time, 6) |
341 | 343 | tree.SetItemText(child, "%s" % n_images , 7) |
342 | 344 | |
343 | - self.idserie_treeitem[child] = (patient, series) | |
345 | + self.idserie_treeitem[(patient, series)] = child | |
346 | + | |
344 | 347 | |
348 | + tree.Expand(self.root) | |
349 | + #tree.SelectItem(parent_select) | |
350 | + tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate) | |
351 | + #tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged) | |
345 | 352 | |
346 | 353 | """ |
347 | 354 | |
... | ... | @@ -394,6 +401,13 @@ class TextPanel(wx.Panel): |
394 | 401 | tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate) |
395 | 402 | tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged)""" |
396 | 403 | |
404 | + def SetHostsList(self, evt_pub): | |
405 | + self.hosts = evt_pub.data | |
406 | + | |
407 | + def GetHostList(self): | |
408 | + ps.Publisher().sendMessage('Get NodesPanel host list') | |
409 | + return self.hosts | |
410 | + | |
397 | 411 | def OnSelChanged(self, evt): |
398 | 412 | item = self.tree.GetSelection() |
399 | 413 | if self._selected_by_user: |
... | ... | @@ -418,10 +432,31 @@ class TextPanel(wx.Panel): |
418 | 432 | |
419 | 433 | def OnActivate(self, evt): |
420 | 434 | item = evt.GetItem() |
421 | - group = self.tree.GetItemPyData(item) | |
422 | - my_evt = SelectEvent(myEVT_SELECT_SERIE_TEXT, self.GetId()) | |
423 | - my_evt.SetItemData(group) | |
424 | - self.GetEventHandler().ProcessEvent(my_evt) | |
435 | + item_parent = self.tree.GetItemParent(item) | |
436 | + | |
437 | + patient_id = self.tree.GetItemPyData(item_parent) | |
438 | + serie_id = self.tree.GetItemPyData(item) | |
439 | + | |
440 | + hosts = self.GetHostList() | |
441 | + | |
442 | + for key in hosts.keys(): | |
443 | + if key != 0: | |
444 | + dn = dcm_net.DicomNet() | |
445 | + dn.SetHost(self.hosts[key][1]) | |
446 | + dn.SetPort(self.hosts[key][2]) | |
447 | + dn.SetAETitleCall(self.hosts[key][3]) | |
448 | + dn.SetAETitle(self.hosts[0][3]) | |
449 | + dn.RunCMove((patient_id, serie_id)) | |
450 | + #dn.SetSearchWord(self.find_txt.GetValue()) | |
451 | + | |
452 | + #ps.Publisher().sendMessage('Populate tree', dn.RunCFind()) | |
453 | + | |
454 | + | |
455 | + | |
456 | + #my_evt = SelectEvent(myEVT_SELECT_SERIE_TEXT, self.GetId()) | |
457 | + #my_evt.SetItemData(group) | |
458 | + #self.GetEventHandler().ProcessEvent(my_evt) | |
459 | + | |
425 | 460 | |
426 | 461 | def OnSize(self, evt): |
427 | 462 | self.tree.SetSize(self.GetSize()) | ... | ... |
invesalius/invesalius.py
invesalius/net/dicom.py
... | ... | @@ -51,7 +51,7 @@ class DicomNet: |
51 | 51 | tags = [(0x0010, 0x0010), (0x0010, 0x1010), (0x0010,0x0040), (0x0008,0x1030),\ |
52 | 52 | (0x0008,0x0060), (0x0008,0x0022), (0x0008,0x0080), (0x0010,0x0030),\ |
53 | 53 | (0x0008,0x0050), (0x0008,0x0090), (0x0008,0x103E), (0x0008,0x0033),\ |
54 | - (0x0008,0x0032)] | |
54 | + (0x0008,0x0032), (0x0020,0x000d)] | |
55 | 55 | |
56 | 56 | |
57 | 57 | ds = gdcm.DataSet() |
... | ... | @@ -109,6 +109,9 @@ class DicomNet: |
109 | 109 | acquisition_time = utils.format_time(self.GetValueFromDICOM(rt, (0x0008,0x0032))) |
110 | 110 | acquisition_date = utils.format_date(self.GetValueFromDICOM(rt, (0x0008,0x0022))) |
111 | 111 | |
112 | + teste = self.GetValueFromDICOM(rt, (0x0020,0x000d)) | |
113 | + print ">>>>>>>>>>>>>>>>>>>>", teste | |
114 | + | |
112 | 115 | patients[patient_id][serie_id] = {'name':name, 'age':age, 'gender':gender,\ |
113 | 116 | 'study_description':study_description,\ |
114 | 117 | 'modality':modality, \ |
... | ... | @@ -125,3 +128,66 @@ class DicomNet: |
125 | 128 | patients[patient_id][serie_id]['n_images'] += 1 |
126 | 129 | |
127 | 130 | return patients |
131 | + | |
132 | + | |
133 | + def RunCMove(self, values): | |
134 | + | |
135 | + ds = gdcm.DataSet() | |
136 | + | |
137 | + #for v in values: | |
138 | + | |
139 | + | |
140 | + tg_patient = gdcm.Tag(0x0010, 0x0020) | |
141 | + tg_serie = gdcm.Tag(0x0020, 0x000e) | |
142 | + | |
143 | + de_patient = gdcm.DataElement(tg_patient) | |
144 | + de_serie = gdcm.DataElement(tg_serie) | |
145 | + | |
146 | + patient_id = str(values[0]) | |
147 | + serie_id = str(values[1]) | |
148 | + | |
149 | + print "(0x0010, 0x0020)",patient_id | |
150 | + | |
151 | + print "(0x0020, 0x000e)",serie_id | |
152 | + print "\n\n" | |
153 | + | |
154 | + de_patient.SetByteValue(patient_id, gdcm.VL(len(patient_id))) | |
155 | + de_serie.SetByteValue(serie_id, gdcm.VL(len(serie_id))) | |
156 | + | |
157 | + ds.Insert(de_patient) | |
158 | + ds.Insert(de_serie) | |
159 | + | |
160 | + | |
161 | + cnf = gdcm.CompositeNetworkFunctions() | |
162 | + theQuery = cnf.ConstructQuery(gdcm.ePatientRootType, gdcm.eImageOrFrame, ds) | |
163 | + #ret = gdcm.DataSetArrayType() | |
164 | + | |
165 | + """ | |
166 | + CMove (const char *remote, | |
167 | + uint16_t portno, | |
168 | + const BaseRootQuery *query, | |
169 | + | |
170 | + uint16_t portscp, | |
171 | + const char *aetitle=NULL, | |
172 | + const char *call=NULL, | |
173 | + const char *outputdir=NULL)""" | |
174 | + | |
175 | + | |
176 | + | |
177 | + cnf.CMove(self.address, int(self.port), theQuery, 11113, self.aetitle,\ | |
178 | + self.aetitle_call, "/home/phamorim/Desktop/output/") | |
179 | + | |
180 | + | |
181 | + ret = gdcm.DataSetArrayType() | |
182 | + | |
183 | + cnf.CFind(self.address, int(self.port), theQuery, ret, self.aetitle,\ | |
184 | + self.aetitle_call) | |
185 | + | |
186 | + print "aetitle",self.aetitle | |
187 | + print "call",self.aetitle_call | |
188 | + print "Baixados..........." | |
189 | + | |
190 | + | |
191 | + for r in ret: | |
192 | + print r | |
193 | + print "\n" | ... | ... |