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

Implements MTsat function #1672

Merged
merged 28 commits into from May 5, 2018
Merged

Implements MTsat function #1672

merged 28 commits into from May 5, 2018

Conversation

jcohenadad
Copy link
Member

@jcohenadad jcohenadad commented Apr 10, 2018

Requirements

Description of the Change

Implementation of the MTsat and T1 mapping function based on Helms et al. This implementation is also a test-bench for various SCT coding guidelines that have recently been discussed. Notably:

Applicable Issues

Implements #1073

@jcohenadad jcohenadad self-assigned this Apr 10, 2018
@jcohenadad jcohenadad added feature category: new functionality card:WORK_IN_PROCESS labels Apr 10, 2018
nii_b1map=None, verbose=1):
"""
Compute MTsat and T1 map based on FLASH scans
Parameters
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like @perone I'd advocate for the standard reST docstring style (example). If you want to use numpy or google style, you're missing new lines before the Parameters/Returns headings.

tr_t1 *= 0.001

# Convert flip angles into radians
fa_mt_rad = math.radians(fa_mt)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the rest of the code overwhelmingly uses numpy, you might as well use np.radians() here.


# ignore warnings from division by zeros (will deal with that later)
# note: do not use over='ignore' because it results in wrong T1 maps
seterr_old = np.seterr(over='ignore', divide='ignore', invalid='ignore')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment says « do not use over='ignore' because it results in wrong T1 maps » but code does it. Is the comment up-to-date?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah shit ;-) not up to date


def run_main(args):
import sct_utils as sct
from spinalcordtoolbox.mtsat import mtsat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could mtsat be in a folder that may contain other "similar" tools?
from x.something import something to import a module is not the prettiest.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, however I believe this requires group discussion. Opened an issue here

@jcohenadad jcohenadad added this to the 3.1.2 milestone Apr 12, 2018
Copy link
Contributor

@zougloub zougloub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be an issue with nii_b1map parameter passing, other than that everything looks good.


# compute MTsat
nii_mtsat, nii_t1map = compute_mtsat(nii_mt, nii_pd, nii_t1, tr_mt, tr_pd, tr_t1, fa_mt, fa_pd, fa_t1,
nii_b1map=None, verbose=verbose)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter nii_b1map is always None despite having loaded nii_b1map before?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, fixed in a3f9d23

@jcohenadad jcohenadad merged commit ade1abe into master May 5, 2018
@jcohenadad jcohenadad deleted the jca_MTsat branch May 5, 2018 00:36
jcohenadad added a commit that referenced this pull request May 7, 2018
* master:
  Implements MTsat function (#1672)
  Keep intermediate temp folder by default (#1694)
  sct_deepseg_sc - Issue when input is .nii instead of .nii.gz (#1634, #1659)
  sct_image: remove file removal kludge (#1688) (#1705)
  Concatenate string to keep previously assigned subtitle field (fixes #1690) (#1692)
  Enable input file with label at a specific disc (#1698)

# Conflicts:
#	spinalcordtoolbox/gui/sagittal.py
jcohenadad added a commit that referenced this pull request May 9, 2018
* master: (31 commits)
  Control the brightness of the image in the GUI. (#1684)
  Refactor things dealing with dataset `info_label.txt` metadata file (#1676)
  Implements MTsat function (#1672)
  Keep intermediate temp folder by default (#1694)
  sct_deepseg_sc - Issue when input is .nii instead of .nii.gz (#1634, #1659)
  sct_image: remove file removal kludge (#1688) (#1705)
  Concatenate string to keep previously assigned subtitle field (fixes #1690) (#1692)
  Enable input file with label at a specific disc (#1698)
  Use python  concurrent.futures instead of multiprocessing  (#1587)
  Fixup benign installation failures from #1679 (#1680)
  output of -display ordered per label value (#1686)
  Slice counting fixed (#1687)
  Travis: binaries: install libvtk6 or libvtk7
  Travis: isct_propseg: install more deps
  Travis: attempt to build propseg
  isct_propseg: link with ITKIOTransformBase
  isct_propseg: some C++ clean-up
  Rearranged the imports and removed the cyclic imports. (#1511)
  msct_register_landmarks: fixup default path_qc
  sct_warp_template: WarpTemplate: remove dead ctor argument
  ...
jcohenadad added a commit that referenced this pull request Dec 18, 2019
* sct_compute_mtsat: added functions

* fixed argument issues

* fixed wrong initialization location

* manage output files

* cosmetic change

* clip unrealistic T1 and MTsat values (unfinished)

* fixed issue introduced by discarding overflow warnings

* now ignoring overflow only for computing MTsat

* added viewer at the end

* sct_utils:display_viewer_syntax: added hsv option

* adjusted output viewer colormap

* make sure np.seterr are set back to original before quitting function

* now imposing elementwise multiplication in float to prevent overflow

* fixed another multiplication with float

* removed old comment

* switched to reST comment style

* removed math dependency

* BUG: fixed wrong passing of argument


Former-commit-id: ade1abe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature category: new functionality sct_compute_mtsat context:
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants