def f_stage2callback(**kwargs): str_cwd = os.getcwd() lst_subj = [] for key, val in kwargs.iteritems(): if key == 'subj': lst_subj = val if key == 'obj': stage = val for subj in lst_subj: # find the relevant input files in each <subj> dir os.chdir(subj) l_B0 = misc.find(_str_b0) l_ASL = misc.find(_str_asl) if not l_B0: error.fatal(pipe_hypothermia, 'noB0') if not l_ASL: error.fatal(pipe_hypothermia, 'noASL') _str_B0File = l_B0[0] _str_ASLFile = l_ASL[0] _str_outDir = 'outDir' _str_outFile = 'asl2b0.nii' misc.mkdir(_str_outDir) log = stage.log() log('Scheduling masconorm for "%s: ASL"..\n' % (subj)) str_cmd = 'masconorm.py --input %s/asl2b0.nii.gz --mask %s/b0Brain_mask.nii.gz --outStem %s/asl' % ( _str_outDir, _str_outDir, _str_outDir) #cluster = crun.crun_mosix() cluster = crun.crun() cluster.echo(False) cluster.echoStdOut(False) cluster.detach(False) cluster(str_cmd, waitForChild=True, stdoutflush=True, stderrflush=True) if cluster.exitCode(): error.fatal(pipe_hypothermia, 'stageExec', cluster.stderr()) os.chdir(str_cwd) return True
def f_stage3callback(**kwargs): str_cwd = os.getcwd() lst_subj = [] for key, val in kwargs.iteritems(): if key == 'subj': lst_subj = val if key == 'obj': stage = val for subj in lst_subj: # find the relevant input files in each <subj> dir os.chdir(subj) l_ADC = misc.find(_str_adc) if not l_ADC: error.fatal(pipe_hypothermia, 'noADC') _str_ADCFile = l_ADC[0] _str_outDir = 'outDir' misc.mkdir(_str_outDir) log = stage.log() log('Scheduling masconorm for "%s: ADC"..\n' % (subj)) str_cmd = 'masconorm.py --input %s --mask %s/b0Brain_mask.nii.gz --outStem %s/adc' % ( _str_ADCFile, _str_outDir, _str_outDir) cluster = crun.crun() cluster.echo(False) cluster.echoStdOut(False) cluster.detach(False) cluster(str_cmd, waitForChild=True, stdoutflush=True, stderrflush=True) os.chdir(str_cwd) return True
def f_stage0callback(**kwargs): str_cwd = os.getcwd() lst_subj = [] for key, val in kwargs.iteritems(): if key == 'subj': lst_subj = val if key == 'obj': stage = val for subj in lst_subj: # find the relevant input files in each <subj> dir os.chdir(subj) l_B0 = misc.find(_str_b0) if not l_B0: error.fatal(pipe_hypothermia, 'noB0') _str_B0File = l_B0[0] _str_outDir = '%s/outDir' % os.getcwd() _str_outFile = 'b0Brain.nii' misc.mkdir(_str_outDir) str_prefixCmd = '( cd %s ; ' % (os.getcwd()) log = stage.log() log('Scheduling brain extraction for "%s"...\n' % (subj)) str_cmd = 'bet.py --input %s --output %s/%s' % (_str_B0File, _str_outDir, _str_outFile) #cluster = crun.crun_mosix(cmdPrefix=str_prefixCmd) #cluster = crun.crun_mosix() cluster = crun.crun() #str_ccmd = cluster.echo(True) #log(str_ccmd) cluster.echo(False) cluster.echoStdOut(False) cluster.detach(False) cluster(str_cmd, waitForChild=True, stdoutflush=True, stderrflush=True) if cluster.exitCode(): error.fatal(pipe_hypothermia, 'stageExec', cluster.stderr()) os.chdir(str_cwd) return True