Open soichih opened 3 years ago
@giulia-berto @francopestilli @bhatiadheeraj Please feel free to jump in with troubleshooting this if you have time. I've seen this issue happening to several other users.
Hi @soichih @faskowit what happens if an roi is too small and is there a chance the number of boxes can be reduced down to 0 and rois dropped. For example 3 rois were dropped here? 114--->111,110?
@soichi @faskowit @francopestilli I tested the App fMRI Timeseries Extraction with all the three parcellations outputs from FreeSurfer separately in one subject, and all the runs finished successfully. In the log I have: !!!WARNING!!! during resampling of label image, some of the ROIs (likely very small) were interpolated out. Please take care to note which ROIs are present in the output data
. Also, as far as I understand, parcellation and bold data should be in the same space.
@faskowit precisely what we suspected. Is the output robust to the loss of ROIs due to interpaolation? @giulia-berto excellent, thanks
yes yes I wrote that warning message for this case. This lines are the relevant lines of the code that are supposed to catch interpolated regions: https://github.com/faskowit/app-fmri-2-mat/blob/master/src/makemat.py#L56-L84 The app is supposed to be robust to interpolated out regions, based on these lines specifically: https://github.com/faskowit/app-fmri-2-mat/blob/master/src/makemat.py#L66-L72
The error that is still seen from the app seems to be an edge case, in which the code above doesn't see that the region will be interpolated out. I'm afraid there is a limitation for the nilearn function that I use NiftiLabelsMasker.fit_transform()
: https://nilearn.github.io/modules/generated/nilearn.input_data.NiftiLabelsMasker.html as it will not tell you which timeseries corresponds to which region--it simply outputs an ordered matrix. It is because it is assumed that the input parcellation would have reasonably large regions.
This brings us to the case of the FreeSurfer aparcs being used as input. They seem to contain small regions with 100's of voxels (probably areas like 30
- Left-vessel or 31
Left-choroid-plexus) in the 1mm space that will get interpolated out when down-sampling to fmri-space. To solve this, I propose that FreeSurfer parcellations be "cleaned" in such a way, to only retain a set of larger regions (like the maTT app does, with the pre-specified set of subcortical areas... but for the aparc, it could be whatever larger regions you'd like). This could be a separate app, or done in the FreeSurfer app.
Another solution would be to "pre-downsample" the label image. I would have to test to see if that affects the quality of non-edge case usage in any way.
According to @faskowit, any atlas (like the one from freesurfer) should work with this App, but if a user feed parcellation input from freesurfer, it will fail with this error message
620 in this case is the 4D size of the bold (time slices). I couldn't figure out where 111 or 110 come from. The input parcellation has 114 unique values inside parc.nii.gz
But maybe it's ignoring a few parcellation? Whatever the case is, 110 v.s. 111 (of-by-one) smells fishy. It could be that app-freesurfer is not generating the parcellation/label.json correctly?