-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/python3 | ||
# -*- coding: utf-8 -* | ||
|
||
import click | ||
import os | ||
|
||
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) | ||
|
||
|
||
@click.command( | ||
context_settings=CONTEXT_SETTINGS, | ||
) | ||
@click.option('-phase', 'fname_phase', type=click.Path(), required=True, help="Input path of phase nifti file") | ||
@click.option('-mag', 'fname_mag', type=click.Path(), required=True, help="Input path of mag nifti file") | ||
@click.option('-output', 'path_output', type=click.Path(), default=os.curdir, help="Output path for the fieldmap") | ||
def prepare_fieldmap_cli(fname_phase, fname_mag, path_output): | ||
"""Creates fieldmap from phase and magnitute images""" | ||
|
||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/python3 | ||
# -*- coding: utf-8 -* | ||
|
||
from click.testing import CliRunner | ||
import os | ||
import pathlib | ||
import tempfile | ||
|
||
from shimmingtoolbox.cli.prepare_fieldmap import prepare_fieldmap_cli | ||
from shimmingtoolbox import __dir_testing__ | ||
|
||
|
||
def test_cli_prepare_fieldmap(): | ||
with tempfile.TemporaryDirectory(prefix='st_' + pathlib.Path(__file__).stem) as tmp: | ||
runner = CliRunner() | ||
|
||
# TODO: use phase 1 and phase 2 from sub_fieldmap | ||
fname_phasediff = os.path.join(__dir_testing__, 'realtime_zshimming_data', 'nifti', 'sub-example', 'fmap', | ||
'sub-example_phasediff.nii.gz') | ||
fname_mag = os.path.join(__dir_testing__, 'realtime_zshimming_data', 'nifti', 'sub-example', 'fmap', | ||
'sub-example_magnitude1.nii.gz') | ||
# fname_phase1 = os.path.join(__dir_testing__, 'sub-fieldmap', 'fmap', 'sub-fieldmap_phase1.nii.gz') | ||
# fname_phase2 = os.path.join(__dir_testing__, 'sub-fieldmap', 'fmap', 'sub-fieldmap_phase2.nii.gz') | ||
# fname_mag = os.path.join(__dir_testing__, 'sub-fieldmap', 'fmap', 'sub-fieldmap_magnitude1.nii.gz') | ||
|
||
result = runner.invoke(prepare_fieldmap_cli, ['-phase', fname_phasediff, '-mag', fname_mag, | ||
'-output', tmp]) | ||
|
||
assert result.exit_code == 0 |