floIm = os.path.join(itDir, 'T1MD.nii.gz') resIm = os.path.join(itDir, 'T1_MD_Regged.nii.gz') affIn = os.path.join(topDir, 'aff.txt') cppName = os.path.join(itDir, 'trans.cpp.nii') segResName = os.path.join(nextDir, 'Segs_diffspace.nii.gz') maskOutName = os.path.join(nextDir, 'T1_Brain_mask.nii.gz') if os.path.isdir(itDir) and not os.path.isdir(nextDir) and os.path.isfile( floIm): os.mkdir(nextDir) if not os.path.isfile(resIm) and os.path.isfile(floIm): other_args = '-rmask ' + rMask DPD.NR_reg(refIm, floIm, cppName, resIm, dbg=False, other_args=other_args) ## This is for when we don't want to keep resampling the matrix T1segName = os.path.join(itDir, 'T1_Segmentation.nii.gz') T1tmpName = os.path.join(itDir, 'T1_Segmentation_Regged.nii.gz') T1MaskName = os.path.join(itDir, 'T1_Brain_mask.nii.gz') MaskTempName = os.path.join(itDir, 'T1_Brain_Mask_Regged.nii.gz') NextT1SegName = os.path.join(nextDir, 'T1_Segmentation.nii.gz') if (not os.path.isfile(segResName)) and os.path.isfile(cppName): DPD.reg_resample(refIm, T1segName,