Registration of the FA image to the T1 image -------------------------------------------- Register the FA image to the T1 image and generate a 'cortex_whitematter-mask' and 'cortex_gyri-labels' in the FA space. It also generate seed regions to compute the connectivity matrix in the FA space in the 'gyri' folder. """ cortex_outdir = os.path.join(outdir, "cortex") if not os.path.isdir(cortex_outdir): os.mkdir(cortex_outdir) if len(os.listdir(cortex_outdir)) == 0: mask_file, label_file, seeds, reg_file, trf_file = cortex( t1_file, fsdir, cortex_outdir, dest_file=fa_file, generate_mask=True, generate_seeds=True) else: seeds_outdir = os.path.join(cortex_outdir, "gyri") reg_file = os.path.join(cortex_outdir, "cortex_dest_to_t1.nii.gz") mask_file = os.path.join(cortex_outdir, "cortex_mask.nii.gz") label_file = os.path.join(cortex_outdir, "cortex_gyri_labels.nii.gz") for restored_file in [reg_file, mask_file]: if not os.path.isfile(restored_file): raise IOError("FileDoesNotExist: '{0}'.".format(restored_file)) if not os.path.isdir(seeds_outdir): raise IOError("DirectoryDoesNotExist: '{0}'.".format(seeds_outdir)) seeds = [os.path.join(seeds_outdir, name) for name in os.listdir(seeds_outdir)]
""" Registration of the FA image to the T1 image -------------------------------------------- Register the FA image to the T1 image and generate a 'cortex_whitematter-mask' and 'cortex_gyri-labels' in the FA space. It also generate seed regions to compute the connectivity matrix in the FA space in the 'gyri' folder. """ cortex_outdir = os.path.join(outdir, "cortex") if not os.path.isdir(cortex_outdir): os.mkdir(cortex_outdir) if len(os.listdir(cortex_outdir)) == 0: mask_file, _, _, reg_file, trf_file = cortex(t1_file, fsdir, cortex_outdir, dest_file=fa_file, generate_mask=True, generate_seeds=False) if use_t1_space: _, label_file, _, _, _ = cortex(t1_file, fsdir, cortex_outdir, generate_mask=False, generate_seeds=False) else: reg_file = os.path.join(cortex_outdir, "cortex_dest_to_t1.nii.gz") trf_file = os.path.join(cortex_outdir, "cortex_dest_to_t1.trf") mask_file = os.path.join(cortex_outdir, "cortex_mask.nii.gz") label_file = os.path.join(cortex_outdir, "cortex_gyri_labels.nii.gz") for restored_file in [reg_file, trf_file, mask_file, label_file]:
Registration of the FA image to the T1 image -------------------------------------------- Register the FA image to the T1 image and generate a 'cortex_whitematter-mask' and 'cortex_gyri-labels' in the FA space. It also generate seed regions to compute the connectivity matrix in the FA space in the 'gyri' folder. """ cortex_outdir = os.path.join(outdir, "cortex") if not os.path.isdir(cortex_outdir): os.mkdir(cortex_outdir) if len(os.listdir(cortex_outdir)) == 0: mask_file, _, _, reg_file, trf_file = cortex( t1_file, fsdir, cortex_outdir, dest_file=fa_file, generate_mask=True, generate_seeds=False) if use_t1_space: _, label_file, _, _, _ = cortex( t1_file, fsdir, cortex_outdir, generate_mask=False, generate_seeds=False) else: reg_file = os.path.join(cortex_outdir, "cortex_dest_to_t1.nii.gz") trf_file = os.path.join(cortex_outdir, "cortex_dest_to_t1.trf") mask_file = os.path.join(cortex_outdir, "cortex_mask.nii.gz")