open-discussion > dcm2niix
Showing 1-6 of 6 posts
Display:
Results per page:
Nov 27, 2017  01:11 PM | Golbarg T. Saber
dcm2niix
Hi, 

I have been trying to use dcm2niix on Mac and I get the following error:
"dcm2niix is damaged and can't be opened. You should move it to the Trash"

I got the same error again after re-downloading MRIcroGL. A colleague of mine has an older version (2016) of MRIcroGL, and dcm2niix in that version seems to work fine.

Thanks, 
Golbarg
Nov 27, 2017  02:11 PM | Chris Rorden
RE: dcm2niix
Hello Golbarg 
  Can you give me a bit more information regarding what version of MacOS you are using, where you downloaded the software form, and whether the software works from the command line? From your description, I assume that MRIcroGL works, but you have problems using the graphical interface when you choose MRIcroGL's import menu. There are three sources for getting dcm2niix for the Mac It has been reported to me that NITRC can sometime have issues with downloading files, and I have noticed that it has some problems with Safari that do not appear when I use Chrome. However, I suspect the most likely cause is you are using a version of MacOS that has Gatekeeper Path Randomization enabled. This happens when you download an application from the internet and run it from the folder it was downloaded. You can fix this by moving the "MRIcroGL" folder in the finder to a different location, for example the "Applications" folder. This is a feature of some versions of MacOS and not my software. However, it particularly impacts applications that try to work together (like my graphical MRIcroGL and the command line dcm2niix). 

The latest releases of dcm2niix are always available from the dedicated Github site - I only build new MRIcroGL executables infrequently, so you can always get the most up to date version of dcm2niix and put it into the same folder as MRIcroGL.
Nov 27, 2017  03:11 PM | Golbarg T. Saber
RE: dcm2niix
Hi Chris, 

Thanks for your reply. My OS version is 10.11.6 (El Capitan, iMac), and I had downloaded MRIcroGL from NITRC. Re-downloaded it from NITRC and got the same error. I can open MRIcroGL and MRIcro GUIs which are in the same folder (/Applications/MRIcroGL). I added the path to dcm2niix to my ~/.bash_profile; however, when I call it in the terminal, bash cannot find the command.

I could get it from Github and see whether it'd work. 

Thanks,
Nov 27, 2017  04:11 PM | Chris Rorden
RE: dcm2niix
I just now downloaded MRIcroGL 14 July 2017 to my MacOS 10.11.6 Macbook and copied the MRIcroGL folder to applications. I launched MRIcroGL, selected import and converted a DICOM file. Perhaps you can go to AppleMenu/SystemPreferences/SecurityAndPrivacy and in the General tab see what it says for "Allow apps downloaded from" - I have this set to "Mac App Store and Identified developers".

When you choose MRIcroGL's Import/ConvertDICOM menu item the new window shows the location of the version of dcm2niix it is trying to run, for example on my system it is "/Users/rorden/Documents/osx/MRIcroGL/MRIcroGL.app/Contents/Resources/dcm2niix" - you can run this explicit path from the command line even if it is not in your path.
Attachment: dcm2niix.png
Nov 28, 2017  01:11 PM | Golbarg T. Saber
RE: dcm2niix
Thank you. I actually tried accessing dcm2niix in "/MRIcroGL/MRIcroGL.app/Contents/Resources/dcm2niix", and that works. However, there is another copy of dcm2niix inside MRIcroGL folder (MRIcroGL/dcm2niix), which would give me an error message and would not open. Is there a reason that these two copies behave differently?

Also, it would be helpful if you clarify the instructions for building the command line version on https://github.com/rordenlab/dcm2niix. The instructions read as if 'make install' is only needed for installing dcm2niix on the system; however, it turned out one cannot run dcm2niix from the command line in Mac without calling 'make install'.

Thanks,
Nov 28, 2017  02:11 PM | Chris Rorden
RE: dcm2niix
1.) I now understand your problem. You can read more about Apple's Gatekeeper by typing "is damaged and can't be opened. You should move it to the Trash" into your favorite search engine.

Briefly, when you click on the "dcm2niix" icon MacOS tells you that it can not be opened. Despite the fact that this executable is code-signed, Apple does not want you to launch an internet downloaded terminal program in this way. You can change this behavior by going to AppleMenu/SystemPreferences/Security&Privacy and selecting the "Allow apps downloaded from anywhere" - the next time you click on the application you can explicitly provide permission for this software that was downloaded from the internet. After doing this once, you can restore your safer security level. Of course, since it is a terminal program, clicking it in the finder does not do anything, but this process removes the confusing warning message. On the other hand, Apple grants access to the code signed ".app" packages of MRIcroGL and MRIcro, so you do not have to provide them with permission. This is a feature of MacOS 10.11 and later, not my software. I do think that Apple's warning message is not very clear, and indeed previous versions of MacOS guided users to grant access to internet applications.

For Linux and Windows MRIcroGL is distributed with a single copy of dcm2niix (which can be run from the command line or with the MRIcroGL's graphical "Import" menu). However, for the MacOS there are 3 independent copies:
  a.) There is a version of dcm2niix in the MRIcroGL folder. It has a terminal application icon. This is useful for running from the command line. You may want to put this into your path (e.g. move it to the /usr/local/bin folder so you can run it from the command line).
  b.) There is a copy of dcm2niix inside the MRIcroGL.app (you can see this by clicking on the MRIcroGL application icon and then selecting the Finder gear icon and choosing 'Show package contents'). This version is hidden inside the application, so if you move the application to a new location it still can find a copy of dcm2niix. 
 c.) The application MRIcro includes a stand-alone copy of dcm2niix in its Import menu. It does not require a separate external application. MRIcro has the most Mac-like interface since it is not cross-platform.


2.) I have updated the text - hopefully this clarifies the situation without being overly verbose. Specifically the commands
  • mkdir build && cd build
  • cmake -DUSE_OPENJPEG=ON ..
  • make
Will build the executable that will be put in the source codes  "/build/bin" folder. Since this is not in your path, so you must provide an explicit path to launch this, e.g. on my computer "/Users/rorden/Documents/cocoa/dcm2niix/build/bin/dcm2niix". In contrast, changing "make" to "make install" not only builds the executable but places it in your path. This allows you to run it by simply running "dcm2niix" from the command line. On many Unix systems, installing software requires more permissions than a local install. Therefore some users may prefer one method or the other. This is the same as other Unix code that relies on cmake, and is a feature of cmake not my software.