import os

def getPatientId(row,xconfig):
   return row[xconfig['ParticipantField']]

def getVisitId(row,xconfig):
   return row['visitName']

def getCode(row,xconfig):
   return '{}_{}'.format(getPatientId(row,xconfig),getVisitId(row,xconfig))

def getPathList(row,xconfig):
   return [xconfig['baseDir'],getPatientId(row,xconfig),getVisitId(row,xconfig)]

def getOutputDir(row,xconfig):
   return '/'.join(getPathList(row,xconfig))

def getLocalDir(row,xconfig):
   return os.path.join(xconfig['tempDir'],getCode(row,xconfig))

def getNodeName(row,xconfig,mode,i=0):
   if mode=='CT':
      return getCode(row,xconfig)+'_CT'
   if mode=='NM':
      return '{}_Volume{}'.format(getCode(row,xconfig),i)
   return getCode(row,xconfig)+'_Dummy'


