rordenlab / dcm2niix

dcm2nii DICOM to NIfTI converter: compiled versions available from NITRC
https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage
Other
886 stars 228 forks source link

dcm2niix can't find pigz.exe in Windows #650

Closed marcelzwiers closed 1 year ago

marcelzwiers commented 1 year ago

Describe the bug

Pigz.exe is on the windows path but dcm2niix can't find it

To reproduce

Steps to reproduce the behavior:

  1. Open a windows command shell
  2. Run:
C:\Users\Marcel>set "PATH=%PATH%;C:\Program Files\MRIcroGL\Resources"
C:\Users\Marcel>dcm2niix -v
  1. Output:
C:\Users\Marcel>dcm2niix -v
Compression will be faster with pigz.exe in the same folder as the executable
Chris Rorden's dcm2niiX version v1.0.20220720  (JP2:OpenJPEG) (JP-LS:CharLS) MSC1900  (64-bit Windows)
v1.0.20220720

The pigz executable, however, is present in the same folder:

C:\Users\Marcel>dir C:\"Program Files"\MRIcroGL\Resources\*.exe
Directory of C:\Program Files\MRIcroGL\Resources

18/11/2022  13:06         3,014,656 bet2.exe
18/11/2022  13:06           943,104 dcm2niix.exe
18/11/2022  13:06           328,704 pigz.exe
               3 File(s)      4,286,464 bytes

Expected behavior

I don't expect that pigz warning message

Version

v1.0.20220720 (see also above)

neurolabusc commented 1 year ago

Acknowledged. With the Windows operating system pigz.exe must be in the current working directory to be detected. This will be fixed in a future release.

neurolabusc commented 1 year ago

@marcelzwiers can you test that the latest development build (v1.0.20221120) fixes your issue? Compiling on Windows is a bit tricky, so you can download the pre-compiled executable by going to the AppVeyor web page and clicking on the Artifacts button.

marcelzwiers commented 1 year ago

Still the same (I unzipped the AppVeypor files in the Resources folder) :-(

C:\Users\Marcel>set "PATH=%PATH%;C:\Program Files\MRIcroGL\Resources"

C:\Users\Marcel>dcm2niix -v
Compression will be faster with C:\Users\Marcel\pigz.exe in the same folder as the executable
Chris Rorden's dcm2niiX version v1.0.20221120  (JP2:OpenJPEG) (JP-LS:CharLS) MSC1900  (64-bit Windows)
v1.0.20221120
neurolabusc commented 1 year ago

Unable to replicate. It appears that the copy of dcm2niix in the path C:\Users\Marcel\dcm2niix is taking precedence over the copy in ';C:\Program Files\MRIcroGL\Resources\dcm2niix'. You could either explicitly run the latter or copy pigz to the folder C\Users\Marcel

marcelzwiers commented 1 year ago

Mhhh, I don't think it did?

C:\Users\Marcel>dcm2niix -v
'dcm2niix' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Marcel>set "PATH=%PATH%;C:\Program Files\MRIcroGL\Resources"

C:\Users\Marcel>dcm2niix -v
Compression will be faster with C:\Users\Marcel\pigz.exe in the same folder as the executable
Chris Rorden's dcm2niiX version v1.0.20221120  (JP2:OpenJPEG) (JP-LS:CharLS) MSC1900  (64-bit Windows)
v1.0.20221120

C:\Users\Marcel>where dcm2niix
C:\Program Files\MRIcroGL\Resources\dcm2niix.exe

C:\Users\Marcel>where pigz
C:\Program Files\MRIcroGL\Resources\pigz.exe
neurolabusc commented 1 year ago

Did you try providing the working directory with your call?

"C:\Program Files\MRIcroGL\Resources\dcm2niix.exe"
marcelzwiers commented 1 year ago

That works!

C:\Users\Marcel>C:\"Program Files"\MRIcroGL\Resources\dcm2niix -v
Chris Rorden's dcm2niiX version v1.0.20221120  (JP2:OpenJPEG) (JP-LS:CharLS) MSC1900  (64-bit Windows)
v1.0.20221120
neurolabusc commented 1 year ago

Why don't you try the latest commit (v1.0.20221122). I try to use the GetModuleFileName function if pigz is not in the current working directory and the location of dcm2niix can not be determined from the first argument. I did not test for MinGW compilation, so we might need to wrap the new code in a #ifdef _MSC_VER conditional.

marcelzwiers commented 1 year ago

Yes, it all works now :-)

C:\Users\Marcel>C:\"Program Files"\MRIcroGL\Resources\dcm2niix -v
Chris Rorden's dcm2niiX version v1.0.20221121  (JP2:OpenJPEG) (JP-LS:CharLS) MSC1900  (64-bit Windows)
v1.0.20221121

C:\Users\Marcel>set "PATH=%PATH%;C:\Program Files\MRIcroGL\Resources"

C:\Users\Marcel>dcm2niix -v
Chris Rorden's dcm2niiX version v1.0.20221121  (JP2:OpenJPEG) (JP-LS:CharLS) MSC1900  (64-bit Windows)
v1.0.20221121