set(basedirout 'F:/Data/Atlas/Data/Normal/Outputs/') listdirindir(directories '$(basedirout)') set(listFile_white '') set(listFile_grey '') foreach(subject ${directories}) set(fullpath '${basedirout}${subject}') listdirindir(dir_t1 '${fullpath}' T1) listfileindir(t1_mask_white '${fullpath}${dir_t1}' subject0*_t1_brain_white.mha) listfileindir(t1_mask_grey '${fullpath}${dir_t1}' subject0*_t1_brain_grey.mha) set(t1_mask_white '${fullpath}${dir_t1}${t1_mask_white}') set(t1_mask_grey '${fullpath}${dir_t1}${t1_mask_grey}') set(listFile_white '${listFile_white} ${t1_mask_white}') set(listFile_grey '${listFile_grey} ${t1_mask_grey}') endforeach(subject) #echo(${listFile_white}) Set(filename ${basedirout}STAPLE_white.odc) Run(output '${ObjectDocumentBuilder} -in ${listFile_white} -out ${filename}') #echo(${listFile_grey}) Set(filename ${basedirout}STAPLE_grey.odc) Run(output '${ObjectDocumentBuilder} -in ${listFile_grey} -out ${filename}') listFileInDir(ODC_white ${basedirout} STAPLE_white.odc) listFileInDir(ODC_grey ${basedirout} STAPLE_grey.odc) Set(ODC_white ${basedirout}${ODC_white}) Set(ODC_grey ${basedirout}${ODC_grey}) SetApp(STAPLEcor @STAPLECorrection) SetAppOption(STAPLEcor.inODC.filename ${ODC_white}) Set(filename ${basedirout}STAPLE_white.mha) SetAppOption(STAPLEcor.Output.filename ${filename}) SetAppOption(STAPLEcor.Foreground.value 1) echo(${STAPLEcor}) Run(output ${STAPLEcor}) SetApp(STAPLEcor2 @STAPLECorrection) SetAppOption(STAPLEcor2.inODC.filename ${ODC_grey}) Set(filename ${basedirout}STAPLE_grey.mha) SetAppOption(STAPLEcor2.Output.filename ${filename}) SetAppOption(STAPLEcor2.Foreground.value 1) echo(${STAPLEcor2}) Run(output ${STAPLEcor2})