questions > dcm2nii .ini-file on Mac OS Sierra
Showing 1-9 of 9 posts
Display:
Results per page:
Nov 10, 2016  12:11 PM | Sabrina Golde - Charité - Universitätsmedizin Berlin
dcm2nii .ini-file on Mac OS Sierra
Hi,

in order to use BET of the DPARSFA-Toolbox, I need to install the latest version of dcm2nii on an iMac with OS Sierra. However, it does not seem to create the .ini file when I double click on the dcm2nii-file in the MRIcron folder as described in the documentation. At least I cannot find it anywhere in my home directory.
Thanks in advance!
Nov 10, 2016  01:11 PM | Chris Rorden
RE: dcm2nii .ini-file on Mac OS Sierra
A.) To see the options for dcm2nii, run the command "dcm2nii" from the command line. It will not only report the options but also the location of the preferences file. For MacOS and Linux this will be the ".dcm2nii" folder in your home directory. Since the folder name starts with a "." it is hidden by default. There are many options, but here are three simple ones:
 1.) From your finder, choose Go/GoToFolder... and enter "~/.dcm2nii"
 2.) From your terminal, type "nano ~/.dcm2nii/dcm2nii.ini"
 3.) From your terminal, type "open -a textedit ~/.dcm2nii/dcm2nii.ini"

B.) You may also want to consider dcm2niix (which comes with MRIcroGL). While I hope that dcm2nii (which comes with MRIcron) is mature and useful, it is not under active development and I only update it when users report issues. You can use MRIcroGL's "Import" menu item to run dcm2niix from the graphical interface, or you can run it from the terminal.


----------

$ ./dcm2nii
Chris Rorden's dcm2nii :: 30APR2016 64bit BSD License
reading preferences file /Users/rorden/.dcm2nii/dcm2nii.ini
Either drag and drop or specify command line options:
dcm2nii
OPTIONS:
-4 Create 4D volumes, else DTI/fMRI saved as many 3D volumes: Y,N = Y
...
-x Reorient and crop 3D NIfTI images: Y,N = N
You can also set defaults by editing /Users/rorden/.dcm2nii/dcm2nii.ini
EXAMPLE: dcm2nii -a y /Users/Joe/Documents/dcm/IM_0116
Nov 10, 2016  02:11 PM | Sabrina Golde - Charité - Universitätsmedizin Berlin
RE: dcm2nii .ini-file on Mac OS Sierra
Thank you for your quick reply!
 
A) Unfortunately, I couldn't find the .ini file using any of your suggested options either. I tried searching the whole mac for the file as well earlier, but although it does not Show an error when opening the .dcm2nii-file, the according .ini-file does not seem to exist anywhere.
 
B) I am currently not sure whether DPARSFA-Toolbox also works with dcm2niix - I will definitely try it out, but I do have the same Problem concerning the .ini-file
 

 

 

 

 

 
Nov 10, 2016  02:11 PM | Chris Rorden
RE: dcm2nii .ini-file on Mac OS Sierra
1.) Can you provide the output when you run dcm2nii from the command line, e.g. 
$ ./dcm2nii
Chris Rorden's dcm2nii :: 30APR2016 64bit BSD License
reading preferences file /Users/rorden/.dcm2nii/dcm2nii.ini
...
-x Reorient and crop 3D NIfTI images: Y,N = N
You can also set defaults by editing /Users/rorden/.dcm2nii/dcm2nii.ini
EXAMPLE: dcm2nii -a y /Users/Joe/Documents/dcm/IM_0116

2.) I do not yet have MacOS 10.12 Sierra. It is possible that this new release includes new security protections that restrict my software from storing preference files. The latest download of MRIcron/dcm2nii from NITRC includes the latest code signing, so one thought is you may want to simply reinstall the software using the latest NITRC download. Using software that is distributed with the updated code signing may change some of the file writing restrictions

