diff --git a/.github/workflows/ci-cd.yaml b/.github/workflows/ci-cd.yaml index d08e3a0..13aa043 100644 --- a/.github/workflows/ci-cd.yaml +++ b/.github/workflows/ci-cd.yaml @@ -29,9 +29,6 @@ permissions: env: # Define environment variables SCIGET_NAME: ants SCIGET_VERSION: 2.6.0 - # ANTS_VERSION: v2.5.1 - # ANTS_INSTALL_PATH: /opt/ants - # Force tox and pytest to use color FORCE_COLOR: true jobs: diff --git a/docs/source/conf.py b/docs/source/conf.py index ec3130f..e91ae16 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -8,7 +8,7 @@ # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information -project = "pydra-ants" +project = "pydra-tasks-ants" author = "Pydra Developers" copyright = f"2022-2023, {author}" release = __version__ diff --git a/pydra/tasks/ants/__init__.py b/pydra/tasks/ants/__init__.py index 79fea14..764b11c 100644 --- a/pydra/tasks/ants/__init__.py +++ b/pydra/tasks/ants/__init__.py @@ -15,7 +15,7 @@ from ._version import __version__ except ImportError: raise RuntimeError( - "pydra-ants has not been properly installed, please run " + "pydra-tasks-ants has not been properly installed, please run " f"`pip install -e {str(pkg_path)}` to install a development version" ) diff --git a/pydra/tasks/ants/v2/legacy/buildtemplateparallel.py b/pydra/tasks/ants/v2/legacy/buildtemplateparallel.py index c8b31e1..36c24d4 100644 --- a/pydra/tasks/ants/v2/legacy/buildtemplateparallel.py +++ b/pydra/tasks/ants/v2/legacy/buildtemplateparallel.py @@ -130,7 +130,7 @@ class buildtemplateparallel(shell.Task["buildtemplateparallel.Outputs"]): in_files: list[Nifti1] = shell.arg( help="list of images to generate template from", position=-1, - formatter="in_files_formatter", + formatter=in_files_formatter, ) parallelization: ty.Any = shell.arg( help="control for parallel processing (0 = serial, 1 = use PBS, 2 = use PEXEC, 3 = use Apple XGrid", @@ -149,7 +149,7 @@ class buildtemplateparallel(shell.Task["buildtemplateparallel.Outputs"]): num_cores: int = shell.arg( help="Requires parallelization = 2 (PEXEC). Sets number of cpu cores to use", requires=["parallelization"], - formatter="num_cores_formatter", + formatter=num_cores_formatter, ) max_iterations: list[int] = shell.arg( help="maximum number of iterations (must be list of integers in the form [J,K,L...]: J = coarsest resolution iterations, K = middle resolution iterations, L = fine resolution iterations", diff --git a/pydra/tasks/ants/v2/registration/ants.py b/pydra/tasks/ants/v2/registration/ants.py index e4e9594..7a4905e 100644 --- a/pydra/tasks/ants/v2/registration/ants.py +++ b/pydra/tasks/ants/v2/registration/ants.py @@ -168,7 +168,7 @@ class ANTS(shell.Task["ANTS.Outputs"]): ) moving_image: list[Nifti1] = shell.arg( help="image to apply transformation to (generally a coregisteredfunctional)", - formatter="moving_image_formatter", + formatter=moving_image_formatter, ) metric: list[ty.Any] = shell.arg(help="") metric_weight: list[float] | None = shell.arg( @@ -184,14 +184,14 @@ class ANTS(shell.Task["ANTS.Outputs"]): help="", argstr="--output-naming {output_transform_prefix}", default="out" ) transformation_model: ty.Any = shell.arg( - help="", formatter="transformation_model_formatter" + help="", formatter=transformation_model_formatter ) gradient_step_length: float = shell.arg(help="", requires=["transformation_model"]) number_of_time_steps: int = shell.arg(help="", requires=["gradient_step_length"]) delta_time: float = shell.arg(help="", requires=["number_of_time_steps"]) symmetry_type: float = shell.arg(help="", requires=["delta_time"]) use_histogram_matching: bool = shell.arg( - help="", formatter="use_histogram_matching_formatter", default=True + help="", formatter=use_histogram_matching_formatter, default=True ) number_of_iterations: list[int] = shell.arg( help="", argstr="--number-of-iterations {number_of_iterations}", sep="x" @@ -203,10 +203,10 @@ class ANTS(shell.Task["ANTS.Outputs"]): help="", argstr="--subsampling-factors {subsampling_factors}", sep="x" ) affine_gradient_descent_option: list[float] = shell.arg( - help="", formatter="affine_gradient_descent_option_formatter" + help="", formatter=affine_gradient_descent_option_formatter ) mi_option: list[int] = shell.arg(help="", argstr="--MI-option {mi_option}", sep="x") - regularization: ty.Any = shell.arg(help="", formatter="regularization_formatter") + regularization: ty.Any = shell.arg(help="", formatter=regularization_formatter) regularization_gradient_field_sigma: float = shell.arg( help="", requires=["regularization"] ) diff --git a/pydra/tasks/ants/v2/registration/composite_transform_util.py b/pydra/tasks/ants/v2/registration/composite_transform_util.py index a005e48..d04d13e 100644 --- a/pydra/tasks/ants/v2/registration/composite_transform_util.py +++ b/pydra/tasks/ants/v2/registration/composite_transform_util.py @@ -105,7 +105,7 @@ class CompositeTransformUtil(shell.Task["CompositeTransformUtil.Outputs"]): out_file: Path = shell.arg( help="Output file path (only used for disassembly).", position=2, - formatter="out_file_formatter", + formatter=out_file_formatter, ) in_file: list[TextMatrix] = shell.arg( help="Input transform file(s)", argstr="{in_file}...", position=3 @@ -113,7 +113,7 @@ class CompositeTransformUtil(shell.Task["CompositeTransformUtil.Outputs"]): output_prefix: str = shell.arg( help="A prefix that is prepended to all output files (only used for assembly).", position=4, - formatter="output_prefix_formatter", + formatter=output_prefix_formatter, default="transform", ) num_threads: int = shell.arg(help="Number of ITK threads to use", default=1) diff --git a/pydra/tasks/ants/v2/registration/measure_image_similarity.py b/pydra/tasks/ants/v2/registration/measure_image_similarity.py index 2aaed72..6143ed9 100644 --- a/pydra/tasks/ants/v2/registration/measure_image_similarity.py +++ b/pydra/tasks/ants/v2/registration/measure_image_similarity.py @@ -91,7 +91,7 @@ class MeasureImageSimilarity(shell.Task["MeasureImageSimilarity.Outputs"]): moving_image: File = shell.arg( help="Image to apply transformation to (generally a coregistered functional)" ) - metric: ty.Any = shell.arg(help="", formatter="metric_formatter") + metric: ty.Any = shell.arg(help="", formatter=metric_formatter) metric_weight: float = shell.arg( help='The "metricWeight" variable is not used.', requires=["metric"], @@ -112,7 +112,7 @@ class MeasureImageSimilarity(shell.Task["MeasureImageSimilarity.Outputs"]): ) fixed_image_mask: Nifti1 = shell.arg( help="mask used to limit metric sampling region of the fixed image", - formatter="fixed_image_mask_formatter", + formatter=fixed_image_mask_formatter, ) moving_image_mask: File | None = shell.arg( help="mask used to limit metric sampling region of the moving image", diff --git a/pydra/tasks/ants/v2/registration/registration.py b/pydra/tasks/ants/v2/registration/registration.py index 8146516..9b32071 100644 --- a/pydra/tasks/ants/v2/registration/registration.py +++ b/pydra/tasks/ants/v2/registration/registration.py @@ -623,7 +623,7 @@ class Registration(shell.Task["Registration.Outputs"]): ) fixed_image_mask: File | None = shell.arg( help="Mask used to limit metric sampling region of the fixed imagein all stages", - formatter="fixed_image_mask_formatter", + formatter=fixed_image_mask_formatter, ) fixed_image_masks: MultiInputObj = shell.arg( help='Masks used to limit metric sampling region of the fixed image, defined per registration stage(Use "NULL" to omit a mask at a given stage)' @@ -648,7 +648,7 @@ class Registration(shell.Task["Registration.Outputs"]): ) initial_moving_transform: list[TextMatrix] = shell.arg( help="A transform or a list of transforms that should be applied before the registration begins. Note that, when a list is given, the transformations are applied in reverse order.", - formatter="initial_moving_transform_formatter", + formatter=initial_moving_transform_formatter, ) invert_initial_moving_transform: MultiInputObj = shell.arg( help="One boolean or a list of booleans that indicatewhether the inverse(s) of the transform(s) definedin initial_moving_transform should be used.", @@ -656,7 +656,7 @@ class Registration(shell.Task["Registration.Outputs"]): ) initial_moving_transform_com: ty.Any | None = shell.arg( help="Align the moving_image and fixed_image before registration using the geometric center of the images (=0), the image intensities (=1), or the origin of the images (=2).", - formatter="initial_moving_transform_com_formatter", + formatter=initial_moving_transform_com_formatter, ) metric_item_trait: ty.Any = shell.arg(help="") metric_stage_trait: ty.Any = shell.arg(help="") @@ -694,7 +694,7 @@ class Registration(shell.Task["Registration.Outputs"]): help="Histogram match the images before registration.", default=True ) interpolation: ty.Any = shell.arg( - help="", formatter="interpolation_formatter", default="Linear" + help="", formatter=interpolation_formatter, default="Linear" ) interpolation_parameters: ty.Any = shell.arg(help="") write_composite_transform: bool = shell.arg( @@ -715,7 +715,7 @@ class Registration(shell.Task["Registration.Outputs"]): float: bool = shell.arg( help="Use float instead of double for computations.", argstr="--float {float:d}" ) - transforms: list[ty.Any] = shell.arg(help="", formatter="transforms_formatter") + transforms: list[ty.Any] = shell.arg(help="", formatter=transforms_formatter) transform_parameters: list[ty.Any] = shell.arg(help="") restrict_deformation: list[list[ty.Any]] = shell.arg( help="This option allows the user to restrict the optimization of the displacement field, translation, rigid or affine transform on a per-component basis. For example, if one wants to limit the deformation or rotation of 3-D volume to the first two dimensions, this is possible by specifying a weight vector of '1x1x0' for a deformation field or '1x1x0x1x1x0' for a rigid transformation. Low-dimensional restriction only works if there are no preceding transformations." @@ -733,7 +733,7 @@ class Registration(shell.Task["Registration.Outputs"]): help="", requires=["convergence_threshold"], default=[10] ) output_transform_prefix: str = shell.arg( - help="", formatter="output_transform_prefix_formatter", default="transform" + help="", formatter=output_transform_prefix_formatter, default="transform" ) output_warped_image: ty.Any = shell.arg(help="") output_inverse_warped_image: ty.Any = shell.arg( @@ -741,12 +741,12 @@ class Registration(shell.Task["Registration.Outputs"]): ) winsorize_upper_quantile: ty.Any = shell.arg( help="The Upper quantile to clip image ranges", - formatter="winsorize_upper_quantile_formatter", + formatter=winsorize_upper_quantile_formatter, default=1.0, ) winsorize_lower_quantile: ty.Any = shell.arg( help="The Lower quantile to clip image ranges", - formatter="winsorize_lower_quantile_formatter", + formatter=winsorize_lower_quantile_formatter, default=0.0, ) random_seed: int = shell.arg( diff --git a/pydra/tasks/ants/v2/registration/registration_syn_quick.py b/pydra/tasks/ants/v2/registration/registration_syn_quick.py index 65f1df7..fe7eddc 100644 --- a/pydra/tasks/ants/v2/registration/registration_syn_quick.py +++ b/pydra/tasks/ants/v2/registration/registration_syn_quick.py @@ -139,7 +139,7 @@ class RegistrationSynQuick(shell.Task["RegistrationSynQuick.Outputs"]): ) precision_type: ty.Any = shell.arg( help="precision type (default = double)", - formatter="precision_type_formatter", + formatter=precision_type_formatter, default="double", ) random_seed: int = shell.arg(help="fixed random seed", argstr="-e {random_seed}") diff --git a/pydra/tasks/ants/v2/resampling/apply_transforms.py b/pydra/tasks/ants/v2/resampling/apply_transforms.py index f667455..18922b6 100644 --- a/pydra/tasks/ants/v2/resampling/apply_transforms.py +++ b/pydra/tasks/ants/v2/resampling/apply_transforms.py @@ -142,12 +142,12 @@ class ApplyTransforms(shell.Task["ApplyTransforms.Outputs"]): argstr="--reference-image {reference_image}", ) interpolation: ty.Any = shell.arg( - help="", formatter="interpolation_formatter", default="Linear" + help="", formatter=interpolation_formatter, default="Linear" ) interpolation_parameters: ty.Any = shell.arg(help="") transforms: MultiInputObj = shell.arg( help="transform files: will be applied in reverse order. For example, the last specified transform will be applied first.", - formatter="transforms_formatter", + formatter=transforms_formatter, ) invert_transform_flags: MultiInputObj = shell.arg(help="") default_value: float = shell.arg( @@ -168,7 +168,7 @@ class Outputs(shell.Outputs): output_image: str = shell.outarg( help="output file name", path_template="output_image", - formatter="output_image_formatter", + formatter=output_image_formatter, ) diff --git a/pydra/tasks/ants/v2/resampling/apply_transforms_to_points.py b/pydra/tasks/ants/v2/resampling/apply_transforms_to_points.py index 70c6ead..218258c 100644 --- a/pydra/tasks/ants/v2/resampling/apply_transforms_to_points.py +++ b/pydra/tasks/ants/v2/resampling/apply_transforms_to_points.py @@ -57,7 +57,7 @@ class ApplyTransformsToPoints(shell.Task["ApplyTransformsToPoints.Outputs"]): ) transforms: list[TextMatrix] = shell.arg( help="transforms that will be applied to the points", - formatter="transforms_formatter", + formatter=transforms_formatter, ) invert_transform_flags: list[bool] = shell.arg( help="list indicating if a transform should be reversed" diff --git a/pydra/tasks/ants/v2/resampling/warp_image_multi_transform.py b/pydra/tasks/ants/v2/resampling/warp_image_multi_transform.py index 3a22f85..fef4f8f 100644 --- a/pydra/tasks/ants/v2/resampling/warp_image_multi_transform.py +++ b/pydra/tasks/ants/v2/resampling/warp_image_multi_transform.py @@ -128,7 +128,7 @@ class WarpImageMultiTransform(shell.Task["WarpImageMultiTransform.Outputs"]): transformation_series: list[TextFile | NiftiGz] = shell.arg( help="transformation file(s) to be applied", position=-1, - formatter="transformation_series_formatter", + formatter=transformation_series_formatter, ) invert_affine: list[int] = shell.arg( help='List of Affine transformations to invert.E.g.: [1,4,5] inverts the 1st, 4th, and 5th Affines found in transformation_series. Note that indexing starts with 1 and does not include warp fields. Affine transformations are distinguished from warp fields by the word "affine" included in their filenames.' diff --git a/pydra/tasks/ants/v2/resampling/warp_time_series_image_multi_transform.py b/pydra/tasks/ants/v2/resampling/warp_time_series_image_multi_transform.py index 358e775..acd3c09 100644 --- a/pydra/tasks/ants/v2/resampling/warp_time_series_image_multi_transform.py +++ b/pydra/tasks/ants/v2/resampling/warp_time_series_image_multi_transform.py @@ -114,7 +114,7 @@ class WarpTimeSeriesImageMultiTransform( ) out_postfix: str = shell.arg( help="Postfix that is prepended to all output files (default = _wtsimt)", - formatter="out_postfix_formatter", + formatter=out_postfix_formatter, default="_wtsimt", ) reference_image: File | None = shell.arg( @@ -137,7 +137,7 @@ class WarpTimeSeriesImageMultiTransform( ) transformation_series: list[NiftiGz] = shell.arg( help="transformation file(s) to be applied", - formatter="transformation_series_formatter", + formatter=transformation_series_formatter, ) invert_affine: list[int] = shell.arg( help='List of Affine transformations to invert.E.g.: [1,4,5] inverts the 1st, 4th, and 5th Affines found in transformation_series. Note that indexing starts with 1 and does not include warp fields. Affine transformations are distinguished from warp fields by the word "affine" included in their filenames.' diff --git a/pydra/tasks/ants/v2/segmentation/atropos.py b/pydra/tasks/ants/v2/segmentation/atropos.py index a90b518..9bf9b21 100644 --- a/pydra/tasks/ants/v2/segmentation/atropos.py +++ b/pydra/tasks/ants/v2/segmentation/atropos.py @@ -284,7 +284,7 @@ class Atropos(shell.Task["Atropos.Outputs"]): initialization: ty.Any = shell.arg( help="", requires=["number_of_tissue_classes"], - formatter="initialization_formatter", + formatter=initialization_formatter, ) kmeans_init_centers: list[ty.Any] = shell.arg(help="") prior_image: ty.Any = shell.arg( @@ -299,19 +299,19 @@ class Atropos(shell.Task["Atropos.Outputs"]): help="", argstr="--likelihood-model {likelihood_model}" ) mrf_smoothing_factor: float = shell.arg( - help="", formatter="mrf_smoothing_factor_formatter" + help="", formatter=mrf_smoothing_factor_formatter ) mrf_radius: list[int] = shell.arg(help="", requires=["mrf_smoothing_factor"]) icm_use_synchronous_update: bool = shell.arg( - help="", formatter="icm_use_synchronous_update_formatter" + help="", formatter=icm_use_synchronous_update_formatter ) maximum_number_of_icm_terations: int = shell.arg( help="", requires=["icm_use_synchronous_update"] ) - n_iterations: int = shell.arg(help="", formatter="n_iterations_formatter") + n_iterations: int = shell.arg(help="", formatter=n_iterations_formatter) convergence_threshold: float = shell.arg(help="", requires=["n_iterations"]) posterior_formulation: str = shell.arg( - help="", formatter="posterior_formulation_formatter" + help="", formatter=posterior_formulation_formatter ) use_random_seed: bool = shell.arg( help="use random seed value over constant", @@ -322,7 +322,7 @@ class Atropos(shell.Task["Atropos.Outputs"]): help="", requires=["posterior_formulation"] ) out_classified_image_name: Path = shell.arg( - help="", formatter="out_classified_image_name_formatter" + help="", formatter=out_classified_image_name_formatter ) save_posteriors: bool = shell.arg(help="") output_posteriors_name_template: str = shell.arg( diff --git a/pydra/tasks/ants/v2/segmentation/cortical_thickness.py b/pydra/tasks/ants/v2/segmentation/cortical_thickness.py index 5611927..286dc2e 100644 --- a/pydra/tasks/ants/v2/segmentation/cortical_thickness.py +++ b/pydra/tasks/ants/v2/segmentation/cortical_thickness.py @@ -257,22 +257,22 @@ class CorticalThickness(shell.Task["CorticalThickness.Outputs"]): ) anatomical_image: File = shell.arg( help="Structural *intensity* image, typically T1. If more than one anatomical image is specified, subsequently specified images are used during the segmentation process. However, only the first image is used in the registration of priors. Our suggestion would be to specify the T1 as the first image.", - formatter="anatomical_image_formatter", + formatter=anatomical_image_formatter, ) brain_template: NiftiGz = shell.arg( help="Anatomical *intensity* template (possibly created using a population data set with buildtemplateparallel.sh in ANTs). This template is *not* skull-stripped.", - formatter="brain_template_formatter", + formatter=brain_template_formatter, ) brain_probability_mask: File = shell.arg( help="brain probability mask in template space", - formatter="brain_probability_mask_formatter", + formatter=brain_probability_mask_formatter, ) segmentation_priors: list[NiftiGz] = shell.arg( - help="", formatter="segmentation_priors_formatter" + help="", formatter=segmentation_priors_formatter ) out_prefix: str = shell.arg( help="Prefix that is prepended to all output files", - formatter="out_prefix_formatter", + formatter=out_prefix_formatter, default="antsCT_", ) image_suffix: str = shell.arg( @@ -282,7 +282,7 @@ class CorticalThickness(shell.Task["CorticalThickness.Outputs"]): ) t1_registration_template: File = shell.arg( help="Anatomical *intensity* template (assumed to be skull-stripped). A common case would be where this would be the same template as specified in the -e option which is not skull stripped.", - formatter="t1_registration_template_formatter", + formatter=t1_registration_template_formatter, ) extraction_registration_mask: File = shell.arg( help="Mask (defined in the template space) used during registration for brain extraction.", diff --git a/pydra/tasks/ants/v2/segmentation/denoise_image.py b/pydra/tasks/ants/v2/segmentation/denoise_image.py index e5c9be8..f6e9c7e 100644 --- a/pydra/tasks/ants/v2/segmentation/denoise_image.py +++ b/pydra/tasks/ants/v2/segmentation/denoise_image.py @@ -93,7 +93,7 @@ class Outputs(shell.Outputs): output_image: Path = shell.outarg( help="The output consists of the noise corrected version of the input image.", path_template="{input_image}_noise_corrected", - formatter="output_image_formatter", + formatter=output_image_formatter, ) noise_image: Path | None = shell.outarg( help="Filename for the estimated noise.", diff --git a/pydra/tasks/ants/v2/segmentation/joint_fusion.py b/pydra/tasks/ants/v2/segmentation/joint_fusion.py index 88fb27c..b7cd7cb 100644 --- a/pydra/tasks/ants/v2/segmentation/joint_fusion.py +++ b/pydra/tasks/ants/v2/segmentation/joint_fusion.py @@ -236,15 +236,15 @@ class JointFusion(shell.Task["JointFusion.Outputs"]): ) target_image: list[list[File]] = shell.arg( help="The target image (or multimodal target images) assumed to be aligned to a common image domain.", - formatter="target_image_formatter", + formatter=target_image_formatter, ) atlas_image: list[list[File]] = shell.arg( help="The atlas image (or multimodal atlas images) assumed to be aligned to a common image domain.", - formatter="atlas_image_formatter", + formatter=atlas_image_formatter, ) atlas_segmentation_image: list[NiftiGz] = shell.arg( help="The atlas segmentation images. For performing label fusion the number of specified segmentations should be identical to the number of atlas image sets.", - formatter="atlas_segmentation_image_formatter", + formatter=atlas_segmentation_image_formatter, ) alpha: float = shell.arg( help="Regularization term added to matrix Mx for calculating the inverse. Default = 0.1", @@ -270,7 +270,7 @@ class JointFusion(shell.Task["JointFusion.Outputs"]): ) patch_radius: list[int] = shell.arg( help="Patch radius for similarity measures. Default: 2x2x2", - formatter="patch_radius_formatter", + formatter=patch_radius_formatter, ) patch_metric: ty.Any = shell.arg( help="Metric to be used in determining the most similar neighborhood patch. Options include Pearson's correlation (PC) and mean squares (MSQ). Default = PC (Pearson correlation).", @@ -278,13 +278,13 @@ class JointFusion(shell.Task["JointFusion.Outputs"]): ) search_radius: list[ty.Any] = shell.arg( help="Search radius for similarity measures. Default = 3x3x3. One can also specify an image where the value at the voxel specifies the isotropic search radius at that voxel.", - formatter="search_radius_formatter", + formatter=search_radius_formatter, default=[3, 3, 3], ) exclusion_image_label: list[str] = shell.arg( help="Specify a label for the exclusion region.", requires=["exclusion_image"], - formatter="exclusion_image_label_formatter", + formatter=exclusion_image_label_formatter, ) exclusion_image: list[Nifti1] = shell.arg( help="Specify an exclusion region for the given label." @@ -294,11 +294,11 @@ class JointFusion(shell.Task["JointFusion.Outputs"]): argstr="-x {mask_image}", ) out_label_fusion: Path = shell.arg( - help="The output label fusion image.", formatter="out_label_fusion_formatter" + help="The output label fusion image.", formatter=out_label_fusion_formatter ) out_intensity_fusion_name_format: str = shell.arg( help='Optional intensity fusion image file name format. (e.g. "antsJointFusionIntensity_%d.nii.gz")', - formatter="out_intensity_fusion_name_format_formatter", + formatter=out_intensity_fusion_name_format_formatter, ) out_label_post_prob_name_format: str = shell.arg( help="Optional label posterior probability image file name format.", diff --git a/pydra/tasks/ants/v2/segmentation/kelly_kapowski.py b/pydra/tasks/ants/v2/segmentation/kelly_kapowski.py index 372bbc8..3471124 100644 --- a/pydra/tasks/ants/v2/segmentation/kelly_kapowski.py +++ b/pydra/tasks/ants/v2/segmentation/kelly_kapowski.py @@ -120,7 +120,7 @@ class KellyKapowski(shell.Task["KellyKapowski.Outputs"]): ) segmentation_image: File = shell.arg( help="A segmentation image must be supplied labeling the gray and white matters. Default values = 2 and 3, respectively.", - formatter="segmentation_image_formatter", + formatter=segmentation_image_formatter, ) gray_matter_label: int = shell.arg( help="The label value for the gray matter label in the segmentation_image.", @@ -187,7 +187,7 @@ class Outputs(shell.Outputs): cortical_thickness: Path = shell.outarg( help="Filename for the cortical thickness.", path_template="{segmentation_image}_cortical_thickness", - formatter="cortical_thickness_formatter", + formatter=cortical_thickness_formatter, ) warped_white_matter: Path = shell.outarg( help="Filename for the warped white matter file.", diff --git a/pydra/tasks/ants/v2/segmentation/n4_bias_field_correction.py b/pydra/tasks/ants/v2/segmentation/n4_bias_field_correction.py index b340d9f..662433f 100644 --- a/pydra/tasks/ants/v2/segmentation/n4_bias_field_correction.py +++ b/pydra/tasks/ants/v2/segmentation/n4_bias_field_correction.py @@ -175,11 +175,11 @@ class N4BiasFieldCorrection(shell.Task["N4BiasFieldCorrection.Outputs"]): argstr="--weight-image {weight_image}", ) bspline_fitting_distance: float = shell.arg( - help="", formatter="bspline_fitting_distance_formatter" + help="", formatter=bspline_fitting_distance_formatter ) bspline_order: int = shell.arg(help="", requires=["bspline_fitting_distance"]) shrink_factor: int = shell.arg(help="", argstr="--shrink-factor {shrink_factor}") - n_iterations: list[int] = shell.arg(help="", formatter="n_iterations_formatter") + n_iterations: list[int] = shell.arg(help="", formatter=n_iterations_formatter) convergence_threshold: float = shell.arg(help="", requires=["n_iterations"]) save_bias: bool | None = shell.arg( help="True if the estimated bias should be saved to file.", default=False @@ -204,7 +204,7 @@ class Outputs(shell.Outputs): output_image: str = shell.outarg( help="output file name", path_template="{input_image}_corrected", - formatter="output_image_formatter", + formatter=output_image_formatter, ) bias_image: File | None = shell.out( help="Estimated bias", callable=bias_image_callable diff --git a/pydra/tasks/ants/v2/utils/ai.py b/pydra/tasks/ants/v2/utils/ai.py index a672a18..5db9f5a 100644 --- a/pydra/tasks/ants/v2/utils/ai.py +++ b/pydra/tasks/ants/v2/utils/ai.py @@ -84,14 +84,12 @@ class AI(shell.Task["AI.Outputs"]): ) moving_image: File = shell.arg(help="Image that will be transformed to fixed_image") fixed_image_mask: File = shell.arg( - help="fixed mage mask", formatter="fixed_image_mask_formatter" + help="fixed mage mask", formatter=fixed_image_mask_formatter ) moving_image_mask: File | None = shell.arg( help="moving mage mask", requires=["fixed_image_mask"] ) - metric: ty.Any = shell.arg( - help="the metric(s) to use.", formatter="metric_formatter" - ) + metric: ty.Any = shell.arg(help="the metric(s) to use.", formatter=metric_formatter) transform: ty.Any = shell.arg( help="Several transform options are available", argstr="-t {transform[0]}[{transform[1]}]", @@ -106,7 +104,7 @@ class AI(shell.Task["AI.Outputs"]): default=(20, 0.12), ) search_grid: ty.Any = shell.arg( - help="Translation search grid in mm", formatter="search_grid_formatter" + help="Translation search grid in mm", formatter=search_grid_formatter ) convergence: ty.Any = shell.arg( help="convergence", diff --git a/pydra/tasks/ants/v2/utils/resample_image_by_spacing.py b/pydra/tasks/ants/v2/utils/resample_image_by_spacing.py index bc1e6d2..ae3c450 100644 --- a/pydra/tasks/ants/v2/utils/resample_image_by_spacing.py +++ b/pydra/tasks/ants/v2/utils/resample_image_by_spacing.py @@ -71,7 +71,7 @@ class ResampleImageBySpacing(shell.Task["ResampleImageBySpacing.Outputs"]): help="input image file", argstr="{input_image}", position=2 ) out_spacing: ty.Any = shell.arg( - help="output spacing", position=4, formatter="out_spacing_formatter" + help="output spacing", position=4, formatter=out_spacing_formatter ) apply_smoothing: bool = shell.arg( help="smooth before resampling", argstr="{apply_smoothing:d}", position=5 diff --git a/pyproject.toml b/pyproject.toml index a88c0ea..1e9cbe4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ dependencies = [ "fileformats >=0.15.4", "fileformats-datascience >=0.3.2", "fileformats-medimage >=0.10.5", + "looseversion>=1.3.0", ] license = { file = "LICENSE" } authors = [ @@ -114,3 +115,6 @@ junit_family = "xunit2" [tool.ruff.lint] ignore = ["FBT001", "FA100"] + +[tool.pyright] +reportAssignmentType = false