Sorry, it is too hard to try to read your code to figure out what is  going on. Is is possible that you are passing surface data into the volume  (mni305) analysis?

On 6/16/2021 11:51 AM, Pedersen, Walker Scott wrote:
I am trying to use fsfast to analyze task-based functional data output by fmriprep. The subcorticals seem to be working, but I am having trouble with the surfaces. One thing I have noticed before running any fsfast code, when I load the surfaces output by fmriprep into freeview (overlaid onto the fsaverage ?h.inflated) both the *space-fsaverage_hemi-L_bold.func.gii and *space-fsaverage_hemi-R_bold.func.gii get overlaid onto the rh.inflated surface, instead of the L_bold.func.gii  getting overlaid onto lh.inflated. I don't know if this points to some issue with my fmriprep output that may be causing dowstream problems.

I have taken the func.gii in fsaverage space from fmriprep, converted them to nifiti and smoothed them using the following code adapted from code posted here: https://github.com/nipreps/fmriprep/issues/994

#***************************************************************
# convert surface files, smooth, and reinforce tr
declare -a hemis=("l" "r")
for hemi in "${hemis[@]}"
do
out_stem=fmcpr.sm${fwhm}.fsaverage.${hemi}h
in_stem=${fmp_stem}_space-fsaverage_hemi-${hemi^}_bold.func
mri_surf2surf --srcsubject fsaverage --trgsubject fsaverage \
             --sval ${fmriprepFunc_dir}/${in_stem}.gii \
     --tval ${run_dir}/${out_stem}.nii.gz \
 --fwhm-trg ${fwhm} --hemi ${hemi}h
mri_convert ${run_dir}/${out_stem}.nii.gz ${run_dir}/${out_stem}.nii.gz -tr ${tr}
done
#***************************************************************

When running this, I get what appear to be warnings:

** DA[0] has coordsys with intent NIFTI_INTENT_TIME_SERIES (should be NIFTI_INTENT_POINTSET)
** DA[1] has coordsys with intent NIFTI_INTENT_TIME_SERIES (should be NIFTI_INTENT_POINTSET)
** DA[2] has coordsys with intent NIFTI_INTENT_TIME_SERIES (should be NIFTI_INTENT_POINTSET)

There are one of these for each TR in my data. Full output attached as convertAndSmoothOutput.txt

Next I am running mkanalysis-sess with the following:

#*******************************************************************************
#!/bin/bash

# Script for converting fmriprep outputs to fsfast structure for first levels
# This converts files to fsaverage surface spaces and mni305 volume spaces

conds="1,CX 2,eCS+1 3,eCS+2 4,eCS-atCS+1 5,eCS-atCS+2 6,lCS+1 7,lCS+2 8,lCS-atCS+1 9,lCS-atCS+2 10,NOShock_1 11,omittedSck_1 12,shock"
fwhms="5"

# source freesurfer
source ${FREESURFER_HOME}/SetUpFreeSurfer.sh

# set matlab path
export MATLAB='/usr/local/bin/matlab'
set MATLAB

# full path to recons folder
export SUBJECTS_DIR="/autofs/cluster/neuromod/NIFTI/OCD_NM/derivatives/freesurfer"

