Skip to content

Commit

Permalink
Convert output types from File to String
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitj committed Dec 18, 2024
1 parent 83a5959 commit a6b96c7
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 27 deletions.
57 changes: 43 additions & 14 deletions descriptors/fsl/fugue.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
{
"id": "fmap_out_file",
"name": "Fmap out file",
"type": "File",
"type": "String",
"value-key": "[FMAP_OUT_FILE]",
"command-line-flag": "--savefmap",
"command-line-flag-separator": "=",
Expand Down Expand Up @@ -103,7 +103,9 @@
"command-line-flag": "--icorr",
"description": "Apply intensity correction to unwarping (pixel shift method only).",
"optional": true,
"requires-inputs": ["shift_in_file"]
"requires-inputs": [
"shift_in_file"
]
},
{
"id": "icorr_only",
Expand All @@ -113,7 +115,9 @@
"command-line-flag": "--icorronly",
"description": "Apply intensity correction only.",
"optional": true,
"requires-inputs": ["unwarped_file"]
"requires-inputs": [
"unwarped_file"
]
},
{
"id": "in_file",
Expand Down Expand Up @@ -178,7 +182,12 @@
"value-key": "[OUTPUT_TYPE]",
"description": "'nifti' or 'nifti_pair' or 'nifti_gz' or 'nifti_pair_gz'. Fsl output type.",
"optional": true,
"value-choices": ["NIFTI", "NIFTI_PAIR", "NIFTI_GZ", "NIFTI_PAIR_GZ"]
"value-choices": [
"NIFTI",
"NIFTI_PAIR",
"NIFTI_GZ",
"NIFTI_PAIR_GZ"
]
},
{
"id": "pava",
Expand Down Expand Up @@ -268,7 +277,7 @@
{
"id": "shift_out_file",
"name": "Shift out file",
"type": "File",
"type": "String",
"value-key": "[SHIFT_OUT_FILE]",
"command-line-flag": "--saveshift",
"command-line-flag-separator": "=",
Expand Down Expand Up @@ -304,29 +313,40 @@
"command-line-flag-separator": "=",
"description": "'x' or 'y' or 'z' or 'x-' or 'y-' or 'z-'. Specifies direction of warping (default y).",
"optional": true,
"value-choices": ["x", "y", "z", "x-", "y-", "z-"]
"value-choices": [
"x",
"y",
"z",
"x-",
"y-",
"z-"
]
},
{
"id": "unwarped_file",
"name": "Unwarped file",
"type": "File",
"type": "String",
"value-key": "[UNWARPED_FILE]",
"command-line-flag": "--unwarp",
"command-line-flag-separator": "=",
"description": "Apply unwarping and save as filename.",
"optional": true,
"requires-inputs": ["in_file"]
"requires-inputs": [
"in_file"
]
},
{
"id": "warped_file",
"name": "Warped file",
"type": "File",
"type": "String",
"value-key": "[WARPED_FILE]",
"command-line-flag": "--warp",
"command-line-flag-separator": "=",
"description": "Apply forward warping and save as filename.",
"optional": true,
"requires-inputs": ["in_file"]
"requires-inputs": [
"in_file"
]
}
],
"output-files": [
Expand Down Expand Up @@ -363,19 +383,28 @@
{
"id": "mutex_group",
"name": "Mutex group",
"members": ["warped_file", "unwarped_file"],
"members": [
"warped_file",
"unwarped_file"
],
"mutually-exclusive": true
},
{
"id": "mutex_group_2",
"name": "Mutex group 2",
"members": ["save_unmasked_shift", "save_shift"],
"members": [
"save_unmasked_shift",
"save_shift"
],
"mutually-exclusive": true
},
{
"id": "mutex_group_3",
"name": "Mutex group 3",
"members": ["save_fmap", "save_unmasked_fmap"],
"members": [
"save_fmap",
"save_unmasked_fmap"
],
"mutually-exclusive": true
}
],
Expand All @@ -385,4 +414,4 @@
"type": "docker",
"image": "brainlife/fsl:6.0.4-patched2"
}
}
}
26 changes: 13 additions & 13 deletions python/src/niwrap/fsl/fugue.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import dataclasses

