Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nx10 committed Nov 15, 2024
2 parents e43814f + 08b3b87 commit b672311
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 13 deletions.
19 changes: 14 additions & 5 deletions descriptors/afni/3dcalc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "3dcalc",
"command-line": "3dcalc [EXPR] [IN_FILE_A] [IN_FILE_B] [IN_FILE_C] [OTHER] [OVERWRITE] [SINGLE_IDX] [START_IDX] [STOP_IDX]",
"command-line": "3dcalc [IN_FILE_A] [IN_FILE_B] [IN_FILE_C] [OTHER] [OVERWRITE] [SINGLE_IDX] [START_IDX] [STOP_IDX] [EXPR] [PREFIX]",
"author": "AFNI Developers",
"description": "AFNI's calculator program.",
"url": "https://afni.nimh.nih.gov/",
Expand All @@ -11,7 +11,8 @@
"type": "String",
"value-key": "[EXPR]",
"description": "Expr.",
"optional": false
"optional": false,
"command-line-flag": "-expr"
},
{
"id": "in_file_a",
Expand Down Expand Up @@ -85,6 +86,15 @@
"description": "Stop index for in_file_a.",
"optional": true,
"requires-inputs": ["start_idx"]
},
{
"id": "prefix",
"name": "Prefix",
"type": "String",
"value-key": "[PREFIX]",
"description": "Output image file name.",
"optional": true,
"command-line-flag": "-prefix"
}
],
"output-files": [
Expand All @@ -93,9 +103,8 @@
"id": "out_file",
"optional": true,
"description": "Output image file name.",
"path-template": "[IN_FILE_A]",
"value-key": "[OUT_FILE]",
"command-line-flag": "-prefix"
"path-template": "[PREFIX]",
"value-key": "[PREFIX]"
}
],
"tool-version": "24.2.06",
Expand Down
22 changes: 16 additions & 6 deletions python/src/niwrap/afni/v_3dcalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import dataclasses

V_3DCALC_METADATA = Metadata(
id="66f28a66a111cc3612e13fb86d7e368e7be0a5a2.boutiques",
id="f5920a7aeb8d11c3fc7da3fd2f8b59f05d574b09.boutiques",
name="3dcalc",
package="afni",
container_image_tag="afni/afni_make_build:AFNI_24.2.06",
Expand All @@ -20,20 +20,21 @@ class V3dcalcOutputs(typing.NamedTuple):
"""
root: OutputPathType
"""Output root folder. This is the root folder for all outputs."""
out_file: OutputPathType
out_file: OutputPathType | None
"""Output image file name."""


def v_3dcalc(
expr: str,
in_file_a: InputPathType,
expr: str,
in_file_b: InputPathType | None = None,
in_file_c: InputPathType | None = None,
other: InputPathType | None = None,
overwrite: bool = False,
single_idx: int | None = None,
start_idx: int | None = None,
stop_idx: int | None = None,
prefix: str | None = None,
runner: Runner | None = None,
) -> V3dcalcOutputs:
"""
Expand All @@ -44,15 +45,16 @@ def v_3dcalc(
URL: https://afni.nimh.nih.gov/
Args:
expr: Expr.
in_file_a: Input file to 3dcalc.
expr: Expr.
in_file_b: Operand file to 3dcalc.
in_file_c: Operand file to 3dcalc.
other: Other options.
overwrite: Overwrite output.
single_idx: Volume index for in_file_a.
start_idx: Start index for in_file_a.
stop_idx: Stop index for in_file_a.
prefix: Output image file name.
runner: Command runner.
Returns:
NamedTuple of outputs (described in `V3dcalcOutputs`).
Expand All @@ -61,7 +63,6 @@ def v_3dcalc(
execution = runner.start_execution(V_3DCALC_METADATA)
cargs = []
cargs.append("3dcalc")
cargs.append(expr)
cargs.extend([
"-a",
execution.input_file(in_file_a)
Expand All @@ -86,9 +87,18 @@ def v_3dcalc(
cargs.append(str(start_idx))
if stop_idx is not None:
cargs.append(str(stop_idx))
cargs.extend([
"-expr",
expr
])
if prefix is not None:
cargs.extend([
"-prefix",
prefix
])
ret = V3dcalcOutputs(
root=execution.output_file("."),
out_file=execution.output_file(pathlib.Path(in_file_a).name),
out_file=execution.output_file(prefix) if (prefix is not None) else None,
)
execution.run(cargs)
return ret
Expand Down
28 changes: 26 additions & 2 deletions python/src/niwrap/ants/ants_apply_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import dataclasses

ANTS_APPLY_TRANSFORMS_METADATA = Metadata(
id="84800d70a4619489f4cd962873674d0233d3976b.boutiques",
id="51e7058afdec76cc8dda4686e9c908617a912917.boutiques",
name="antsApplyTransforms",
package="ants",
container_image_tag="antsx/ants:v2.5.3",
Expand Down Expand Up @@ -227,6 +227,29 @@ def run(
return cargs


@dataclasses.dataclass
class AntsApplyTransformsMultiLabelnoparams:
"""
Multi label interpolation.
"""

def run(
self,
execution: Execution,
) -> list[str]:
"""
Build command line arguments. This method is called by the main command.
Args:
execution: The execution object.
Returns:
Command line arguments
"""
cargs = []
cargs.append("MultiLabel")
return cargs


@dataclasses.dataclass
class AntsApplyTransformsSigma:
"""
Expand Down Expand Up @@ -562,7 +585,7 @@ def ants_apply_transforms(
output: typing.Union[AntsApplyTransformsWarpedOutput, AntsApplyTransformsCompositeDisplacementFieldOutput, AntsApplyTransformsGenericAffineTransformOutput],
dimensionality: typing.Literal[2, 3, 4] | None = None,
input_image_type: typing.Literal[0, 1, 2, 3, 4, 5] | None = None,
interpolation: typing.Union[AntsApplyTransformsLinear, AntsApplyTransformsNearestNeighbor, AntsApplyTransformsMultiLabel, AntsApplyTransformsGaussian, AntsApplyTransformsBspline, AntsApplyTransformsCosineWindowedSinc, AntsApplyTransformsWelchWindowedSinc, AntsApplyTransformsHammingWindowedSinc, AntsApplyTransformsLanczosWindowedSinc, AntsApplyTransformsGenericLabel] | None = None,
interpolation: typing.Union[AntsApplyTransformsLinear, AntsApplyTransformsNearestNeighbor, AntsApplyTransformsMultiLabelnoparams, AntsApplyTransformsMultiLabel, AntsApplyTransformsGaussian, AntsApplyTransformsBspline, AntsApplyTransformsCosineWindowedSinc, AntsApplyTransformsWelchWindowedSinc, AntsApplyTransformsHammingWindowedSinc, AntsApplyTransformsLanczosWindowedSinc, AntsApplyTransformsGenericLabel] | None = None,
output_data_type: typing.Literal["char", "uchar", "short", "int", "float", "double", "default"] | None = None,
transform: list[typing.Union[AntsApplyTransformsTransformFileName, AntsApplyTransformsUseInverse]] | None = None,
default_value: float | None = None,
Expand Down Expand Up @@ -713,6 +736,7 @@ def ants_apply_transforms(
"AntsApplyTransformsLanczosWindowedSinc",
"AntsApplyTransformsLinear",
"AntsApplyTransformsMultiLabel",
"AntsApplyTransformsMultiLabelnoparams",
"AntsApplyTransformsNearestNeighbor",
"AntsApplyTransformsOutputs",
"AntsApplyTransformsParam",
Expand Down

0 comments on commit b672311

Please sign in to comment.