3.) If all else fails, you can always explicitly provide the location of a preferences file. For example, if you download the attached text file and place it in your home directory you should be able to call it with the command
./dcm2nii -b ~/dcm2nii.ini ~/tst_t1
Attachment: dcm2nii.ini
Nov 10, 2016  02:11 PM | Sabrina Golde - Charité - Universitätsmedizin Berlin
RE: dcm2nii .ini-file on Mac OS Sierra
1) The output is:
Chris Rorden's dcm2nii :: 30APR2016 64bit BSD License
reading preferences file /Users/agggold/.dcm2nii/dcm2nii.ini
Either drag and drop or specify command line options:
dcm2nii
OPTIONS:
-4 Create 4D volumes, else DTI/fMRI saved as many 3D volumes: Y,N = Y
-3 Create planar RGB images: Y,N = N
-a Anonymize [remove identifying information]: Y,N = Y
-b Load settings from specified inifile, e.g. '-b C:\set\t1.ini'
-c Collapse input folders: Y,N = Y
-d Date in filename [filename.dcm -> 20061230122032.nii]: Y,N = Y
-e Events (series/acq) in filename [filename.dcm -> s002a003.nii]: Y,N = Y
-f Source filename [e.g. filename.par -> filename.nii]: Y,N = N
-g Gzip output, filename.nii.gz [ignored if '-n n']: Y,N = Y
-i ID in filename [filename.dcm -> johndoe.nii]: Y,N = N
-k sKip initial n volumes in fMRI, e.g. '-k 2': = 0
-l pLanar RGB (Y=old Analyze; N=new VTK NIfTI): Y,N = N
-m Manually prompt user to specify output format [NIfTI input only]: Y,N = Y
-n Output .nii file [if no, create .hdr/.img pair]: Y,N = Y
-o Output Directory, e.g. 'C:\TEMP' (if unspecified, source directory is used)
-p Protocol in filename [filename.dcm -> TFE_T1.nii]: Y,N = Y
-r Reorient image to nearest orthogonal: Y,N
-s SPM2/Analyze not SPM5/NIfTI [ignored if '-n y']: Y,N = N
-t Text report (patient and scan details): Y,N = N
-v Convert every image in the directory: Y,N = Y
-x Reorient and crop 3D NIfTI images: Y,N = N
You can also set defaults by editing /Users/agggold/.dcm2nii/dcm2nii.ini
EXAMPLE: dcm2nii -a y /Users/Joe/Documents/dcm/IM_0116
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Deleting expired sessions...none found.

[Process completed]

2) I only downloaded the new MRIcron/dcm2nii from NITRC yesterday.

3) Thank you for the file. I will have to try using the toolbox with it, I will give you feedback as soon as possible.
Nov 10, 2016  02:11 PM | Chris Rorden
RE: dcm2nii .ini-file on Mac OS Sierra
You can Google "Sierra gatekeeper path randomization" for more details, but a new security feature in MacOS Sierra is that preference files are stored in random locations. So on your computer it is using the folder "/Users/agggold/.dcm2nii". As I mentioned previously, you may want to use the "-b" parameter to explicitly use a specific file.

-c
Nov 10, 2016  03:11 PM | Sabrina Golde - Charité - Universitätsmedizin Berlin
RE: dcm2nii .ini-file on Mac OS Sierra
My main problem is, as I mentioned, that I am unfortunately unable to find a folder called ".dcm2nii" in "/Users/agggold/" or any .ini-file under "agggold".
Nov 10, 2016  05:11 PM | Chris Rorden
RE: dcm2nii .ini-file on Mac OS Sierra
I do not have MacOS Sierra, so I can not replicate your problem and it is hard to troubleshoot. For example, what do you get when you type "ls -l /Users/agggold/.dcm2nii" does it report "No such file or directory" or does it detect the folder. If the latter you could just type "nano /Users/agggold/.dcm2nii/dcm2nii.ini".

I do suggest you do a Google search for "Sierra gatekeeper path randomization" and I think that will provide a solution. For example, https://github.com/potionfactory/LetsMov... suggests:
The basic gist is that if you download and run a Gatekeeper app from the Downloads folder, the OS will copy the app into a read-only disk image and run it from there instead...This applies until the user moves the app to any other location, after which the OS will just run the app normally. However, the move is only recognized if performed using the Finder

another suggestion from the web page is
  "xattr -dr com.apple.quarantine path/to/the/copied/app".
So you may try one of those. Again, I do not have Sierra, so I can not trouble shoot this for you, but it seems like Google returns a lot of possible solutions for you to try out. I would be happy to hear the solution that works for you.
Nov 11, 2016  05:11 PM | Chris Rorden
RE: dcm2nii .ini-file on Mac OS Sierra
I did try to replicate your problem by downloading the current version of "MRIcron_macOS.dmg" from NITRC to a computer running MacOS Sierra. When I tried this, everything worked fine. I wonder if the copy of dcm2nii you are trying to run was from before I implemented the MacOS code signing. 

By the way, if you want to try the latest cutting edge beta release you can always get it at:
   http://people.cas.sc.edu/rorden/SW/
I do not think this will be any different than the version on NITRC...