Skip to content
Snippets Groups Projects
Commit c7d72d08 authored by Lucia D. Hradecka's avatar Lucia D. Hradecka
Browse files

refactor to comply with PEP8: naming conventions + isinstance instead of type

parent c259b2fd
No related branches found
No related tags found
1 merge request!12Make version 1.3.2 default
......@@ -33,7 +33,7 @@ from src.biovol_typing import TypeTripletFloat, TypeSpatioTemporalCoordinate, Ty
DEBUG = False
SITK_interpolation = {
SITK_INTERPOLATION_CONSTANTS = {
'nearest': 'sitkNearestNeighbor',
'linear': 'sitkLinear',
'bspline': 'sitkBSpline',
......@@ -98,9 +98,9 @@ def sitk_to_np(sitk_img: sitk.Image,
def parse_itk_interpolation(interpolation: str) -> str:
assert interpolation in SITK_interpolation.keys(), f'parameter {interpolation} ' \
f'is not in the list of supported interpolation techniques: {SITK_interpolation.keys()}'
return SITK_interpolation[interpolation]
assert interpolation in SITK_INTERPOLATION_CONSTANTS.keys(), f'parameter {interpolation} ' \
f'is not in the list of supported interpolation techniques: {SITK_INTERPOLATION_CONSTANTS.keys()}'
return SITK_INTERPOLATION_CONSTANTS[interpolation]
def get_affine_transform(domain_limit,
......
......@@ -74,7 +74,7 @@ def parse_limits(input_limit: Union[float, TypePairFloat, TypeTripletFloat, Type
"""
# input_limit = x : float --> return (1/x, x, 1/x, x, 1/x, x) if scale, else (-x, +x, -x, +x, -x, +x)
if (type(input_limit) is float) or (type(input_limit) is int):
if isinstance(input_limit, float) or isinstance(input_limit, int):
limit_range = parse_helper_affine_limits_1d(input_limit, scale=scale)
return limit_range * 3
......@@ -120,7 +120,7 @@ def parse_pads(pad_size: Union[int, TypePairInt, TypeSextetInt]) -> TypeSextetIn
input_limit = (a, b, c, d, e, f) --> return (a, b, c, d, e, f)
"""
if type(pad_size) is int:
if isinstance(pad_size, int):
return tuple((pad_size,) * 6)
return parse_helper_sextet_common_cases(pad_size, return_float=False)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment