rpomponio / neuroHarmonize

Harmonization tools for multi-site neuroimaging analysis. Implemented as a python package. Harmonization of MRI, sMRI, dMRI, fMRI variables with support for NIFTI images. Complements the work in Neuroimage by Pomponio et al. (2019).
https://pypi.org/project/neuroHarmonize/
MIT License
79 stars 28 forks source link

Providing paths to nifti images, but mask stage fails #36

Closed athenahowell closed 8 months ago

athenahowell commented 1 year ago

Hi,

I'm trying to use neuroHarmonize for a group of NIFTI images. I've created a csv file with all the full paths to the images, and then I've copied & pasted your instructions, but "nifti_avg, nifti_mask, affine, hdr0 = createMaskNIFTI(nifti_list, threshold=0)" fails with this error:

"Traceback (most recent call last): File "", line 1, in File "/fs/ess/PCON0381/.conda/envs/neuroHarmonize/lib/python3.11/site-packages/neuroHarmonize/harmonizationNIFTI.py", line 44, in createMaskNIFTI nifti_i = nib.load(paths.PATH[i]) ^^^^^^^^^^ File "/fs/ess/PCON0381/.conda/envs/neuroHarmonize/lib/python3.11/site-packages/pandas/core/generic.py", line 5902, in getattr return object.getattribute(self, name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'DataFrame' object has no attribute 'PATH' "

I'm fairly new to python, so I'm not sure how to debug this. This is how my csv with the brain paths is structured:

fullpath /fs/ess/PCON0381/DIAMOND_Athena/ToHarmonize/Con15_2Evs2No_nii/diamond_20141217.10025_con_0015.nii.gz /fs/ess/PCON0381/DIAMOND_Athena/ToHarmonize/Con15_2Evs2No_nii/diamond_20150109.10032_con_0015.nii.gz /fs/ess/PCON0381/DIAMOND_Athena/ToHarmonize/Con15_2Evs2No_nii/diamond_20150112.10033_con_0015.nii.gz /fs/ess/PCON0381/DIAMOND_Athena/ToHarmonize/Con15_2Evs2No_nii/diamond_20150205.10039_con_0015.nii.gz /fs/ess/PCON0381/DIAMOND_Athena/ToHarmonize/Con15_2Evs2No_nii/diamond_20150212.10035_con_0015.nii.gz /fs/ess/PCON0381/DIAMOND_Athena/ToHarmonize/Con15_2Evs2No_nii/diamond_20150213.10034_con_0015.nii.gz ...

smeisler commented 1 year ago

Hi @athenahowell,

Based on the error message, it sounds like it is expecting your dataframe to have a column explicitly called PATH. Please rename your column name in your CSV to PATH (case-sensitive) and try again.

Best, Steven

rpomponio commented 8 months ago

That is true. You must have a column named "PATH" in your data frame. See help documentation for function createMaskNIFTI.