valosekj / fsleyes_preset

Run FSLeyes and automatically set display options
GNU General Public License v3.0
0 stars 0 forks source link

Error with get_image_intensities for mddw #16

Closed valosekj closed 3 years ago

valosekj commented 3 years ago

/md1/PA-PMP/PA-PMP-009/dicom/nii$ ff *mddw*

result in:

Traceback (most recent call last):
  File "/usr/local/lib/fsleyes_preset/fsleyes_preset.py", line 208, in <module>
    main(sys.argv[1:])
  File "/usr/local/lib/fsleyes_preset/fsleyes_preset.py", line 180, in main
    _, max_intensity = get_image_intensities(fname)
  File "/usr/local/lib/fsleyes_preset/fsleyes_preset.py", line 106, in get_image_intensities
    min_intensity = np.min(image.get_fdata())
  File "/usr/local/lib/fsleyes_preset/venv/lib/python3.7/site-packages/nibabel/dataobj_images.py", line 355, in get_fdata
    data = np.asanyarray(self._dataobj, dtype=dtype)
  File "/usr/local/lib/fsleyes_preset/venv/lib/python3.7/site-packages/nibabel/arrayproxy.py", line 391, in __array__
    arr = self._get_scaled(dtype=dtype, slicer=())
  File "/usr/local/lib/fsleyes_preset/venv/lib/python3.7/site-packages/nibabel/arrayproxy.py", line 360, in _get_scaled
    scaled = scaled.astype(np.promote_types(scaled.dtype, dtype), copy=False)
TypeError: The DTypes <class 'numpy.dtype[void]'> and <class 'numpy.dtype[float64]'> do not have a common DType. For example they cannot be stored in a single array unless the dtype is `object`. 
valosekj commented 3 years ago

The issue was caused due to RGB datatype of input image (FA), which does not support get_fdata() method. Solved in #17