External Email - Use Caution        

Freesurfer8.0

Hi all, 

I’m trying to get stats using the HCPex atlas and I’m having issues with creating the HCPex_in_T1.mgz file. When I open it in Freeview it is misaligned or missing portions. I’m wondering if anyone can offer any advice, or may even know of an HCPex annot file in fsaverage space to avoid all of this. This is after several iterations of unsuccessful scripts, so perhaps there is a much simpler way to attempt this. Any help is greatly appreciated!

Thank you, Carly

Script:


set subject_list = ( 2090 )


foreach subj ( $subject_list )

  echo "==== Processing subject $subj ===="

  set subj_dir = "${SUBJECTS_DIR}/${subj}"
  set mri_dir  = "${subj_dir}/mri"
  set stats_dir = "${subj_dir}/stats"

  set t1   = "${mri_dir}/T1.mgz"
  set brain = "${mri_dir}/brain.mgz"
  set seg  = "${mri_dir}/HCPex_in_T1.mgz"
  set stats = "${stats_dir}/HCPex_1mm.stats"
  set lta  = "${mri_dir}/MNI2009c_from_${subj}.lta"



# --- Step 1: Build (or reuse) LTA transform: subject brain -> MNI brain

  if ( ! -e "$lta" ) then
    echo "[INFO] Creating LTA for $subj (brain -> MNI)..."
    mri_robust_register \
      --mov "$brain" \
      --dst "$MNI_BRAIN" \
      --lta "$lta" \
      --cost NMI --satit
  else
    echo "[INFO] Using existing LTA: $lta"
  endif

# --- Step 2: Warp HCPex atlas (MNI) into subject T1 using inverse of that LTA
  echo "[INFO] Warping HCPex atlas to subject T1 for $subj..."

  # Bake src/trg geometry into the LTA so mri_vol2vol 8.0.0 applies it correctly
  set lta_fixed = "${mri_dir}/MNI2009c_from_${subj}.fixed.lta"
  if ( ! -e "$lta_fixed" ) then
    lta_convert \
      --inlta "$lta" \
      --src "$MNI_BRAIN" \
      --trg "$brain" \
      --outlta "$lta_fixed"
  endif

  mri_vol2vol \
    --mov "$HCPex_ATLAS" \
    --targ "$t1" \
    --lta "$lta_fixed" \
    --inv \
    --interp nearest \
    --o "$seg"


# Step 3: Warp HCPex atlas (MNI) into subject T1 using inverse LTA
  mri_vol2vol \
    --mov "$HCPex_ATLAS" \
    --targ "$t1" \
    --lta "$lta_fixed" \
    --inv \
    --interp nearest \
    --o "$seg"


end