Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mdr t1 molli #228

Open
wants to merge 33 commits into
base: dev
Choose a base branch
from
Open

Mdr t1 molli #228

wants to merge 33 commits into from

Conversation

plaresmedima
Copy link

New mdr keyword in T1 class

  • Purpose: introduce a backwards compatible option to perform motion correction.

  • Usage: setting mdr=True in T1() performs motion correction prior to computing the parameter maps. The default is False.

map = T1(pixel_array, TI, affine, mdr=True)

  • Example: output with and without mdr=True (see below - note the sharper kidney outline when mdr=True). This example is generated by a new module test_mdreg.py, current in /tests. This may not be the appropriate place for it as it is not a proper unit test - more of an illustration.

  • New attribute: This PR also introduces a new attribute deformation_field, which has the value None when mdr=False

  • New requirement: This brings in mdreg as a requirement, which ships with elastix and skimage.

  • Note: There is currently still some inline comments that can be removed or shortened once they are addressed. For instance the current version still includes a hack to avoid the problem of autoselecting the wrong model, which still happened in this eample. This needs another solution but cannot be addressed at the level of mdr. There are also questions that are more an issue of design and the general approach in ukat, e.g. whether we expose coregistration options in the API or not.

  • See also Model Driven Registration #164 and MDR #183. The solution here should apply to other classes as well so we should be able to add mdr as an option everywhere with the same API (mdr=True keyword).

t1_mdr

Note this is not a proper test - this file probably belongs elsewhere - maybe can become the basis for a tutorial on motion correction.
@pep8speaks
Copy link

pep8speaks commented Oct 1, 2024

Hello @plaresmedima, thank you for updating!

Cheers! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated at 2025-01-03 16:16:42 UTC

@plaresmedima plaresmedima changed the base branch from master to dev October 1, 2024 22:19
Copy link

codecov bot commented Oct 2, 2024

Codecov Report

Attention: Patch coverage is 96.61017% with 2 lines in your changes missing coverage. Please review.

Project coverage is 97.94%. Comparing base (7211a80) to head (df0389d).

Files with missing lines Patch % Lines
ukat/mapping/t1.py 94.59% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #228      +/-   ##
==========================================
- Coverage   97.96%   97.94%   -0.02%     
==========================================
  Files          48       48              
  Lines        4466     4522      +56     
==========================================
+ Hits         4375     4429      +54     
- Misses         91       93       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

plaresmedima and others added 5 commits November 8, 2024 14:12
The motion correction is no always done with molli off even if molli=True in the function call

Extended the Test to include all calling options
Try adding 3.12, probably wont work yet.
@alexdaniel654 alexdaniel654 added this to the v0.8.0 milestone Nov 15, 2024
@alexdaniel654 alexdaniel654 linked an issue Nov 15, 2024 that may be closed by this pull request
@alexdaniel654
Copy link
Member

alexdaniel654 commented Nov 15, 2024

TODO Before Merge

In a very rough order

Things to check when testing

  • Magnitude corrected and abs data
  • 2D and 3D images
  • Masks
  • MOLLI
  • 2/3 Parameter fits

alexdaniel654 and others added 11 commits November 15, 2024 12:05
Also tidied up some comments and did some pep8 fixes
These are now actually required by mdreg
Can't see any obvious way of passing different TI per slice to mdreg so moved the slice by slice iteration into ukat (just copy and pasted the relevant code from mdreg).
This was causing problems for mdreg
Quite different results on Mac, Windows and Linux but this is an mdreg/elastix thing.
To see if this fixes the windows fatal exception
and pip cache on CI runs
Currently mdreg doesn't do anything if a mask is applied. i.e. setting `mdr=True` is the same as `mdr=False` but takes longer. As such a `ValueError` is thrown. Need to have a wider discussion about if we want masking to work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Model Driven Registration
3 participants