FUGUE_METADATA = Metadata(
id="d264261226a39feda65ebd1686c5c1c1076e293f.boutiques",
id="e92886e40bebff1fca6ad036e63b3a6f487c4e4c.boutiques",
name="fugue",
package="fsl",
container_image_tag="brainlife/fsl:6.0.4-patched2",
Expand Down Expand Up @@ -37,7 +37,7 @@ def fugue(
dwell_time: float | None = None,
dwell_to_asym_ratio: float | None = None,
fmap_in_file: InputPathType | None = None,
fmap_out_file: InputPathType | None = None,
fmap_out_file: str | None = None,
forward_warping: bool = False,
fourier_order: int | None = None,
icorr: bool = False,
Expand All @@ -58,12 +58,12 @@ def fugue(
save_unmasked_fmap: bool = False,
save_unmasked_shift: bool = False,
shift_in_file: InputPathType | None = None,
shift_out_file: InputPathType | None = None,
shift_out_file: str | None = None,
smooth2d: float | None = None,
smooth3d: float | None = None,
unwarp_direction: typing.Literal["x", "y", "z", "x-", "y-", "z-"] | None = None,
unwarped_file: InputPathType | None = None,
warped_file: InputPathType | None = None,
unwarped_file: str | None = None,
warped_file: str | None = None,
runner: Runner | None = None,
) -> FugueOutputs:
"""
Expand Down Expand Up @@ -133,7 +133,7 @@ def fugue(
if fmap_in_file is not None:
cargs.append("--loadfmap=" + execution.input_file(fmap_in_file))
if fmap_out_file is not None:
cargs.append("--savefmap=" + execution.input_file(fmap_out_file))
cargs.append("--savefmap=" + fmap_out_file)
if forward_warping:
cargs.append("--forward_warping")
if fourier_order is not None:
Expand Down Expand Up @@ -175,23 +175,23 @@ def fugue(
if shift_in_file is not None:
cargs.append("--loadshift=" + execution.input_file(shift_in_file))
if shift_out_file is not None:
cargs.append("--saveshift=" + execution.input_file(shift_out_file))
cargs.append("--saveshift=" + shift_out_file)
if smooth2d is not None:
cargs.append("--smooth2=" + str(smooth2d))
if smooth3d is not None:
cargs.append("--smooth3=" + str(smooth3d))
if unwarp_direction is not None:
cargs.append("--unwarpdir=" + unwarp_direction)
if unwarped_file is not None:
cargs.append("--unwarp=" + execution.input_file(unwarped_file))
cargs.append("--unwarp=" + unwarped_file)
if warped_file is not None:
cargs.append("--warp=" + execution.input_file(warped_file))
cargs.append("--warp=" + warped_file)
ret = FugueOutputs(
root=execution.output_file("."),
fmap_out_file_outfile=execution.output_file(pathlib.Path(fmap_out_file).name) if (fmap_out_file is not None) else None,
shift_out_file_outfile=execution.output_file(pathlib.Path(shift_out_file).name) if (shift_out_file is not None) else None,
unwarped_file_outfile=execution.output_file(pathlib.Path(unwarped_file).name) if (unwarped_file is not None) else None,
warped_file_outfile=execution.output_file(pathlib.Path(warped_file).name) if (warped_file is not None) else None,
fmap_out_file_outfile=execution.output_file(fmap_out_file) if (fmap_out_file is not None) else None,
shift_out_file_outfile=execution.output_file(shift_out_file) if (shift_out_file is not None) else None,
unwarped_file_outfile=execution.output_file(unwarped_file) if (unwarped_file is not None) else None,
warped_file_outfile=execution.output_file(warped_file) if (warped_file is not None) else None,
)
execution.run(cargs)
return ret
Expand Down

0 comments on commit a6b96c7

Please sign in to comment.