Skip to content

Commit

Permalink
BUG: string formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
ntustison committed Jul 14, 2024
1 parent f9d124e commit ff740a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ants/ops/add_noise_to_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,31 @@ def add_noise_to_image(image,
if len(noise_parameters) != 2:
raise ValueError("Incorrect number of parameters.")

libfn = get_lib_fn("additiveGaussianNoiseF" % image_dimension)
libfn = get_lib_fn("additiveGaussianNoiseF%i" % image_dimension)
noise = libfn(image.pointer, noise_parameters[0], noise_parameters[1])
output_image = ants.from_pointer(noise).clone('float')
return output_image
elif noise_model == 'saltandpepper':
if len(noise_parameters) != 3:
raise ValueError("Incorrect number of parameters.")

libfn = get_lib_fn("saltAndPepperNoiseF" % image_dimension)
libfn = get_lib_fn("saltAndPepperNoiseF%i" % image_dimension)
noise = libfn(image.pointer, noise_parameters[0], noise_parameters[1], noise_parameters[2])
output_image = ants.from_pointer(noise).clone('float')
return output_image
elif noise_model == 'shot':
if not isinstance(noise_parameters, (int, float)):
raise ValueError("Incorrect parameter specification.")

libfn = get_lib_fn("shotNoiseF" % image_dimension)
libfn = get_lib_fn("shotNoiseF%i" % image_dimension)
noise = libfn(image.pointer, noise_parameters)
output_image = ants.from_pointer(noise).clone('float')
return output_image
elif noise_model == 'speckle':
if not isinstance(noise_parameters, (int, float)):
raise ValueError("Incorrect parameter specification.")

libfn = get_lib_fn("speckleNoiseF" % image_dimension)
libfn = get_lib_fn("speckleNoiseF%i" % image_dimension)
noise = libfn(image.pointer, noise_parameters)
output_image = ants.from_pointer(noise).clone('float')
return output_image
Expand Down

0 comments on commit ff740a4

Please sign in to comment.