open-discussion > trying to open a data file from command line
Showing 1-5 of 5 posts
Display:
Results per page:
Apr 18, 2020  07:04 AM | sujan dasmahapatra
trying to open a data file from command line
I am trying to open a data file from command line. I opened a command prompt. and the typed this command.

MRIcroGL.exe   C:\data\T1.nii


But with this, the file is not opening. it is opening some junk default file. I am sure may be the syntax is not correct. Please help me to get rid of it. Let me know how we can open a file from command line.


regards
Apr 20, 2020  12:04 PM | Chris Rorden
RE: trying to open a data file from command line
You have two options:

1.) Use '/' instead of '\'. Explanation: command line options create a Python script that is executed on launch. You can see this by opening the Scripting panel on the left side of the application. The '\' character is the escape character for Python, e.g. "\t" means 'tab' and '\n' means 'New Line'. Since Linux/MacOS/Unix uses '/' as the file separator, the s is not an issue. However, Windows typically uses '\', though it allows '/'. 

 MRIcroGL.exe C:/data/T1.nii

2.) Upgrade to MRIcroGL 1.2.20200331. It will automatically convert your '\' characters to '/' when building your script.
Apr 21, 2020  10:04 PM | sujan dasmahapatra
RE: trying to open a data file from command line
Chris,

I tried both ways. '\' and '/' and also '\\' in Windows. I am working in Windows 10. using cmd.exe it is not working. It is always loading the default settings for MRIcroGL.exe.

I am opening cmd.exe and trying to open like this
MRIcroGL.exe  C:/data/T1.nii or MRIcroGL.exe C:\data\T1.nii

But it it not opening either ways. it is loading MRIcroGL.exe, but the file is wrong. Kindly tell me if you have more answers.

Is there any documentation for command line switch for MRIcroGL? If so please share the link. I didn't find any thing online in this regard.
Apr 22, 2020  11:04 AM | Chris Rorden
RE: trying to open a data file from command line
I can not replicate your issue with the current version of MRIcroGL. See Attached image:
 0. Launch from command line using path to image you wish to open.
 1. Red Arrow: Check that you are using version 1.2.20200331. If not, get the latest version and make sure it is the version in your path.
 2. Purple Arrow: Open the scripting panel on the right, ensure it is loading the image you specified from the command line.
 3. Green Arrow: In the Scripting panel compiler output, check that the script executed successfully with no errors. If it reports 'Unable to load "D:/MRIcroGL/nogo.nii.gz:' or something like that, make sure a file exists at the correct location.
Attachment: success.png
Apr 22, 2020  12:04 PM | Chris Rorden
RE: trying to open a data file from command line
Updated wiki