Script to align a subject structural data with large lesion lesions to a template and invert the warps to compute the segmentation in the subject's original, native space. This program uses basic AFNI commands to compute affine and nonlinear alignments. The program works by first aligning centers of the subject to that of the template. Affine and nonlinear alignment follow. The inverse warp is computed to bring the template and atlas segmentation into the center-shifted grid. Skullstripping is provided by masking with the template. Finally, the grids are adjusted back to the original center. Mirrored brains with "repaired" lesions are also computed.
lesion_align -input Subj2+orig \ -base MNI152_T1_2009c+tlrc \ -atlas MNI_Glasser_HCP_v1.0.nii.gz \ -outdir lesion_align -goodside right Note only the input dset and template_dset are required. If no segmentation is given, then only the alignment steps are performed.
-input dset :required input dataset to align to template -goodside left/right/both : specify good side of brain -base base_dataset :required template. Can be in a standard AFNI location or fully specified path. Note, if the template has no skull, then a masked (skullstripped) version of the input is produced in the output -atlas atlas_dataset :atlas can also be in a standard AFNI location or fully specified -outdir outputdir :create new directory and do all processing there. Default is template_align -template_prefix templatename :select name for template and segmentation for output naming. Uses template space of template if available in template header -seg_followers segdset1 segdset2 ... :warp related datasets back to native space -cost costfunction :cost function for affine transformation. Default is lpa. Choose nmi, lpa+ZZ, cru for noisy or difficult datasets. See 3dAllineate help for more information. -lesion_mask ldset :provide lesion mask as input dataset. Used to determine bad and good sides -center_split :split input dataset on left-right center for affine alignment keeping either the left or right side for the computation. Nonlinear alignment uses the full dataset -maxlev nn :maximum level for nonlinear warping. Determines neighborhood size that is searched. See 3dQwarp help for information on maxlev. Default is 11. Use smaller values for testing -no_unifize :turn off unifizing for mirror/heal output -keep_temp :keep temporary files including awpy directory and other intermediate datasets -ok_to_exist :reuse and do not overwrite existing datasets. This option is used for faster restarts or with limited alignment options
The following quality control (QC) images are automatically generated during processing, to help with speedy checking of processing. In each case, there are three sets of montages (one for sag, cor and axi views) and a copy of the colorbar used (same prefix as file name, *.jpg). Additionally, there is also a *.txt file of ranges of values related to the ulay and olay, which might be useful for QC or figure-generation. Inside the output directory is a subdirectory called QC/ that contains the following semi-cryptically named files: qc_00_e_temp+wrpd_inp.* [ulay] edges of the template (in template space) [olay] warped input dset qc_01_e_wrpd_temp+orig_inp.* [ulay] edges of the template (warped to orig space) [olay] original input dset qc_02_orig_inp+mask.* [ulay] original input dset (in orig space) [olay] estimated mask, showing skullstripping qc_03_ee_orig_inp+wrpd_atlas.* [ulay] 'edge enhanced' original input dset (in orig space) [olay] warped atlas dset
Please cite: Maallo, AMS, et al. Large-scale resculpting of cortical circuits in children after surgical resection. Sci Rep 10, 21589 (2020). https://doi.org/10.1038/s41598-020-78394-z For questions about this program, please ask on AFNI message board or email glend at mail.nih.gov