.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated\examples\use_cases\plot_molli_kidney.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_generated_examples_use_cases_plot_molli_kidney.py: =============================================== Multi-slice MOLLI T1-mapping in the kidney =============================================== This example shows how mdreg can be used to perform 2D motion correction slice-by-slice on a 4D array, for the case of Look-Locker T1 mapping. .. GENERATED FROM PYTHON SOURCE LINES 11-13 Setup ----- .. GENERATED FROM PYTHON SOURCE LINES 13-25 .. code-block:: Python import numpy as np import mdreg # Fetch the multi-slice MOLLI dataset and plot data = mdreg.fetch('MOLLI') # Get the relevant variables array = data['array'] # Visualise the motion anim = mdreg.plot.animation(array, vmin=0, vmax=1e4) .. container:: sphx-glr-animation .. raw:: html
.. GENERATED FROM PYTHON SOURCE LINES 26-32 Perform slice-by-slice motion correction ---------------------------------------- Slice-by-slice analysis works the same way as single-slice or 3D analysis. We just have to remember to set the keyword argument *force_2d* to True so `~mdreg.fit` knows that we want 2D motion correction. This overrules the default behaviour of fitting 3D data with 3D motion correction: .. GENERATED FROM PYTHON SOURCE LINES 32-48 .. code-block:: Python coreg, fit, transfo, pars = mdreg.fit( array, fit_image={ 'func': mdreg.fit_abs_exp_recovery_2p, 'TI': np.array(data['TI'])/1000, }, fit_coreg={ 'package': 'elastix', 'spacing': data['pixel_spacing'], 'FinalGridSpacingInPhysicalUnits': 50.0, }, force_2d=True, verbose=2, ) .. rst-class:: sphx-glr-script-out .. code-block:: none Fitting slice: 0%| | 0/2 [00:00
.. rst-class:: sphx-glr-timing **Total running time of the script:** (28 minutes 39.794 seconds) .. _sphx_glr_download_generated_examples_use_cases_plot_molli_kidney.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_molli_kidney.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_molli_kidney.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_molli_kidney.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_