SSwarper2 with residual scalp

AFNI version info (afni -ver): Version AFNI_25.0.03
Hi,

I encountered one issue while running sswarper2. In one subject, there is residual scalp tissue on the left side of the brain. It seems that this extra scalp tissue is being treated as brain during the warping process and is pulled into the intracranial area. This then leads to poor EPI-anatomical alignment and an incorrect final mask, with part of the cortical EPI coverage being excluded. I also tried -post_aff_tol 2 \ which didn't help much.

Steven

#!/usr/bin/env bash

BASE=$HOME/abin/MNI152_2009_template_SSW.nii.gz

cd ~/Data/steven/AFNI_PD/bids/sub-020/ses-postop/anat

sswarper2                                           \
    -input sub-020_ses-postop_T1w.nii.gz           \
    -base  $BASE                                   \
    -subid sub_020_ses_postop                      \
    |& tee log.ssw.sub_020_ses_postop.txt

I exported the sswarper2 brain mask (anatss_mask) and found that a portion of the left scalp had been included in the mask. After manually editing the mask in 3D Slicer to remove the non-brain tissue, I resampled it back to the anatU grid and reran sswarper2 using the corrected mask (via the -mask_ss option). The resulting skull-stripped anatomy and template alignment were substantially improved, and the subsequent afni_proc.py pipeline completed successfully.