Package: asldro
OverviewASL DRO is software that can generate digital reference objects for Arterial Spin Labelling (ASL) MRI.
It creates synthetic raw ASL data according to set acquisition and data format parameters, based
on input ground truth maps for:Perfusion rateTransit timeIntrinsic MRI parameters: M0, T1, T2, T2*Tissue segmentation (defined as a single tissue type per voxel)Synthetic data is generated in Brain Imaging Data Structure format, comprising of a NIFTI image file
and accompanying json sidecar containing parameters.ASLDRO was developed to address the need to test ASL image processing pipelines with data that has
a known ground truth. A strong emphasis has been placed on ensuring traceability of the developed
code, in particular with respect to testing.  The DRO pipelines uses a ‘pipe and filter’ architecture
with ‘filters’ performing data processing, which provides a common interface between processing
blocks.InstallationASLDRO can be installed as a module directly from the python package index.  Once installed it can
simply be run as a command-line tool.  For more information how to use a python package in this
way please seehttps://docs.python.org/3/installing/index.htmlPython VersionWe recommend using the latest version of Python. ASL DRO supports Python
3.7 and newer.DependenciesThese distributions will be installed automatically when installing ASL DRO.nibabelprovides read / write access to some common neuroimaging file formatsnumpyprovides efficient calculations with arrays and matricesjsonschemaprovides an implementation of JSON Schema validation for Pythonnilearnprovides image manipulation tools and statistical learning for neuroimaging dataVirtual environmentsUse a virtual environment to manage the dependencies for your project, both in
development and in production.What problem does a virtual environment solve? The more Python projects you
have, the more likely it is that you need to work with different versions of
Python libraries, or even Python itself. Newer versions of libraries for one
project can break compatibility in another project.Virtual environments are independent groups of Python libraries, one for each
project. Packages installed for one project will not affect other projects or
the operating system’s packages.Python comes bundled with thevenvmodule to create virtual
environments.Create an environmentCreate a project folder and avenvfolder within:$ mkdir myproject
$ cd myproject
$ python3 -m venv venvOn Windows:$ py -3 -m venv venvActivate the environmentBefore you work on your project, activate the corresponding environment:$ . venv/bin/activateOn Windows:> venv\Scripts\activateYour shell prompt will change to show the name of the activated
environment.Install ASL DROWithin the activated environment, use the following command to install
ASL DRO:$ pip install asldroASL DRO is now installed. Check out the Quickstart or go to the
Documentation Overview.QuickstartGetting startedEager to get started? This page gives a good introduction to ASL DRO.
Follow Installation to set up a project and install ASL DRO first.After installation the command line toolasldrowill be made available. You can run:asldro generate path/to/output_file.zipto run the DRO generation as-per the ASL White Paper specification. The output file may
be either .zip or .tar.gz.Is it also possible to specify a parameter file, which will override any of the default values:asldro generate --params path/to/input_params.json path/to/output_file.zipIt is possible to create an example parameters file containing the model defaults by running:asldro output params /path/to/input_params.jsonwhich will create the/path/to/input_params.jsonfile. The parameters may be adjusted as
necessary and used with the ‘generate’ command.For details on input parameters see ParametersIt is also possible to output the high-resolution ground-truth (HRGT) files.
To get a list of the available data, type:asldro output hrgt -hTo output the HRGT, type:asldro output hrgt HRGT OUTPUT_DIRwhere HRGT is the code of the files to download, and OUTPUT_DIR is the directory to output to.Pipeline detailsThere are three pipelines available in ASLDROThe full ASL pipeline.A structural MRI pipeline (generates gradient echo, spin echo or inversion recovery signal).A ground truth pipeline that simply resamples the input ground truth to the specified resolution.In a single instance of ASLDRO, the input parameter file can configure any number and configurations
of these pipelines to be run, much in the way that this can be done on an MRI scanner.The full ASL pipeline comprises of:Loading in the ground truth volumes.Producing $\Delta M$ using the General Kinetic Model for the specified ASL parameters.Generating synthetic M0, Control and Label volumes.Applying motionSampling at the acquisition resolutionAdding instrument and physiological pseudorandom noise.The structural pipeline excludes the General Kinetic Model, and just generates volumes with synthetic
MR contrast.  The ground truth pipeline only has the motion model and sampling.Each volume described inasl_contexthas the motion, resampling and noise processes applied
independently. The rotation and translation arrays in the input parameters describe this motion, and
the the random number generator is initialised with the same seed each time the DRO is run, so each
volume will have noise that is unique, but statistically the same.Ifdesired_snris set to0, the resultant images will not have any noise applied.Each pipeline outputs files in BIDS (https://bids.neuroimaging.io/) format, consisting of a NIFTI
image file and accompanying json sidecar. In the case of an ASL image an
additional ‘*_aslcontext.tsv’ file is also generated which describes the ASL volumes
present in the timeseries.The DRO pipeline is summarised in this schematic (click to view full-size):DevelopmentDevelopment of this software project must comply with a few code styling/quality rules and processes:Pylint must be used as the linter for all source code. A linting configuration can be found in.pylintrc. There should be no linting errors when checking in code.Before committing any files,blackmust be run with the default settings in order perform autoformatting on the project.Before pushing any code, make sure the CHANGELOG.md is updated as per the instructions in the CHANGELOG.md file.The project’s software development processes must be used (found here).