From 4e87d7f64adc51dda1692ae7fee130a476847a0e Mon Sep 17 00:00:00 2001 From: Philip Cook Date: Tue, 5 Dec 2023 16:38:29 -0500 Subject: [PATCH] STYLE: Remove unused CLI mangling code --- ants/registration/apply_transforms.py | 9 ------ ants/registration/resample_image.py | 41 +++++++++++---------------- 2 files changed, 16 insertions(+), 34 deletions(-) diff --git a/ants/registration/apply_transforms.py b/ants/registration/apply_transforms.py index 2b8575c6..d7b01046 100644 --- a/ants/registration/apply_transforms.py +++ b/ants/registration/apply_transforms.py @@ -161,15 +161,6 @@ def apply_transforms(fixed, moving, transformlist, myargs = utils._int_antsProcessArguments(args) - # NO CLUE WHAT THIS DOES OR WHY IT'S NEEDED - for jj in range(len(myargs)): - if myargs[jj] is not None: - if myargs[jj] == '-': - myargs2 = [None]*(len(myargs)-1) - myargs2[:(jj-1)] = myargs[:(jj-1)] - myargs2[jj:(len(myargs)-1)] = myargs[(jj+1):(len(myargs))] - myargs = myargs2 - myverb = int(verbose) if verbose: print(myargs) diff --git a/ants/registration/resample_image.py b/ants/registration/resample_image.py index 8e16203b..0151b5e1 100644 --- a/ants/registration/resample_image.py +++ b/ants/registration/resample_image.py @@ -1,5 +1,5 @@ - + __all__ = ['resample_image', 'resample_image_to_target'] @@ -11,7 +11,7 @@ def resample_image(image, resample_params, use_voxels=False, interp_type=1): """ - Resample image by spacing or number of voxels with + Resample image by spacing or number of voxels with various interpolators. Works with multi-channel images. ANTsR function: `resampleImage` @@ -20,14 +20,14 @@ def resample_image(image, resample_params, use_voxels=False, interp_type=1): --------- image : ANTsImage input image - + resample_params : tuple/list vector of size dimension with numeric values - + use_voxels : boolean True means interpret resample params as voxel counts - - interp_type : integer + + interp_type : integer one of 0 (linear), 1 (nearest neighbor), 2 (gaussian), 3 (windowed sinc), 4 (bspline) Returns @@ -58,20 +58,20 @@ def resample_image(image, resample_params, use_voxels=False, interp_type=1): def resample_image_to_target(image, target, interp_type='linear', imagetype=0, verbose=False, **kwargs): """ - Resample image by using another image as target reference. - This function uses ants.apply_transform with an identity matrix + Resample image by using another image as target reference. + This function uses ants.apply_transform with an identity matrix to achieve proper resampling. - + ANTsR function: `resampleImageToTarget` Arguments --------- image : ANTsImage image to resample - + target : ANTsImage image of reference, the output will be in this space - + interp_type : string Choice of interpolator. Supports partial matching. linear @@ -84,16 +84,16 @@ def resample_image_to_target(image, target, interp_type='linear', imagetype=0, v hammingWindowedSinc lanczosWindowedSinc genericLabel use this for label images - - imagetype : integer + + imagetype : integer choose 0/1/2/3 mapping to scalar/vector/tensor/time-series - + verbose : boolean print command and run verbose application of transform. - + kwargs : keyword arguments additional arugment passed to antsApplyTransforms C code - + Returns ------- ANTsImage @@ -145,15 +145,6 @@ def resample_image_to_target(image, target, interp_type='linear', imagetype=0, v myargs = utils._int_antsProcessArguments(args) - # NO CLUE WHAT THIS DOES OR WHY IT'S NEEDED - for jj in range(len(myargs)): - if myargs[jj] is not None: - if myargs[jj] == '-': - myargs2 = [None]*(len(myargs)-1) - myargs2[:(jj-1)] = myargs[:(jj-1)] - myargs2[jj:(len(myargs)-1)] = myargs[(jj+1):(len(myargs))] - myargs = myargs2 - myverb = int(verbose) processed_args = myargs + ['-z', str(1), '-v', str(myverb), '--float', str(1), '-e', str(imagetype)]