Mdreg

Latest version: v0.4.1

Safety actively analyzes 685525 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

0.4.1

Summary
- Extended documentation including function-level docstrings
- New examples
- 3D and multi-slice 2D
- utilities: jacobian and norm of deformation field
- improved error handling for elastix coregistration
- correct handling of Nan and non-contiguous arrays in elastix
- proper handling of floating point images in skimage registration

What's Changed
* 3D compatibility update and tutorials by EShalom in https://github.com/QIB-Sheffield/mdreg/pull/53
* Updates docs and main fit defaults by EShalom in https://github.com/QIB-Sheffield/mdreg/pull/55
* Deformation Field QA Functions by alexdaniel654 in https://github.com/QIB-Sheffield/mdreg/pull/54
* Small docs update by EShalom in https://github.com/QIB-Sheffield/mdreg/pull/56
* bug fix + force_2d option by plaresmedima in https://github.com/QIB-Sheffield/mdreg/pull/57
* v0.4.1 by plaresmedima in https://github.com/QIB-Sheffield/mdreg/pull/58
* update docs by plaresmedima in https://github.com/QIB-Sheffield/mdreg/pull/59
* v0.4.1 by plaresmedima in https://github.com/QIB-Sheffield/mdreg/pull/60

New Contributors
* alexdaniel654 made their first contribution in https://github.com/QIB-Sheffield/mdreg/pull/54

**Full Changelog**: https://github.com/QIB-Sheffield/mdreg/compare/v0.4.0...v0.4.1

0.4.0

===========
We're happy to announce the release of mdreg 0.4.0!

Summary
----------

Major new release with breaking changes in the API. As of v0.4.0 mdreg has moved over to a simpler functional programming interface with significant customization options. Older versions are deprecated and should no longer be used.

For full details, please see the new documentation pages: https://qib-sheffield.github.io/mdreg/

0.3.9

Stable version used in ongoing projects.

Future changes in v0.4 will not be backwards compatible

0.3.8

Consolidating release history

0.3.0

**Full Changelog**: https://github.com/QIB-Sheffield/mdreg/compare/v0.1.0...v0.3.0

Description
Python implementation of model-based image coregistration
for quantitative medical imaging applications.

The distribution comes with a number of common signal models and uses [ITK-Elastix](https://github.com/InsightSoftwareConsortium/ITKElastix) for deformable image registration.

Installation
Run `pip install mdreg`.

Example data
Example data in [DICOM format](https://shorturl.at/rwCUV) are provided for testing the setup.

How to use
Input data must be image arrays in numpy format, with dimensions `(x,y,z,t)` or `(x,y,t)`.
To perform MDR on an image array `im` with default settings do:

python
from mdreg import MDReg

mdr = MDReg()
mdr.set_array(im)
mdr.fit()


When fitting is complete the motion-corrected data are in `mdr.coreg` in the same dimensions
as the original `im`. The calculated deformation fields in format `(x,y,d,t)` or `(x,y,z,d,t)`
can be found as `mdr.deformation`. The dimension `d` holds `x`, `y` components
of the deformation field, and a third `z` component if the input array is 3D.

The default settings will apply a linear signal model and coregistration
as defined in the elastix parameter file `Bsplines.txt`.

Customization

MDR can be configured to apply different signal models and elastix coregistration settings.
A number of example models and alternative elastix parameter files are included
in the distribution as templates.

The following example fits a mono-exponential decay and applies an elastix parameter file
`par_file` optimized for a previous DTI-MRI study:

python
from mdreg import MDReg
from mdreg.models import exponential_decay

mdr = MDReg()
mdr.set_array(im)
mdr.signal_model = exponential_decay
mdr.read_elastix(par_file)
mdr.fit()


The signal model often depends on fixed constants and signal parameters
such as sequence parameters in MRI, or patient-specific constants. These
should all be grouped in a list and set before running the signal model.

Equally elastix parameters can be fine tuned, either by importing a
dedicated elastix file, or by modifying the settings.

Then a number of parameters are available to optimize MDR such as
the precision (stopping criterion) and maximum number of iterations.

Some examples:

python
from mdreg import MDReg
from mdreg.models import exponential_decay

t = [0.0, 1.25, 2.50, 3.75] time points for exponential in sec

mdr = MDReg()
mdr.set_array(im)
mdr.signal_parameters = t
mdr.signal_model = exponential_decay
mdr.set_elastix(MaximumNumberOfIterations = 256) change defaults
mdr.precision = 0.5 default = 1
mdr.max_iterations = 3 default = 5
mdr.fit()


`mdreg` comes with a number of options to
export results and diagnostics:

python
mdr.export_unregistered = True export parameters and fit without registration
mdr.export_path = filepath default is a results folder in the current working directory
mdr.export() export results after calling fit.


This export creates movies of original images, motion corrected images,
modelfits, and maps of the fitted parameters.

Model fitting without motion correction

`MDReg` also can be used to perform model fitting
without correcting the motion. The following script
fits a linearised exponential model to each pixel and exports data
of model and fit:

python
from mdreg import MDReg
from mdreg.models import exponential_decay

mdr = MDReg()
mdr.set_array(im)
mdr.signal_model = linear_exponential_decay
mdr.fit_signal()
mdr.export_data()
mdr.export_fit()


Defining new MDR models

A model must be defined as a separate module or class with two required functions `main()` and `pars()`.

`pars()` must return a list of strings specifying the names of the model parameters.
`main(im, const)` performs the pixel based model fitting and has two required arguments.
`im` is a numpy ndarray with dimensions `(x,y,z,t)`, `(x,y,t)` or `(x,t)`. `const` is a list
of any constant model parameters.

The function must return the fit to the model as an numpy ndarray with the same dimensions
as `im`, and an ndarray `pars` with dimensions `(x,y,z,p)`, `(x,y,p)` or `(x,p)`. Here `p` enumerates
the model parameters.

Context

`mdreg` was first developed for use in quantitative renal MRI in the iBEAt study,
and validated against group-wise model-free registration
(Tagkalakis F, et al. Model-based motion correction outperforms a model-free method in quantitative renal MRI. Abstract-1383, ISMRM 2021).

Acknowledgement

The iBEAt study is part of the BEAt-DKD project. The BEAt-DKD project has received funding from the Innovative Medicines Initiative 2 Joint Undertaking under grant agreement No 115974. This Joint Undertaking receives support from the European Union’s Horizon 2020 research and innovation programme and EFPIA with JDRF. For a full list of BEAt-DKD partners, see www.beat-dkd.eu.

Authors

Kanishka Sharma, Joao Almeida e Sousa, Steven Sourbron

0.1.0

Summary

This is the first official release of the `MDR-Library`. You can install it by running `pip install mdr-library`. The documentation can be consulted [here](https://qib-sheffield.github.io/MDR_Library/).

**Full Changelog**: https://github.com/QIB-Sheffield/MDR-Library/commits/v0.1.0

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.