I have been working on this toolbox for years and recently started making the code available online which took considerable extra effort putting everything into the proper formats and generating documentation and usage demonstrations. I thought it would be nice to also show this to the wolfram community so here it is.
QMRITools is written in Mathematica using Wolfram Workbench and Eclipse and contains a collection of tools and functions for processing quantitative MRI data. The toolbox does not provide a GUI and its primary goal is to allow for fast and batch data processing, and facilitate development and prototyping of new functions. The core of the toolbox contains various functions for data manipulation and restructuring.
The toolbox was developed mostly in the context of quantitative muscle, nerve and cardiac magnetic resonance imaging. The library of functions grows along with the research it is used for and started as a toolbox to analyze DWI data of muscle. Although there exist many different software packages and code repositories for much of the functionality in this toolbox, I was in need of one that did all. Furthermore, most diffusion packages are optimized for brain analysis and provide limited flexibility and i just like writing code my self.
QMRITools is developed for Mathematica.
It contains the following toolboxes:
The website with more information about the toolbox can be found here. Documentation of all functions and their options is fully integrated in the Mathematica documentation. The toolbox always works within the latest version of Mathematica and does not support any backward compatibility.
After the toolbox is installed correctly it should show up as a package in the Mathematica add-ons (which was a pain and is badly documented).
All code and documentation is maintained and uploaded to github using Workbench. An online HTML version of the full documentation can be found here. To fix the HMTL compilation i had to write some custom scripts based on code i found online (again a pain and badly documented).
The latest release can be found here.
Install the toolbox in the Mathematica UserBaseDirectory > Applications.
Ideally i would like to push the toolbox as a packlet but again this has proven to be a pain and is badly documented.
Some functions of QMRITools call on external executables and software.
These executables need to be present in "QMRITools\Applications" and are included in the release.
If for any reason you want to use other (older/newer) versions you can replace them but functionality is not guaranteed.
For the latest version of these tools and their user license please visit their website.
All functionality is tested under Windows 10 with the latest Mathematica version.
The Mathematica code is cross platform compatible with the exception of the external tools which are compiled for each OS.
The toolbox provides compiled versions for each OS but their functionality is not guaranteed.
The Elastix version used is 4.9 with OpenCL support. Additionally Elastix needs to be compiles with the PCA metrics, all DTI related parameters and all affine related parameters.
Although cross platform compatibility is provided I have only limited options for testing so if any issues arise please let me know.
The release contains a zip file DemoAndTest.zip in which there is a file
demo.nb, a folder
DemoData and a folder
To have a global overview of the functionality of the toolbox you can download this folder and run the
By default the
demo.nb looks for the folders
Testing in the same folder as the notebook.
In the first section of the demo notebook the toolbox is loaded and two tests are performed. The first test is to check of all files that are needed to run the toolbox are present. The second test runs after the toolbox is loaded and checks if all the functions and their options that are defined are correct.
Using the toolbox
The toolbox can be loaded by using:
If you want to monitor the package loading you can use:
QMRITools`$Verbose = True; <<QMRITools`
A list of all QMRITools packages is generated by
A list of all DTITools functions or functions per toolbox is generated by
To print the documentation of all functions use
A list off all functions and their help can be found in
All-Functions.nb, which is alos availible as a pdf file.
The toolbox contains over 250 Functions and options of processing and analyzing data.
A summary of the core functionality is listed below.
- Diffusion Analysis
- Signal drift correction
- LLS, WLLS and iWLLS methods
- REKINDLE outlier detection
- IVIM fitting (fixed parameters, back-projection and Bayesian fitting)
- Parameter fitting using histogram analysis
- Joining and sorting of multiple series of the same volume
- Joining multiple stacks with slice overlap into one stack
- Diffusion Gradients optimization
- Single and multi shell
- Rotating and correcting Bmatrix
- Actual b-value estimation by gradient sequence integration
- Gradient visualization
- Noise suppression
- LMMSE noise suppression
- PCA noise suppression based on ramom matrix theory
- Anisotropic tensor smoothing using diffusion filter.
- Importing and Exporting
- Dicom data (classing and enhanced file format)
- Nifti data (.nii and .img .hdr, supports .gz files)
- Compatible with ExplorDTI and Viste for fiber tractography
- Data visualization
- 2D 3D and 4D viewer
- Multiple images: Transparent overlay, difference and, checkboard overlays
- Legend bars and image labels
- Saving to pdf, jpg, animated gif and movie
- Automate and threshold masking
- Extracting parameters form masks
- Smoothing masks
- Smoothing muscle segmentation
- Motion and distortion correction (Registration using elastix)
- Rigid, affine, b-spline and cyclic registration
- nD to nD registration
- Automated series processing
- Slice to slice motion correction of 3D and 4D data
- Dixon Reconstruction
- B0 phase unwrapping
- DIXON iDEAL reconstruction with T2start
- Relaxometry fitting
- T2 fitting
- T1rho fitting
- Tri Exponential T2 fitting
- EPG based T2 fitting with slice profile
- Simulation Framework
- Diffuison tensor simulation and analysis
- Bloch and EPG simulations
- Cardiac DTI models (fiber architecture)
- Cardiac Diffusion analysis
- Breathing motion correction
- Corrupted slice rejection
- Local myocardial coordinate system calculation
- helix angle and fiber architecture matrix
- AHA 17 parameter description
- Transmural parameter description
Note that restrictions imposed by these patents (and possibly others)
exist independently of and may be in conflict with the freedoms granted
in BSD-3-Clause license, which refers to copyright of the program, not patents
for any methods that it implements. Both copyright and patent law must
be obeyed to legally use and redistribute this program and it is not the
purpose of this license to induce you to infringe any patents or other
property right claims or to contest validity of any such claims. If you
redistribute or use the program, then this license merely protects you
from committing copyright infringement. It does not protect you from
committing patent infringement. So, before you do anything with this
program, make sure that you have permission to do so not merely in terms
of copyright, but also in terms of patent law.
Some code in the NiiTools packages was based on https://github.com/tomdelahaije/nifti-converter