Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
po09i committed Nov 17, 2020
1 parent b487e66 commit 296c07d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
11 changes: 3 additions & 8 deletions shimmingtoolbox/cli/prepare_fieldmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,13 @@
@click.option('-unwrapper', type=click.Choice(['prelude']), default='prelude', help="Algorithm for unwrapping")
@click.option('-output', 'fname_output', type=click.Path(), default=os.curdir, help="Output filename for the fieldmap")
@click.option('-mask', 'fname_mask', type=click.Path(), help="Input path for a mask. Used for PRELUDE")
@click.option('-threshold', 'threshold', type=int, help="Threshold for masking. Used for: PRELUDE")
@click.option('-threshold', 'threshold', type=float, help="Threshold for masking. Used for: PRELUDE")
def prepare_fieldmap_cli(phase, fname_mag, unwrapper, fname_output, fname_mask, threshold):
"""Creates fieldmap from phase and magnitude images
Args:
phase: Input path of phase nifti file, oredered in ascending order i.e. echo1, echo2, etc...
phase: Input path of phase nifti file, oredered in ascending order i.e. echo1, echo2, etc...
"""

# flag: -unwrapper DEFAULT prelude, -method DEFAULT, mask fname
# Make sure we have a mag input, make sure we have a phase input
# Look for method, compare to number of inputs (look in header to make sure #inputs work with given input)
# for phase (phasediff or echoes)

# Get the time between echoes and calculate phase difference depending on number of echoes
if len(phase) == 1:
# phase should be a phasediff
Expand Down Expand Up @@ -91,6 +85,7 @@ def prepare_fieldmap_cli(phase, fname_mag, unwrapper, fname_output, fname_mask,

else:
# TODO: More echoes
# TODO: Add method once multiple methods are implemented
raise RuntimeError(" Number of phase filenames not supported")

# Import mask
Expand Down
5 changes: 3 additions & 2 deletions test/cli/test_prepare_fieldmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
import os
import pathlib
import tempfile
import pytest

from shimmingtoolbox.cli.prepare_fieldmap import prepare_fieldmap_cli
from shimmingtoolbox import __dir_testing__


# Add pytest prelude dependency
@pytest.mark.prelude
def test_cli_prepare_fieldmap_1_echo():
with tempfile.TemporaryDirectory(prefix='st_' + pathlib.Path(__file__).stem) as tmp:
runner = CliRunner()
Expand All @@ -28,7 +29,7 @@ def test_cli_prepare_fieldmap_1_echo():
assert os.path.isfile(fname_output)


# Add pytest prelude dependency
@pytest.mark.prelude
def test_cli_prepare_fieldmap_2_echos():
with tempfile.TemporaryDirectory(prefix='st_' + pathlib.Path(__file__).stem) as tmp:
runner = CliRunner()
Expand Down

0 comments on commit 296c07d

Please sign in to comment.