mandymejia / BayesfMRI

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

Right hemisphere always has resolution of 0 #24

Closed smeisler closed 2 years ago

smeisler commented 2 years ago

Hello,

I just updated to BayesfMRI 2.0. I also updated all packages (all CRAN packages including ciftiTools, workbench 1.5.0, INLA INLA_22.05.03, R 4.1.3).

I was using surface files that had previously worked for me:

results <- BayesGLM_cifti(
    cifti_fname = fnames_ts[1],
    surfL_fname = fname_gifti_left,
    surfR_fname = fname_gifti_left,
    brainstructures = c("left", "right"),
    onsets = events_1,
    TR = TR,
    nuisance = confounds_1,
    nuisance_include = c("dHRF"),
    scale_BOLD = "auto",
    scale_design = TRUE,
    num.threads =  parallel::detectCores() - 2,
    verbose = TRUE,
    outfile = '/om4/group/gablab/data/ds003126/code/bayesfmri/BayesfMRI_fmriprep_test',
    return_INLA_result = TRUE,
    avg_sessions = TRUE,
    trim_INLA = TRUE,
)

I get the following error message:

SETTING UP DATA 
 MAKING DESIGN MATRICES 
 RUNNING MODELS 

 .. LEFT CORTEX ANALYSIS 
     848 locations removed due to NA or NaN values.
     86 additional locations removed due to low mean.
Error in smooth_cifti(AR_xif, surf_FWHM = FWHM): Cannot smooth because the left and right cortex have unequal inferred resolutions: 9308 and 0.
Traceback:

1. BayesGLM_cifti(cifti_fname = fnames_ts[1], surfL_fname = fname_gifti_left, 
 .     surfR_fname = fname_gifti_left, brainstructures = c("left", 
 .         "right"), onsets = events_1, TR = TR, nuisance = confounds_1, 
 .     nuisance_include = c("dHRF"), scale_BOLD = "auto", scale_design = TRUE, 
 .     num.threads = parallel::detectCores() - 2, verbose = TRUE, 
 .     outfile = "/om4/group/gablab/data/ds003126/code/bayesfmri/BayesfMRI_fmriprep_test", 
 .     return_INLA_result = TRUE, avg_sessions = TRUE, trim_INLA = 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. suppressWarnings(smooth_cifti(AR_xif, surf_FWHM = FWHM))
5. withCallingHandlers(expr, warning = function(w) if (inherits(w, 
 .     classes)) tryInvokeRestart("muffleWarning"))
6. smooth_cifti(AR_xif, surf_FWHM = FWHM)
7. stop("Cannot smooth because the left and right cortex have unequal inferred resolutions: ", 
 .     res[1], " and ", res[2], ".")

As a check, I even tried putting in the same surface files for both left and right hemisphere, and got the same error.

Do you know how I might address this?

Best, Steven

smeisler commented 2 years ago

This error also continues after only entering the left hemisphere file and only passing in "left" into the brainstructures argument. Is there a different branch I should be testing?

damondpham commented 2 years ago

Sorry about this issue! Could you attach here your data? Especially the surfaces.

smeisler commented 2 years ago

All relevant files are here: https://drive.google.com/file/d/1m2bPZGHVwPN8l9Aehx2Hjhf2PBC5p1Tv/view

The specific surface files I was using are tpl-fsLR_den-32k_hemi-L_midthickness.surf.gii and tpl-fsLR_den-32k_hemi-R_midthickness.surf.gii.

Edited to add that when I disable AR smoothing, I think it gets past this error.

damondpham commented 2 years ago

I think I fixed a problem in ciftiTools that's causing this bug. Try again with the 10.0 branch of ciftiTools from GitHub?

smeisler commented 2 years ago

It seems to be running past that point, thanks! I'll close when I confirm the outputs look okay.

Edit: works and looks good thanks!