for fwhm in ${fwhms}; do
    for side in l r; do
        mkanalysis-sess \
            -no-mask \
            -paradigm events.txt \
            -tpexclude tpef.txt \
            -nuisreg MotConfounds.txt 12 \
            -mni305 -analysis cond_fsavSurf_${side}_sm${fwhm} -per-run -polyfit 2 \
            -event-related -TR 2.56 -fsd cond -refeventdur 6 \
            -spmhrf 0 -nconditions 12 -force \
            -funcstem fmcpr.sm${fwhm}.fsaverage.${side}h.nii.gz

        for i in ${conds} ; do
            condNum=${i%,*};
            cond=${i#*,};
            mkcontrast-sess -contrast ${cond} -analysis cond_fsavSurf_${side}_sm${fwhm} \
                -a ${condNum}
        done
#*******************************************************************************

output attached in mkanalysisSurfOutput.txt

When I then run selxavg3-sess on the data with:

#*******************************************************************************
#!/bin/bash

fsfastD="/autofs/cluster/neuromod/NIFTI/OCD_NM/derivatives/fsfast"
regions="fsavSurf_l"
fwhms="5"
conds="cond"

# source freesurfer
source ${FREESURFER_HOME}/SetUpFreeSurfer.sh

for fwhm in ${fwhms}; do
    for region in ${regions}; do
        for cond in ${conds}; do
            selxavg3-sess -no-preproc -s sub-101KI_ses-bld1 \
                -d ${fsfastD} \
                -analysis ${cond}_${region}_sm${fwhm}
        done
    done
done
#*******************************************************************************

I get the following error:

#*******************************************************************************
Smoothing ACF
/autofs/cluster/neuromod/programs/freesurfer_7.1.1/freesurfer/bin/mri_fwhm --mask /autofs/cluster/neuromod/NIFTI/OCD_NM/derivatives/fsfast/sub-101KI_ses-bld1/cond/cond_fsavSurf_l_sm5/mask.nii.gz --i /autofs/cluster/neuromod/NIFTI/OCD_NM/derivatives/fsfast/sub-101KI_ses-bld1/cond/cond_fsavSurf_l_sm5/rho1mn.nii.gz --o /autofs/cluster/neuromod/NIFTI/OCD_NM/derivatives/fsfast/sub-101KI_ses-bld1/cond/cond_fsavSurf_l_sm5/rho1mn.sm.nii.gz --fwhm 20.000000 --smooth-only
/autofs/cluster/neuromod/programs/freesurfer_7.1.1/freesurfer/bin/mri_fwhm --mask /autofs/cluster/neuromod/NIFTI/OCD_NM/derivatives/fsfast/sub-101KI_ses-bld1/cond/cond_fsavSurf_l_sm5/mask.nii.gz --i /autofs/cluster/neuromod/NIFTI/OCD_NM/derivatives/fsfast/sub-101KI_ses-bld1/cond/cond_fsavSurf_l_sm5/rho1mn.nii.gz --o /autofs/cluster/neuromod/NIFTI/OCD_NM/derivatives/fsfast/sub-101KI_ses-bld1/cond/cond_fsavSurf_l_sm5/rho1mn.sm.nii.gz --fwhm 20.000000 --smooth-only: Segmentation fault
voxelvolume 1 mm3
Loading mask /autofs/cluster/neuromod/NIFTI/OCD_NM/derivatives/fsfast/sub-101KI_ses-bld1/cond/cond_fsavSurf_l_sm5/mask.nii.gz
Search region is 163842 voxels = 163842.000000 mm3
Smoothing input by fwhm=20.000000, gstd=8.493218

ERROR: /autofs/cluster/neuromod/programs/freesurfer_7.1.1/freesurfer/bin/mri_fwhm --mask /autofs/cluster/neuromod/NIFTI/OCD_NM/derivatives/fsfast/sub-101KI_ses-bld1/cond/cond_fsavSurf_l_sm5/mask.nii.gz --i /autofs/cluster/neuromod/NIFTI/OCD_NM/derivatives/fsfast/sub-101KI_ses-bld1/cond/cond_fsavSurf_l_sm5/rho1mn.nii.gz --o /autofs/cluster/neuromod/NIFTI/OCD_NM/derivatives/fsfast/sub-101KI_ses-bld1/cond/cond_fsavSurf_l_sm5/rho1mn.sm.nii.gz --fwhm 20.000000 --smooth-only

ans =

   139

>> ------------------------------------------
ERROR: fast_selxavg3() failed\n
#*******************************************************************************

the full output is attached as selxavg3Output.txt

Any idea on what is causing selxavg3 to crash?

Thanks!



_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer