mandymejia / BayesfMRI

BayesfMRI R package
GNU General Public License v3.0
24 stars 7 forks source link

Cannot load HCP data due to mismatched surface/func dimensions #25

Closed smeisler closed 2 years ago

smeisler commented 2 years ago

Hello,

I am trying to run the HCP vignette on a different task (working memory instead of motor). I am using BayesfMRI 2.0 (commit fe9a256c78e2870e3f000ad9261e6e164215eaef in late May) and CiftiTools master (recent, right after 10.1 was merged). I cannot use more recent BayesfMRI v2.0 due to reasons described in another issue #26.

I get an error, described below, that indicates a dimension mismatch, despite these being unmodified HCP preprocessed outputs:

 SETTING UP DATA 
 .. reading in data for session 1
 .. reading in data for session 2
 MAKING DESIGN MATRICES 
 RUNNING MODELS 

 .. LEFT CORTEX ANALYSIS 
     2796 locations removed due to NA or NaN values in at least one scan.
Number of left cortex vertices (rows), 29696, doesn't match the number of non-medial wall locations in the mask, 30424.

Error in ciftiTools:::make_xifti(cortexL = AR, surfL = surf_smooth): Could not make a valid "xifti" object.
Traceback:

1. BayesGLM_cifti(cifti_fname = c(fname1_ts, fname2_ts), surfL_fname = fname_gifti_left, 
 .     surfR_fname = fname_gifti_right, onsets = list(onsets1, onsets2), 
 .     TR = TR, nuisance = list(motion1, motion2), session_names = fmri_acqs, 
 .     resamp_res = NULL, num.threads = parallel::detectCores() - 
 .         2, verbose = TRUE, outfile = "/nese/mit/group/gablab/data/HCP/HCP_style/code/bayesfmri/testFullRes", 
 .     avg_sessions = TRUE)
2. BayesGLM(data = session_data, beta_names = beta_names, mesh = NULL, 
 .     vertices = surf_list[[each_hem]]$vertices, faces = surf_list[[each_hem]]$faces, 
 .     scale_BOLD = scale_BOLD, scale_design = FALSE, Bayes = do_Bayesian, 
 .     EM = do_EM, ar_order = ar_order, ar_smooth = ar_smooth, num.threads = num.threads, 
 .     return_INLA_result = return_INLA_result, outfile = outfile_name, 
 .     verbose = verbose, avg_sessions = avg_sessions, meanTol = meanTol, 
 .     varTol = varTol, emTol = emTol, trim_INLA = trim_INLA)
3. pw_smooth(vertices = mesh$loc, faces = mesh$graph$tv, AR = avg_AR, 
 .     var = avg_var, FWHM = ar_smooth)
4. ciftiTools:::make_xifti(cortexL = AR, surfL = surf_smooth)
5. stop("Could not make a valid \"xifti\" object.")

Let me know if I should instead move this issue to ciftiTools. Are there particular versions of BayesfMRI and ciftiTools I should be working with?

Thanks, Steven

smeisler commented 2 years ago

This may be an issue with surface resampling? When I got the error, I had surface resampling set to NULL, but when I set it to 10000 I seem to get farther.

damondpham commented 2 years ago

Thanks for letting me know about this, @smeisler ! Do you mind sharing your data with me so I can take a look?

smeisler commented 2 years ago

Yes, data are shared in #26 !

smeisler commented 2 years ago

Also, I'll note that I share the MSMAll surface / time series, using the surface in the T1w-fsLR32k space, but I also received this error with the non-MSMAll surfaces, and in the MNI-fsLR32k space.

smeisler commented 2 years ago

Resolved in #26