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

How to save harmonization model? #46

Closed angelw55 closed 4 months ago

angelw55 commented 4 months ago

Hi developers,

Thanks for your hard work in harmonizing MRI data for multi-center study. I successfully installed and ran the package. I would like to save the harmonization model to inspect the parameters by

nh.saveHarmonizationModel(model, 'model')

But it came up with this error:

Traceback (most recent call last): File "/home/awong/Data/scripts/harmonize.py", line 12, in nh.saveHarmonizationModel(model, 'model') File "/home/awong/Software/fsl/lib/python3.11/site-packages/neuroHarmonize/harmonizationLearn.py", line 397, in saveHarmonizationModel est_size += model[key].nbytes / 1e6


KeyError: 'grand_mean'

What does it mean?

Besides, the adjusted data doesn't have column names, and I expect that the columns would be the same as those in the input data, right? I would like to have a column for their participant IDs. Can I put this column in the input data and covariates files?

Thanks, Angel

rpomponio commented 4 months ago

Thank you for identifying this bug. This is a result of some changes I made to the package in version 2.4.1.

Working on it now.

FYI - the column names will not be preserved because the data (and the adjusted data) are stored as a numpy array.