v1.2 GLSL volume rendering. Able to view NIfTI, DICOM, MGH, MHD, NRRD, AFNI format images.
MRIcroGL is a cross-platform tool for viewing DICOM and NIfTI format images. It provides a drag-and-drop user interface as well as a scripting language. Please see the wiki page from more details. Note that the wiki page describes version 1.0 of the software, while this Github page is for the upcoming version 1.2. The changes are in general subtle, but the scripting has changed quite a bit.
By default, MRIcroGL 1.2 is compiled to require OpenGL 2.1 (from 2006). It can also be compiled to require OpenGL 3.3 Core (released in 2009). Alternatively, macOS users can also compile the tool for the Metal. From the user perspective, there should be no difference between these choices. If your computer does not support OpenGL 2.1, you can try MRIcron. The code can be compiled for the macOS, Linux or Windows operating system. For macOS, both ARM-based Apple Silicon and Intel-based computers are natively supported.
You can get MRIcroGL using three methods:
curl -fLO https://github.com/rordenlab/MRIcroGL/releases/latest/download/MRIcroGL_linux.zip
curl -fLO https://github.com/rordenlab/MRIcroGL/releases/latest/download/MRIcroGL_macOS.dmg
curl -fLO https://github.com/rordenlab/MRIcroGL/releases/latest/download/MRIcroGL_windows.zip
Once you have downloaded the software, extract the archive and run the executable. Visit the wiki for a full manual that includes troubleshooting.
It is generally recommended that download a pre-compiled executable (see previous section). However, you can compile your own copy from source code.
lazarus
and choose the Project
menu's Open Project
item. Select the project you wish to open (e.g. MRIcroGL.lpi).Run
command from the Run
menu compile and run your project.It is generally recommended that download a pre-compiled executable (see earlier section). However, you can compile your own copy from source code. Download and install Lazarus 2.0.6 or later, at which point the lazbuild
command should be available from the command line.
For Linux (QT5) or Windows (though see notes above), the compilation will look like this :
git clone https://github.com/rordenlab/MRIcroGL.git
lazbuild --build-ide= --add-package lazopenglcontext ./Python27-for-Lazarus/python4lazarus/python4lazarus_package.lpk
cd MRIcroGL
lazbuild -B MRIcroGL.lpr
For MacOS, you will want to specify the modern Cocoa widgetset, rather than the legacy Cocoa widgetset:
git clone https://github.com/rordenlab/MRIcroGL.git
cd MRIcroGL
lazbuild -B --ws=cocoa MRIcroGL.lpi
MRIcroGL can be compiled for Linux, macOS and Windows. Compiler directives allow MRIcroGL to be tuned for various environments. Several projects are provided with different Compiler Options. For further control, one can edit the CompilerOptions
fields of these projects for preferred builds. Here are the provided projects:
Name | Python | Metal | LLVM | cfGzip | Notes |
---|---|---|---|---|---|
MRIcroGL.lpi | Y | N | N | Y | default |
MRIcroGL_Debian.lpi | Y† | N | N | N | Debian only |
MRIcroGL_Metal | Y | Y | N | Y | macOS only |
MRIcroGL_Metal_llvm.lpi | Y | Y | Y | Y | macOS only |
MRIcroGL_NoPython.lpi | N | N | N | Y | minimal |
MRIcroGL_Py4Laz.lpi | Y* | N | N | Y | Python-for-Lazarus |
MRIcroGL_llvm.lpi | Y | N | Y | Y | macOS only |
MRIcroGL_llvm_linux.lpi | Y | N | Y | Y | linux only |
Python:
libpython3.*.so
in either /usr/local/lib
or /usr/lib
. For example, /usr/lib/python3.9/config-3.9-x86_64-linux-gnu/libpython3.9.so
.Metal:
LLVM:
cfGzip:
For the Linux (qt5) widgetset users will need to install libqt5pas. Hopefully this can be done with sudo apt install libqt5pas
. However, you can also get a Linux libqt5pas 1.2.8 or later installer online.
The MRIcroGL executable has more functionality if it can access its Resources
folder. This folder includes color lookup tables (lut
folder), Python scripts (script
), Material Capture (matcap
), GPU Shaders (shader
), default NIfTI images (standard
), NIfTI atlases (atlas
), as well as fonts and icons. Therefore, for full functionality, you want the executable to have access to this folder.
Resources
folder is placed inside the application package bundle. In other words, if your application is MRIcroGL.app
, the software expects MRIcroGL.app/Resources
.Resources
folder in the same folder as MRIcroGL.exe
.Resources
folder in the same folder as the MRIcroGL
executable. If this fails, it will look for the folder $MRICROGL_DIR
where $MRICROGL_DIR
is an environment variable. It will then look a folder in the following order (for the first pass, where the applications actual name is used MRIcroGL_QT
, and for a second pass using MRIcroGL
): /opt/MRIcroGL/Resources
/opt/MRIcroGL
/opt/MRIcroGL/Resources
/opt/MRIcroGL
/usr/local/MRIcroGL/Resources
/usr/local/MRIcroGL
/usr/local/MRIcroGL/Resources
/usr/local/MRIcroGL
/usr/local/share/MRIcroGL/Resources
/usr/local/share/MRIcroGL
/usr/local/share/MRIcroGL/Resources
/usr/local/share/MRIcroGL
Linux GNOME users may also want to setup a desktop file with a name like MRIcroGL.desktop
. A sample is provided in the Resources folder, but this will require minor editing since the Exec
and Icon
path must be absolute not relative.
You can use all the functions of MRIcroGL using the graphical interface. You can also create Python scripts to get precise results our automate laborious tasks.
You can also control MRIcroGL from the command line.
mricrogl myscript.py
. This method also allows you to control MRIcroGL from your preferred programming languages.mricrogl
from the command line instead of typing the full path. You can do this by running open -a TextWrangler ~/.bash_profile
and then adding an alias, for example adding the line mricrogl='/Applications/MRIcroGL.app/Contents/MacOS/MRIcroGL'
(assuming the application is in this folder).mricrogl -R
.MRIcroGL -std -dr 2000 6000 motor -cm actc -dr 2 4
. In this example, the FSL standard image is loaded as a background with a display range of 2000...6000, and the image 'motor' is loaded as an overlay with the 'actc' colormap and a display range of 2...4. Note that the options are a subset of those available for fsleyes.
MRIcroGL uses NIfTI as its native format. However, you can drag-and-drop files of various formats and the software should automatically detect and load these images.
Convert DICOM to NIfTI
item for advanced conversion.Convert TIFF to NIfTI
item to convert most TIFFs (this allows you to specify pixel dimensions).To Convert Folder of 2D TIFFs to NIfTI
to stack a series of TIFF files as a single volume (e.g. DigiMorph).If your image format is not supported directly by MRIcroGL, you may want to see if it is supported by the Bio-Formats module of ImageJ/Fiji. If so, you can open the image with the module and save it as NIfTI or NRRD to read it with MRIcroGL.
MRIcroGL uses single-pass raycasting to generate volume renderings.
There are many terrific free tools for viewing medical imaging data. Since they are free, consider downloading a few and using the best tool for the task at hand. Below are a couple of my personal favorites.