Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many 0s in fMRI timeseries (using raw HCP data) #164

Open
bwinsto2 opened this issue Dec 29, 2021 · 4 comments
Open

Many 0s in fMRI timeseries (using raw HCP data) #164

bwinsto2 opened this issue Dec 29, 2021 · 4 comments

Comments

@bwinsto2
Copy link

Happy holidays!!

I am hoping to use ciftify as a prerequisite for our upcoming BIDS app but am experiencing an issue.

Starting from raw HCP data, I ran fMRIprep and freesurfer and then ciftify (through docker). I then execute some commands for obtaining a matrix (n_vert x n_timepoints) of intensities (but please let me know if there is an easier way of doing this):

shell commands:

wb_command -cifti-separate {dtseries_from_ciftify} COLUMN -metric CORTEX_LEFT hem-l.func.gii
wb_command -cifti-separate {dtseries_from_ciftify} COLUMN -metric CORTEX_RIGHT hem-r.func.gii

python:

timeseries_matrix = read_functional_timeseries(hem-l.func.gii, hem-r.func.gii)

def read_functional_timeseries(lhfunc,rhfunc):
    l = nib.load(lhfunc).darrays
    r = nib.load(rhfunc).darrays
    timeseries = np.zeros((2*len(l[0].data), len(r)))
    for i in range(len(l)):
        lt = np.array(l[i].data)
        rt = np.array(r[i].data)
        tp = np.concatenate((lt, rt))
        timeseries[:, i] = tp
    return timeseries_matrix

However, in the resulting timeseries matrix, there are many vertices which have value 0 at every timepoint. For example, I looked at a working memory scan, and 14,000 of the ~65,000 vertices had a 0.

The code I provided above, when applied to dtseries files from the HCP 1200 subject release (minimally preprocessed dataset), produces a matrix without any zeroes (for the same scan). Therefore, I am not sure exactly where this problem is originating from: fMRIprep (seems unlikely), ciftify, or the above code for converting dtseries -> timeseries matrix (which works for HCP dtseries, so seems unlikely to be the problem).

I am a bit unfamiliar with this space (no pun intended), so any insight would be very appreciated! We are hoping to recommend users to run ciftify as a prerequisite to our pipeline, so I hope we can get this figured out!

Thanks.

@edickie
Copy link
Owner

edickie commented Dec 29, 2021

One cause if missing data might be the medial wall mask, which gets rewritten with zeros if you convert to gifti.

p.s. nibabel can read cifti directly. Do you see zero timerseries if you load the dtseries data directly (nib.load(cifti).get_fdata())?

@bwinsto2
Copy link
Author

hi @edickie thank you for the response!! looks unlikely to be the medial wall since even when loading in the 91k dtseries directly as you described, there are over 15,000 zeroes. I loaded in an HCP one for comparison and there were no zeroes.

Here I used this code to plot the cifti data from cortex left and right to the surface. Here is a dtseries from ciftify:
Screen Shot 2021-12-29 at 1 37 53 PM
Screen Shot 2021-12-29 at 1 37 58 PM

And here's one from HCP minimal preprocess download:
Screen Shot 2021-12-29 at 1 38 09 PM
Screen Shot 2021-12-29 at 1 38 03 PM

So it looks like it's not just random vertices missing data. Any idea why the whole dorsal areas seem to be missing values?

fMRIprep output looks fine. is it possible there's something weird going on with the MNI transform? not sure if it matters, but the MNI transformed image shown below almost looks cut off in the top two non-axial views:

Screen Shot 2021-12-28 at 11 50 03 PM

Thank you very much,

Brian

@edickie
Copy link
Owner

edickie commented Jan 2, 2022 via email

@bwinsto2
Copy link
Author

bwinsto2 commented Jan 17, 2022

Thanks @edickie. I'm not sure how exactly to proceed since MNI transform is a part of ciftify. Ultimately I am using the --resample-to-T1w option on the anatomical side, so I am hoping for ciftis that can be projected on a 32k T1w surface. I have ciftify installed locally too so I can try out some of the options. I tried skipping MNI transform, but got an error that "label volume has a different space than data volume".

fMRIprep can also output 91k ciftis. Those work pretty well, but I was hoping to keep everything in ciftify if possible. Any ideas how to resolve this registration issue? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants