Browse Source

Have preprocess.py look in setup file to figure local postions of matlab, etc.

NIX User 4 years ago
parent
commit
6551f17992
1 changed files with 17 additions and 19 deletions
  1. 17 19
      pythonScripts/preprocess.py

+ 17 - 19
pythonScripts/preprocess.py

@@ -20,49 +20,47 @@ sys.path.insert(0,setup["paths"]["orthancInterface"])
 import orthancInterface
 import orthancFileBrowser
 
-#sys.path.insert(1,shome+'/software/src/IPNUMM/dicomUtils')
-#import loadDicom
+sys.path.insert(1,setup['paths']['analysisInterface'])
+import analysisInterface
 
 
 fconfig=os.path.join(fhome,'.labkey','network.json')
 
-#matlab=os.path.join("/","data","software","install","matlab","bin","matlab")
 matlab=setup["paths"]["matlab"]
-#os.path.join(fhome,"software","install","matlab","bin","matlab")
 generalCodes=setup["paths"]["generalCodes"]
-#ios.path.join(fhome,"software","src","generalCodes")
 niftiTools=setup["paths"]["niftiTools"]
-#niftiTools=os.path.join(fhome,"software","src","NifTiScripts")
 
 net=labkeyInterface.labkeyInterface()
 net.init(fconfig)
 db=labkeyDatabaseBrowser.labkeyDB(net)
 fb=labkeyFileBrowser.labkeyFileBrowser(net)
 
-
 onet=orthancInterface.orthancInterface()
 onet.init(fconfig)
 ofb=orthancFileBrowser.orthancFileBrowser(onet)
 
+parameterFile=sys.argv[1]
+runid=sys.argv[2]
+
+ana=analysisInterface.analysisInterface(db,fb,runid)
+ana.updateStatus(2)
+pars=ana.getParameters(parameterFile)
+
 hi=0
-project='iPNUMMretro/Study'
-#for prospective, set
-project='IPNUMMprospektiva/Study'
-dataset='Imaging1'
+project=pars['Database']['project']
+dataset=pars['Database']['queryName']
+schema=pars['Database']['schemaName']
+
 tempBase=os.path.join(fhome,'temp')
 
 
-participantField='PatientId'
-#for prospective set
-participantField='ParticipantId'
+participantField=pars['Database']['participantField']
 
 #all images from database
-ds=db.selectRows(project,'study',dataset,[])
-#imageSelector={"CT":"CT","PET":"PETWB"};
+ds=db.selectRows(project,schema,dataset,[])
 imageSelector={"CT":"CT_orthancId","PET":"PETWB_orthancId"}
 imageResampledField={"CT":"ctResampled","PET":"petResampled"}
 
-#projectNIfTIBase=os.path.join(labkeyBase,'files',project,'@files/nifti')
 #use webdav to transfer file (even though it is localhost)
 
 
@@ -145,7 +143,7 @@ def updateRow(project,dataset,row,imageResampledField,gzFileNames,\
     db.modifyRows('update',project,'study',dataset,[row])
  
 
-
+ana.updateStatus(3)
 i=0
 for row in ds["rows"]:
 
@@ -248,5 +246,5 @@ for row in ds["rows"]:
         break
     i=i+1
 
-
+ana.updateStatus(4)
 print("Done")