|
@@ -6,6 +6,8 @@ import slicer
|
|
|
import subprocess
|
|
|
import shutil
|
|
|
|
|
|
+#for all rows in xconfig[queryName] import dicom and convert to nrrd
|
|
|
+
|
|
|
def main(configFile):
|
|
|
print('Running with {}'.format(configFile))
|
|
|
with open(configFile) as f:
|
|
@@ -28,9 +30,15 @@ def main(configFile):
|
|
|
import orthancInterface
|
|
|
import orthancDatabaseBrowser
|
|
|
import orthancFileBrowser
|
|
|
+
|
|
|
+#one should be smart to figure this out if pwd is not the same as the directory of the script
|
|
|
|
|
|
- sys.path.append('../pythonScripts')
|
|
|
+ pwd=os.path.dirname(os.path.abspath(__file__))
|
|
|
+ pwdUp=os.path.dirname(pwd)
|
|
|
+ pythonScripts=os.path.join(pwdUp,'pythonScripts')
|
|
|
+ sys.path.append(pythonScripts)
|
|
|
import config
|
|
|
+ print('Config loaded')
|
|
|
|
|
|
net=labkeyInterface.labkeyInterface()
|
|
|
fnet=os.path.join(os.path.expanduser('~'),'.labkey',xconfig['network'])
|
|
@@ -151,10 +159,17 @@ def clearUnzipDir(r,xconfig):
|
|
|
|
|
|
def downloadAndUnzip(ofb,r,code,xconfig):
|
|
|
import config
|
|
|
+
|
|
|
+ pathList=xconfig['tempDir'].split('/')
|
|
|
+ pathList.insert(0,os.path.expanduser('~'))
|
|
|
+ tempDir=os.path.join(*pathList)
|
|
|
+ if not os.path.isdir(tempDir):
|
|
|
+ print('Creating {}'.format(tempDir))
|
|
|
+ os.makedirs(tempDir)
|
|
|
|
|
|
orthancId=r[code+'OrthancId']
|
|
|
fileCode='{}_{}'.format(config.getCode(r,xconfig),code)
|
|
|
- zipFile=os.path.join(xconfig['tempDir'],fileCode+'.zip')
|
|
|
+ zipFile=os.path.join(tempDir,fileCode+'.zip')
|
|
|
ofb.getZip('series',orthancId,zipFile)
|
|
|
zipDir=clearUnzipDir(r,xconfig)
|
|
|
|
|
@@ -167,7 +182,6 @@ def downloadAndUnzip(ofb,r,code,xconfig):
|
|
|
return zipDir
|
|
|
|
|
|
def addCT(r,patient,xconfig):
|
|
|
- sys.path.append('../pythonScripts')
|
|
|
import config
|
|
|
import vtkInterface
|
|
|
ct=patient['CT']
|