|  | @@ -102,6 +102,54 @@ def decode(code,xconfig):
 | 
	
		
			
				|  |  |     vid=values[1]
 | 
	
		
			
				|  |  |     return {getPatientField(xconfig):fid,getVisitField(xconfig):vid}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +#standardized file names
 | 
	
		
			
				|  |  | +def getPattern(ftype,code,nclass=0,ir=0,ic=0,fitType='global',qaName='fits',timepoint=0,iseg=0,qLambda=0):
 | 
	
		
			
				|  |  | +   qLambdaString='{:.3f}'.format(qLambda).replace('.','p')
 | 
	
		
			
				|  |  | +   replacePatterns={
 | 
	
		
			
				|  |  | +      '_code_':code,
 | 
	
		
			
				|  |  | +      '_nclass_':nclass,
 | 
	
		
			
				|  |  | +      '_ir_':ir,
 | 
	
		
			
				|  |  | +      '_ic_':ic,
 | 
	
		
			
				|  |  | +      '_fitType_':fitType,
 | 
	
		
			
				|  |  | +      '_qaName_':qaName,
 | 
	
		
			
				|  |  | +      '_timepoint_':timepoint,
 | 
	
		
			
				|  |  | +      '_iseg_':iseg,
 | 
	
		
			
				|  |  | +      '_qLambda_':qLambdaString}
 | 
	
		
			
				|  |  | +   map={'CT':'_code__CT.nrrd',
 | 
	
		
			
				|  |  | +      'SPECT':'_code__Volume_timepoint_.nrrd',
 | 
	
		
			
				|  |  | +      'Dummy':'_code__Dummy.mcsv',
 | 
	
		
			
				|  |  | +      'centerMap':'_code___nclass___ir__centerMap.txt',
 | 
	
		
			
				|  |  | +      'centerWeight':'_code___nclass___ir__center_ic__centerWeight.nrrd',
 | 
	
		
			
				|  |  | +      'centerNRRD':'_code___nclass___ir__centerMap__qaName_.nrrd',
 | 
	
		
			
				|  |  | +      'center':'_code___nclass___ir__center_ic__center.txt',
 | 
	
		
			
				|  |  | +      'fitParFinal':'_code___nclass___ir___fitType__fitParFinal.txt',
 | 
	
		
			
				|  |  | +      'fitPNG':'_code___nclass___ir___fitType__centers_ic_.png',
 | 
	
		
			
				|  |  | +      'pixelFitParFinal':'_code___nclass___ir__Pixel__fitType__fitParFinal.txt',
 | 
	
		
			
				|  |  | +      'pixelFitPNG':'_code___nclass___ir__Pixel__fitType__centers_ic_.png',
 | 
	
		
			
				|  |  | +      'fitIVF':'_code___nclass___ir___qLambda__fitParIVF.txt',
 | 
	
		
			
				|  |  | +      'plotIVF':'_code___nclass___ir___qLambda__plotIVF__qaName_.png',
 | 
	
		
			
				|  |  | +      'fitCompartment':'_code___nclass___ir___qLambda__fitCompartment__iseg___qaName_.txt',
 | 
	
		
			
				|  |  | +      'plotCompartment':'_code___nclass___ir___qLambda__plotCompartment__iseg___qaName_.png'}
 | 
	
		
			
				|  |  | +   w=map[ftype]
 | 
	
		
			
				|  |  | +   for x in replacePatterns:
 | 
	
		
			
				|  |  | +      w=re.sub(x,'{}'.format(replacePatterns[x]),w)
 | 
	
		
			
				|  |  | +   return w
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#pixels corresponding to a particular c-means class
 | 
	
		
			
				|  |  | +def getCenterWeight(r,setup,nclass,ir,i):
 | 
	
		
			
				|  |  | +   code=getCode(r,setup)
 | 
	
		
			
				|  |  | +   return f'{code}_{nclass}_{ir}_center{i}_centerWeight.nrrd'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#1D TAC for a particular group center 
 | 
	
		
			
				|  |  | +def getCenter(r,setup,nclass,ir,i):
 | 
	
		
			
				|  |  | +   code=getCode(r,setup)
 | 
	
		
			
				|  |  | +   return f'{code}_{nclass}_{ir}_center{i}_center.txt'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#all names for determination of TAC, obsolete
 | 
	
		
			
				|  |  |  def printRowCenterNames(r,setup):
 | 
	
		
			
				|  |  |     names=[]
 | 
	
		
			
				|  |  |     nr=setup['nr']
 | 
	
	
		
			
				|  | @@ -111,11 +159,12 @@ def printRowCenterNames(r,setup):
 | 
	
		
			
				|  |  |     for nc in nclass:
 | 
	
		
			
				|  |  |        for j in range(nr):
 | 
	
		
			
				|  |  |           for i in range(nc): 
 | 
	
		
			
				|  |  | -            fCode='{}_{}_{}_center{}'.format(code,nc,j+1,i+1)
 | 
	
		
			
				|  |  | -            names.append('{}_center.txt'.format(fCode))
 | 
	
		
			
				|  |  | -            names.append('{}_centerWeight.nrrd'.format(fCode))
 | 
	
		
			
				|  |  | +            names.append(getCenter(r,setup,nc,j+1,i+1))
 | 
	
		
			
				|  |  | +            names.append(getCenterWeight(r,setup,nc,j+1,i+1))
 | 
	
		
			
				|  |  |     return names
 | 
	
		
			
				|  |  | - 
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#fit of a compartment 
 | 
	
		
			
				|  |  |  def getFitParFinalName(code,nc,j,aType):
 | 
	
		
			
				|  |  |     fCode='{}_{}_{}'.format(code,nc,j+1)
 | 
	
		
			
				|  |  |     if aType!='global':
 | 
	
	
		
			
				|  | @@ -123,6 +172,19 @@ def getFitParFinalName(code,nc,j,aType):
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     return '{}_fitParFinal.txt'.format(fCode)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +#fit of the IVF
 | 
	
		
			
				|  |  | +def getFitIVFParName(r,setup,nc,j):
 | 
	
		
			
				|  |  | +   code=getCode(r,setup)
 | 
	
		
			
				|  |  | +   fCode='{}_{}_{}'.format(code,nc,j+1)
 | 
	
		
			
				|  |  | +   return f'{fCode}_fitParIVF.txt' 
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#status report of the IVF fit (three images)
 | 
	
		
			
				|  |  | +def getFitIVFReportPNG(r,setup,nc,j,name):
 | 
	
		
			
				|  |  | +   code=getCode(r,setup)
 | 
	
		
			
				|  |  | +   fCode=f'{code}_{nc}_{j+1}_fitParIVF_{name}.png'
 | 
	
		
			
				|  |  | +   return fCode
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#
 | 
	
		
			
				|  |  |  def getFitPNGNames(code,nc,j,aType):
 | 
	
		
			
				|  |  |     if aType=='global':
 | 
	
		
			
				|  |  |        return []
 |