|
@@ -95,56 +95,70 @@ def listRequiredFiles(stage,r,setup,db=None):
|
|
|
return {}
|
|
|
|
|
|
def listCreatedFiles(stage,r,setup):
|
|
|
- code=config.getCode(r,setup)
|
|
|
- nclass=setup['nclass'][0]
|
|
|
- qLambda=getRobust(setup,'qLambda')
|
|
|
- qLambdaC=getRobust(setup,'qLambdaC')
|
|
|
- nr=setup['nr']
|
|
|
- nseg=getRobust(setup,'nseg')
|
|
|
- names={}
|
|
|
+ code=config.getCode(r,setup)
|
|
|
+ nclass=setup['nclass'][0]
|
|
|
+ qLambda=getRobust(setup,'qLambda')
|
|
|
+ qLambdaC=getRobust(setup,'qLambdaC')
|
|
|
+ nr=setup['nr']
|
|
|
+ nseg=getRobust(setup,'nseg')
|
|
|
+ print(f'List created files nseg={nseg}')
|
|
|
+ names={}
|
|
|
+ getPattern=config.getPattern
|
|
|
|
|
|
- if stage=='setCenters':
|
|
|
- names['center']=[]
|
|
|
- for ir in range(nr):
|
|
|
- rel=[config.getPattern('center',code=code,nclass=nclass,ir=ir,ic=i) for i in range(nclass)]
|
|
|
- names['center'].extend(rel)
|
|
|
- #rel=[config.getPattern('centerWeight',code=code,nclass=nclass,ir=ir,ic=i) for i in range(nclass)]
|
|
|
- #names['center'].extend(rel)
|
|
|
- names['center'].append(config.getPattern('centerMap',code=code,nclass=nclass,ir=ir))
|
|
|
- rel=[config.getPattern('centerNRRD',code=code,nclass=nclass,ir=ir,qaName=x) for x in ['CT','SPECT']]
|
|
|
- names['center'].extend(rel)
|
|
|
+ if stage=='setCenters':
|
|
|
+ names['center']=[]
|
|
|
+ for ir in range(nr):
|
|
|
+ rel=[getPattern('center',code=code,nclass=nclass,ir=ir,ic=i) for i in range(nclass)]
|
|
|
+ names['center'].extend(rel)
|
|
|
+ #rel=[config.getPattern('centerWeight',code=code,nclass=nclass,ir=ir,ic=i) for i in range(nclass)]
|
|
|
+ #names['center'].extend(rel)
|
|
|
+ names['center'].append(getPattern('centerMap',code=code,nclass=nclass,ir=ir))
|
|
|
+ rel=[getPattern('centerNRRD',code=code,nclass=nclass,ir=ir,qaName=x) for x in ['CT','SPECT']]
|
|
|
+ names['center'].extend(rel)
|
|
|
|
|
|
- return names
|
|
|
- if stage=='fitIVF':
|
|
|
- names['fitIVF']=[]
|
|
|
- for ir in range(nr):
|
|
|
- names['fitIVF'].append(config.getPattern('fitIVF',code=code,nclass=nclass,ir=ir,qLambda=qLambda))
|
|
|
- return names
|
|
|
- if stage=='plotIVF':
|
|
|
- names['plotIVF']=[]
|
|
|
- for ir in range(nr):
|
|
|
- x=[config.getPattern('plotIVF',code=code,nclass=nclass,ir=ir,qaName=y,qLambda=qLambda)
|
|
|
- for y in ['fits','diff','generatedIVF','centerIVFSPECT','centerIVFCT']]
|
|
|
- names['plotIVF'].extend(x)
|
|
|
- return names
|
|
|
- if stage=='fitCompartment':
|
|
|
- xc='fitCompartment'
|
|
|
- names[xc]=[]
|
|
|
- sNames=['kmeansFit','localFit','kmeansTAC','localTAC']
|
|
|
- for ir in range(nr):
|
|
|
- for iseg in range(nseg):
|
|
|
- rel=[config.getPattern(xc,code=code,nclass=nclass,ir=ir,qaName=qn,iseg=iseg,qLambda=qLambda,qLambdaC=qLambdaC) for qn in sNames]
|
|
|
- names[xc].extend(rel)
|
|
|
- if stage=='plotCompartment':
|
|
|
- xc='plotCompartment'
|
|
|
- names[xc]=[]
|
|
|
- sNames=['realizations','diff']
|
|
|
- for ir in range(nr):
|
|
|
- for iseg in range(nseg):
|
|
|
- rel=[config.getPattern(xc,code=code,nclass=nclass,ir=ir,qaName=qn,iseg=iseg,qLambda=qLambda,qLambdaC=qLambdaC) for qn in sNames]
|
|
|
- names[xc].extend(rel)
|
|
|
+ return names
|
|
|
+ if stage=='fitIVF':
|
|
|
+ names['fitIVF']=[]
|
|
|
+ for ir in range(nr):
|
|
|
+ names['fitIVF'].append(getPattern('fitIVF',code=code,nclass=nclass,ir=ir,qLambda=qLambda))
|
|
|
+ return names
|
|
|
+
|
|
|
+
|
|
|
+ if stage=='plotIVF':
|
|
|
+ names['plotIVF']=[]
|
|
|
+ sNames=['fits','diff','generatedIVF','centerIVFSPECT','centerIVFCT']
|
|
|
+ for ir in range(nr):
|
|
|
+ x=[getPattern('plotIVF',code=code,nclass=nclass,ir=ir,qaName=y,qLambda=qLambda) for y in sNames]
|
|
|
+ names['plotIVF'].extend(x)
|
|
|
+ return names
|
|
|
+
|
|
|
+
|
|
|
+ if stage=='fitCompartment':
|
|
|
+ xc='fitCompartment'
|
|
|
+ names[xc]=[]
|
|
|
+ sNames=['kmeansFit','localFit','kmeansTAC','localTAC']
|
|
|
+ for ir in range(nr):
|
|
|
+ for iseg in range(nseg):
|
|
|
+ _q=qLambda
|
|
|
+ _qC=qLambdaC
|
|
|
+ rel=[getPattern(xc,code=code,nclass=nclass,ir=ir,qaName=qn,iseg=iseg,qLambda=_q,qLambdaC=_qC) for qn in sNames]
|
|
|
+ names[xc].extend(rel)
|
|
|
+ return names
|
|
|
+
|
|
|
+ if stage=='plotCompartment':
|
|
|
+ xc=stage
|
|
|
+ names[xc]=[]
|
|
|
+ sNames=['realizations','diff']
|
|
|
+ for ir in range(nr):
|
|
|
+ for s in range(nseg):
|
|
|
+ iseg=s+1
|
|
|
+ _q=qLambda
|
|
|
+ _qC=qLambdaC
|
|
|
+ rel=[getPattern(xc,code=code,nclass=nclass,ir=ir,qaName=qn,iseg=iseg,qLambda=_q,qLambdaC=_qC) for qn in sNames]
|
|
|
+ names[xc].extend(rel)
|
|
|
+ return names
|
|
|
|
|
|
- return []
|
|
|
+ return []
|
|
|
|
|
|
|
|
|
def getRequiredFiles(stage,r,setup,fb,names=None,db=None):
|
|
@@ -372,6 +386,7 @@ def workflow(r,setup,stage,fb=None,db=None):
|
|
|
nclass=setup['nclass'][0]
|
|
|
code=config.getCode(r,setup)
|
|
|
setup['nseg']=len(segmentIds)
|
|
|
+ print('Setting setup[nseg]={}'.format(setup['nseg']))
|
|
|
t,dt=loadData.loadTime(r,setup)
|
|
|
for iseg in segmentIds:
|
|
|
m,samplesC=loadData.readSamples(r,setup,'kmeansFit',ir=ir,iseg=iseg,qLambda=qLambda,qLambdaC=qLambdaC)
|
|
@@ -396,14 +411,16 @@ def workflow(r,setup,stage,fb=None,db=None):
|
|
|
row['mean']=k1
|
|
|
row['std']=stdK1
|
|
|
row['regionId']=iseg
|
|
|
- row['fitPlot']=config.getPattern(tag,code=code,ir=0,nclass=nclass,qaName='realizations',iseg=iseg,qLambda=qLambda,qLambdaC=qLambdaC)
|
|
|
- row['diffPlot']=config.getPattern(tag,code=code,ir=0,nclass=nclass,qaName='diff',iseg=iseg,qLambda=qLambda,qLambdaC=qLambdaC)
|
|
|
+ row['qLambda']=qLambda
|
|
|
+ row['qLambdaC']=qLambdaC
|
|
|
+ row['fitPlot']=config.getPattern(tag,code=code,ir=0,nclass=nclass,qaName='realizations',\
|
|
|
+ iseg=iseg,qLambda=qLambda,qLambdaC=qLambdaC)
|
|
|
+ row['diffPlot']=config.getPattern(tag,code=code,ir=0,nclass=nclass,qaName='diff',\
|
|
|
+ iseg=iseg,qLambda=qLambda,qLambdaC=qLambdaC)
|
|
|
row1={x:row[x] for x in row}
|
|
|
row1['option']='localFit'
|
|
|
row1['mean']=k11
|
|
|
row1['std']=stdK11
|
|
|
- row['qLambda']=qLambda
|
|
|
- row['qLambdaC']=qLambdaC
|
|
|
if db:
|
|
|
db.modifyRows('insert',setup['project'],'lists','Summary',[row,row1])
|
|
|
|
|
@@ -416,7 +433,8 @@ def workflow(r,setup,stage,fb=None,db=None):
|
|
|
plotData.plotSamples(t,evalArray,file0=file0,file1=file1)
|
|
|
|
|
|
|
|
|
-
|
|
|
+ nseg=getRobust(setup,'nseg')
|
|
|
+ print(f'At upload nseg={nseg}')
|
|
|
uploadCreatedFiles(stage,fb,r,setup)
|
|
|
#setup could be modified
|
|
|
return setup
|