loadPatient.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import slicer
  2. import loadDicom
  3. import re
  4. import slicerNetwork
  5. import os
  6. import subprocess
  7. fValue=loadDicom.dicomValue
  8. dicomModify="/afs/f9.ijs.si/home/studen/software/install/"
  9. dicomModify+="dicomModify/bin/dicomModify"
  10. class loadPatient(slicer.ScriptedLoadableModule.ScriptedLoadableModule):
  11. def __init__(self,parent):
  12. slicer.ScriptedLoadableModule.ScriptedLoadableModule.__init__(self, parent)
  13. self.className="loadPatient"
  14. self.parent.title="loadPatient"
  15. class loadPatientLogic(slicer.ScriptedLoadableModule.ScriptedLoadableModuleLogic):
  16. def __init__(self,parent):
  17. slicer.ScriptedLoadableModule.ScriptedLoadableModuleLogic.__init__(self, parent)
  18. #self.plugin=slicer.modules.dicomPlugins['DicomRtImportExportPlugin']()
  19. #self.volumePlugin=slicer.modules.dicomPlugins['DICOMScalarVolumePlugin']()
  20. self.dicomLoader=loadDicom.loadDicomLogic(self)
  21. #self.rtReader=slicer.vtkSlicerDicomRtReader()
  22. #start SSL/TLS configuration
  23. def setURIHandler(self, net):
  24. self.sNet=net
  25. def load(self,label):
  26. #clear previous data
  27. debug=True
  28. loadDicom.clearNodes()
  29. containerPath='Matej/studija'
  30. subFolder=''
  31. dirUrl=containerPath+"/@files"+subFolder
  32. dir=os.path.join(dirUrl,label)
  33. #load segmentations
  34. rs=dir+"/RS/DICOM";
  35. self.dicomLoader.load(self.sNet,rs)
  36. rsMatch='None'
  37. dataset="ImagingVisitsManaged"
  38. fSet=self.sNet.filterDataset(containerPath,dataset,'EMBRACE_ID',label)
  39. fData=fSet['rows']
  40. for r in fData:
  41. if r['type']!='RS':
  42. continue
  43. row=r
  44. if row['rsMatch']==None:
  45. return
  46. if row['rsMatch']=='NONE':
  47. return
  48. dicomDir=dir+'/'+row['rsMatch']+'/DICOM'
  49. if debug:
  50. print "Loading {}".format(dicomDir)
  51. self.dicomLoader.load(self.sNet,dicomDir)