raamana / graynet

Subject-wise networks from structural MRI, both vertex- and voxel-wise features (thickness, GM density, curvature, gyrification)
https://raamana.github.io/graynet/
MIT License
35 stars 7 forks source link

Errors when trying to use Glasser2016 atlas. #57

Closed jlhanson5 closed 3 years ago

jlhanson5 commented 3 years ago

Dear Pradeep and colleagues,

I kept running into errors when trying to use the Glasser2016 atlas and wondered what I might be doing wrong. I can get graynet to work with the fsaverage atlas, but not Glasser. For fsaverage, I (obviously) qcached everything from Freesurfer, but reading the graynet docs, it looked like I didn't have to do that for Glasser2016 (or am I incorrect about that?).

Here's the command I'm running-- graynet -s subject_ids_reduced.txt -f freesurfer_thickness -i /home/jamielh/Volumes/Hanson/Collaborative_MRI/CEDAR_MRI/Neuroimaging/BIDS/derivatives/FreeSurfer_6 -w manhattan -p 10 -o /home/jamielh/Volumes/Hanson/Collaborative_MRI/CEDAR_MRI/Neuroimaging/BIDS/derivatives/graynet_2020_11 -a glasser2016

And then here's my (error) output--

/usr/local/lib/python3.6/dist-packages/dicom/__init__.py:53: UserWarning: This code is using an older version of pydicom, which is no longer maintained as of Jan 2017. You can access the new pydicom features and API by installingpydicom` from PyPI. See 'Transitioning to pydicom 1.x' section at pydicom.readthedocs.org for more information.

warnings.warn(msg)

Data resampled to glasser2016 atlas, smoothed at 10 with node size None Computing single edge ...

Processing freesurfer_thickness features Traceback (most recent call last): File "/home/jamielh/.local/lib/python3.6/site-packages/nibabel/loadsave.py", line 42, in load stat_result = os.stat(filename) FileNotFoundError: [Errno 2] No such file or directory: '/home/jamielh/Volumes/Hanson/Collaborative_MRI/CEDAR_MRI/Neuroimaging/BIDS/derivatives/FreeSurfer_6/sub-0202/surf/lh.thickness.fwhm10.glasser2016.mgh'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/graynet/freesurfer.py", line 42, in import_features features[subject_id] = get_data(fs_dir, subject_id, base_feature, fwhm, atlas) File "/usr/local/lib/python3.6/dist-packages/graynet/freesurfer.py", line 60, in get_data feature=bare_name_feature, atlas=atlas, fwhm=fwhm)) File "/usr/local/lib/python3.6/dist-packages/graynet/freesurfer.py", line 101, in __read_morph_feature vec = nibabel.load(thk_path).get_fdata() # typically of shape: (163842, 1, 1) File "/home/jamielh/.local/lib/python3.6/site-packages/nibabel/loadsave.py", line 44, in load raise FileNotFoundError(f"No such file or no access: '{filename}'") FileNotFoundError: No such file or no access: '/home/jamielh/Volumes/Hanson/Collaborative_MRI/CEDAR_MRI/Neuroimaging/BIDS/derivatives/FreeSurfer_6/sub-0202/surf/lh.thickness.fwhm10.glasser2016.mgh' Traceback (most recent call last): File "/home/jamielh/.local/lib/python3.6/site-packages/nibabel/loadsave.py", line 42, in load stat_result = os.stat(filename) FileNotFoundError: [Errno 2] No such file or directory: '/home/jamielh/Volumes/Hanson/Collaborative_MRI/CEDAR_MRI/Neuroimaging/BIDS/derivatives/FreeSurfer_6/sub-0202/surf/lh.thickness.fwhm10.glasser2016.mgh'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/graynet/freesurfer.py", line 42, in import_features features[subject_id] = get_data(fs_dir, subject_id, base_feature, fwhm, atlas) File "/usr/local/lib/python3.6/dist-packages/graynet/freesurfer.py", line 60, in get_data feature=bare_name_feature, atlas=atlas, fwhm=fwhm)) File "/usr/local/lib/python3.6/dist-packages/graynet/freesurfer.py", line 101, in __read_morph_feature vec = nibabel.load(thk_path).get_fdata() # typically of shape: (163842, 1, 1) File "/home/jamielh/.local/lib/python3.6/site-packages/nibabel/loadsave.py", line 44, in load raise FileNotFoundError(f"No such file or no access: '{filename}'") FileNotFoundError: No such file or no access: '/home/jamielh/Volumes/Hanson/Collaborative_MRI/CEDAR_MRI/Neuroimaging/BIDS/derivatives/FreeSurfer_6/sub-0202/surf/lh.thickness.fwhm10.glasser2016.mgh'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/graynet/run_workflow.py", line 289, in extract_per_subject_cortical atlas=atlas_spec) File "/usr/local/lib/python3.6/dist-packages/graynet/utils.py", line 560, in import_features fwhm=fwhm, atlas=atlas) File "/usr/local/lib/python3.6/dist-packages/graynet/freesurfer.py", line 47, in import_features ''.format(base_feature, subject_id)) ValueError: freesurfer_thickness data for sub-0202 could not be read! /usr/local/lib/python3.6/dist-packages/graynet/run_workflow.py:293: UserWarning:

Unable to read freesurfer_thickness features for sub-0202 Skipping it.

Reading freesurfer_thickness for sub-0202 ... graynet computation done.`

I'm only trying to do it for one subject, but figured the critical bit above was: FileNotFoundError: [Errno 2] No such file or directory: '/home/jamielh/Volumes/Hanson/Collaborative_MRI/CEDAR_MRI/Neuroimaging/BIDS/derivatives/FreeSurfer_6/sub-0202/surf/lh.thickness.fwhm10.glasser2016.mgh'

Should I be qcache-ing my surfaces (with the files Kate Mills made) before running graynet? Any suggestions are much appreciated.

Many thanks (and apologies for my issues), Jamie.

raamana commented 3 years ago

thanks Jamie for reporting it - yes, you need to qcache the FS outputs with the atlas you chose. I'll check the docs and fix them to clarify that.

it would be useful for graynet to do that also - perhaps a quick hackathon project for someone interested :)

raamana commented 3 years ago

did that help Jamie?

jlhanson5 commented 3 years ago

Sort of. I'm trying to track down the Glasser atlas files, but I think it is actually in fsaverage space (and the annot file is the only difference). Perhaps I'll drop Kate (Mills) a line about it.

raamana commented 3 years ago

thanks - i'll also try to look into how I setup the tests to ensure the tool catches potential problems early.

raamana commented 3 years ago

were you able to solve this Jamie?