PennLINC / ConFixel

Companion converter software for ModelArray for converting data back and forth from the HDF5 file format.
BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

Issues with fixels.py #30

Closed danakanel closed 1 year ago

danakanel commented 1 year ago

After running the following command:

confixel --index-file FDC/index.mif --directions-file FDC/directions.mif --cohort-file cohort_FDC.csv --relative-root /Users/kanelds/confixel/data --output-hdf5 FDC.h5

I get the following errors:

1. File "/Users/kanelds/opt/anaconda3/lib/python3.9/site-packages/confixel/fixels.py", line 45, in mif_to_nifti2 data = nifti2_img.get_data().squeeze() File "/Users/kanelds/opt/anaconda3/lib/python3.9/site-packages/nibabel/deprecator.py", line 185, in deprecated_func raise error_class(message) nibabel.deprecator.ExpiredDeprecationError: get_data() is deprecated in favor of get_fdata(), which has a more predictable return type. To obtain get_data() behavior going forward, use numpy.asanyarray(img.dataobj).
I edited line 45: get_data() to get_fdata()

2. File "/Users/kanelds/opt/anaconda3/lib/python3.9/site-packages/confixel/fixels.py", line 100, in gatherfixels for in range(fixel_count): TypeError: 'numpy.float64' object cannot be interpreted as an integer

I edited line 99: range(fixel_count) to range(int(fixel_count))

:) Thank you again!!

zhao-cy commented 1 year ago

Hi Dana,

Thank you so much for letting me know the details! These are very helpful! I’ve changed fixels.py and merged to main. Could you please pull ConFixel from github and install the updated version (using commands below), and test with you data?

cd ConFixel   # cd to where you installed ConFixel
git pull origin main
pip install -e .

If git pull origin main does not work, you might delete your local copy of ConFixel, and clone the github repository again by following instructions here

After you run the updated ConFixel, the data file size of HDF5 should be smaller than (almost half of) what you had, and that’s fine – it just because you used default dtype=np.float64 in get_fdata(), and I changed that to dtype=np.float32. You can use this updated data with smaller file size to proceed to ModelArray.

Let me know if current ConFixel works?

Thank you so much! Chenying

danakanel commented 1 year ago

Hi Chenying, thank you for the quick response!

The new ConFixel works and HDF5 file is indeed half the size :)

Dana

zhao-cy commented 1 year ago

Awesome! Thanks for the quick testing! I'll close the issue here then.

If you have any further questions or issues, please create a new issue on ConFixel or ModelArray's github repository.

Thanks, Chenying