Skip to content

Commit

Permalink
Update sitk_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
pooya-mohammadi committed Jan 22, 2025
1 parent 3db3d31 commit 69b7903
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion deep_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .utils.lib_utils.integeration_utils import import_lazy_module

# Deep Utils version number
__version__ = "1.3.61"
__version__ = "1.3.62"

from .utils.constants import DUMMY_PATH, Backends

Expand Down
12 changes: 6 additions & 6 deletions deep_utils/medical/sitk_utils/sitk_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ def save_sample(input_sample: np.ndarray, org_sitk_img: Optional[Image],
sample_sitk.SetSpacing(spacing)
else:
spacing = list(org_sitk_img.GetSpacing())
if remove_index and len(spacing) > 3:
if remove_index is not None and len(spacing) > 3:
del spacing[remove_index]
if slice_index and len(spacing) > 3:
if slice_index is not None and len(spacing) > 3:
del spacing[slice_index]
sample_sitk.SetSpacing(spacing)

Expand All @@ -187,10 +187,10 @@ def save_sample(input_sample: np.ndarray, org_sitk_img: Optional[Image],
org_flat_direction = np.array(org_sitk_img.GetDirection())
direction_size = int(math.sqrt(len(org_flat_direction)))
original_direction = org_flat_direction.reshape(direction_size, direction_size)
if remove_index and direction_size > 3:
if remove_index is not None and direction_size > 3:
original_direction = np.delete(original_direction, remove_index, 0)
original_direction = np.delete(original_direction, remove_index, 1)
if slice_index and direction_size > 3:
if slice_index is not None and direction_size > 3:
original_direction = np.delete(original_direction, slice_index, 0)
original_direction = np.delete(original_direction, slice_index, 1)

Expand All @@ -202,9 +202,9 @@ def save_sample(input_sample: np.ndarray, org_sitk_img: Optional[Image],
else:
original_origin = list(org_sitk_img.GetOrigin())
org_size = len(original_origin)
if remove_index and org_size > 3:
if remove_index is not None and org_size > 3:
del original_origin[remove_index]
if slice_index and org_size > 3:
if slice_index is not None and org_size > 3:
del original_origin[slice_index]

# submatrix_direction = original_direction[:3, :3].flatten()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import setuptools

VERSION = "1.3.61"
VERSION = "1.3.62"

long_description = open("Readme.md", mode="r", encoding="utf-8").read()

Expand Down

0 comments on commit 69b7903

Please sign in to comment.