openneuropet / PET2BIDS

PET2BIDS helps you convert your PET data into BIDS! raw PET scanner files (e.g. ecat, dicom) and additional side files like .e.g excel sheets -- paper @JOSS https://doi.org/10.21105/joss.06067
https://pet2bids.readthedocs.io
MIT License
25 stars 20 forks source link

BUG Error message when dcm2niix isn't installed in the user path #277

Closed nbeliy closed 6 months ago

nbeliy commented 6 months ago

Describe the bug If dcm2niix is installed not in the user's path, but setup using --set-dcm2niix-path option, dcm2niix4pet produce error about dcm2niix not being installed. Outside the shown error, the conversion behave normally.

To Reproduce

> dcm2niix4pet --set-dcm2niix-path ./dcm2niix
> dcm2niix4pet 'source/3989571G  AKSEKI-ESRA-20200625' -d test
  1. error happening? (copy/paste the error)
    2024-02-22 16:32:25,031 - pypet2bids - ERROR - Dcm2niix does not appear to be installed. Installation instructions can be found here 
                       https://github.com/rordenlab/dcm2niix#install and packaged versions can be found at https://github.com/rordenlab/dcm2niix/releases (dcm2niix4pet.py:294)

This is caused by check_posix, who do not attempt to retrieve path to dcm2niix, unlike check_for_dcm2niix just below

Expected behaviour No error shown.

Desktop (please complete the following information):

CPernet commented 6 months ago

I am not sure what you are asking to do? it does tell the user how to set it up, are you asking a new feature? which would not be a bug --- if ubuntu virtual under window, it a dcm2niix issue (it cannot work)

bendhouseart commented 6 months ago

I'm not sure if I would call this a bug as it seems to be working as intended, if you execute dcm2niix from the same location as your executing dcm2niix4pet what is the output?

The feature is primarily intended to help windows users who aren't able to put dcm2niix onto their path for various reasons, e.g. they don't have admin access on their work machines. See the instructions under the windows only section of installation here -> https://pet2bids.readthedocs.io/en/latest/installation.html#python

We always check to see if dcm2niix is installed as we are unable to convert from dicom without it. On a posix machine we check the path with check_posix then if it's not found there we check the config file to see if the dcm2niix binary is specified in the config here.

I'm confident that if you either add dcm2niix to your PATH variable or run --set-dcm2niix-path with the full file path to your binary you should be able to resolve the error you encountered.

nbeliy commented 6 months ago

Maybe I was unclear.

pet2bids runs as intended if I setup path with --set-dcm2niix-path. But it still show an error that dcm2niix not installed.

I would like that you change the check for installed dcm2niix to consider the path setup with --set-dcm2niix-path.

It is absolutely not critical issue, more just annoying, printing a fake error.

bendhouseart commented 6 months ago

Updated per request.