Skip to content

Commit

Permalink
Merge pull request #516 from ANTsX/rm_cli_mangling
Browse files Browse the repository at this point in the history
STYLE: Remove unused CLI mangling code
  • Loading branch information
cookpa authored Dec 6, 2023
2 parents 78dad33 + 4e87d7f commit b3eb9f7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 34 deletions.
9 changes: 0 additions & 9 deletions ants/registration/apply_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
41 changes: 16 additions & 25 deletions ants/registration/resample_image.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@



__all__ = ['resample_image',
'resample_image_to_target']
Expand All @@ -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`
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)]
Expand Down

0 comments on commit b3eb9f7

Please sign in to comment.