niicat
niicat copied to clipboard
error in plotter: `ctypes.ArgumentError: argument 2: TypeError: wrong type`
I get the following error when trying to run niicat on a nifti file:
Traceback (most recent call last):
File "/raid/shared/tbartczak/conda/envs/tb/bin/niicat", line 50, in <module>
main()
File "/raid/shared/tbartczak/conda/envs/tb/bin/niicat", line 46, in main
plot(args.nifti_file, dpi=args.dpi)
File "/raid/shared/tbartczak/conda/envs/tb/lib/python3.11/site-packages/niicat/plotter.py", line 254, in plot
return _plot_nifti_preview(iFile, return_fig=return_fig, dpi=dpi)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/raid/shared/tbartczak/conda/envs/tb/lib/python3.11/site-packages/niicat/plotter.py", line 233, in _plot_nifti_preview
_plot_sixel(fig)
File "/raid/shared/tbartczak/conda/envs/tb/lib/python3.11/site-packages/niicat/plotter.py", line 36, in _plot_sixel
res = _sixel_encode(fig.canvas.buffer_rgba(), fig.get_figwidth()* dpi, fig.get_figheight() * dpi)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/raid/shared/tbartczak/conda/envs/tb/lib/python3.11/site-packages/niicat/plotter.py", line 23, in _sixel_encode
libsixel.sixel_dither_initialize(dither, data, w, h, libsixel.SIXEL_PIXELFORMAT_RGBA8888)
File "/raid/shared/tbartczak/conda/envs/tb/lib/python3.11/site-packages/libsixel/__init__.py", line 503, in sixel_dither_initialize
status = _sixel.sixel_dither_initialize(dither, data, width, height, pixelformat,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ctypes.ArgumentError: argument 2: TypeError: wrong type
I've installed niicat from source from the version in https://github.com/MIC-DKFZ/niicat/pull/8 as I got nibabel issues with pypi version.
From the stacktracie it seems that wrong datatype is passed to sixel when encoding figure?
My env: Python 3.11 matplotlib==3.7.1 matplotlib-inline==0.1.6 numpy==1.24.3 nibabel==5.1.0
Same issue here with Python 3.10 and 3.11
Me too
Same here, tried with nii and nii.gz (python 3.11.5)
me too
This is on ubuntu when using libsixel.
On ubuntu, use mlterm.
sudo apt install mlterm
After that, niicat -lb $filename will work.