Skip to content

Commit efbde47

Browse files
Merge pull request #55 from alexdaniel654/rel/v1.0.1
rel/v1.0.1
2 parents b856341 + f3ecd61 commit efbde47

File tree

8 files changed

+50
-43
lines changed

8 files changed

+50
-43
lines changed

.github/workflows/python_ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
os: [ubuntu-latest, windows-latest, macos-latest]
17-
python-version: [3.8, 3.9, "3.10"]
17+
python-version: [3.9, "3.10", "3.11"]
1818

1919
steps:
2020
- uses: actions/checkout@v2

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [1.0.1] - 2023-09-05
4+
5+
### Fixed
6+
* A lot of dependency updates
7+
* Patched away from the security issue with scipy 1.10.0
8+
39
## [1.0.0] - 2022-06-09
410

511
### Added

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors:
55
given-names: "Alexander J"
66
orcid: "https://orcid.org/0000-0003-2353-3283"
77
title: "Segmentation Metrics"
8-
version: 1.0.0
8+
version: 1.0.1
99
doi: 10.5281/zenodo.6576199
10-
date-released: 2022-06-09
10+
date-released: 2023-09-05
1111
url: "https://github.com/alexdaniel654/Segmentation_Metrics"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Segmentation Metrics
22
[![Python CI](https://github.com/alexdaniel654/Segmentation_Metrics/actions/workflows/python_ci.yml/badge.svg)](https://github.com/alexdaniel654/Segmentation_Metrics/actions/workflows/python_ci.yml)
33
[![PyPI version](https://badge.fury.io/py/segmentationmetrics.svg)](https://badge.fury.io/py/segmentationmetrics)
4+
[![Downloads](https://static.pepy.tech/badge/segmentationmetrics)](https://pepy.tech/project/segmentationmetrics)
45
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
56
[![DOI](https://zenodo.org/badge/494534661.svg)](https://zenodo.org/badge/latestdoi/494534661)
67
### Volumetric binary mask segmentation accuracy metrics

requirements.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
absl-py==1.1.0
2-
numpy==1.22.4
3-
pandas==1.4.2
4-
pytest==7.1.2
5-
scikit-image==0.19.2
6-
scipy==1.8.1
1+
absl-py==1.4.0
2+
numpy==1.25.2
3+
pandas==2.1.0
4+
pytest==7.4.1
5+
scikit-image==0.21.0
6+
scipy==1.11.2

segmentationmetrics/surface_distance/metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def _check_3d_numpy_array(name, array):
4646

4747
def _assert_is_bool_numpy_array(name, array):
4848
_assert_is_numpy_array(name, array)
49-
if array.dtype != np.bool:
49+
if array.dtype != bool:
5050
raise ValueError("The argument {!r} should be a numpy array of type bool, "
5151
"not {}".format(name, array.dtype))
5252

segmentationmetrics/tests/test_surface_distance.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,16 @@ def _assert_metrics(self,
8181
places=places)
8282

8383
@parameterized.parameters((
84-
np.zeros([2, 2, 2], dtype=np.bool),
85-
np.zeros([2, 2], dtype=np.bool),
84+
np.zeros([2, 2, 2], dtype=bool),
85+
np.zeros([2, 2], dtype=bool),
8686
[1, 1],
8787
), (
88-
np.zeros([2, 2], dtype=np.bool),
89-
np.zeros([2, 2, 2], dtype=np.bool),
88+
np.zeros([2, 2], dtype=bool),
89+
np.zeros([2, 2, 2], dtype=bool),
9090
[1, 1],
9191
), (
92-
np.zeros([2, 2], dtype=np.bool),
93-
np.zeros([2, 2], dtype=np.bool),
92+
np.zeros([2, 2], dtype=bool),
93+
np.zeros([2, 2], dtype=bool),
9494
[1, 1, 1],
9595
))
9696
def test_compute_surface_distances_raises_on_incompatible_shapes(
@@ -100,12 +100,12 @@ def test_compute_surface_distances_raises_on_incompatible_shapes(
100100
surface_distance.compute_surface_distances(mask_gt, mask_pred, spacing_mm)
101101

102102
@parameterized.parameters((
103-
np.zeros([2], dtype=np.bool),
104-
np.zeros([2], dtype=np.bool),
103+
np.zeros([2], dtype=bool),
104+
np.zeros([2], dtype=bool),
105105
[1],
106106
), (
107-
np.zeros([2, 2, 2, 2], dtype=np.bool),
108-
np.zeros([2, 2, 2, 2], dtype=np.bool),
107+
np.zeros([2, 2, 2, 2], dtype=bool),
108+
np.zeros([2, 2, 2, 2], dtype=bool),
109109
[1, 1, 1, 1],
110110
))
111111
def test_compute_surface_distances_raises_on_invalid_shapes(
@@ -118,8 +118,8 @@ def test_compute_surface_distances_raises_on_invalid_shapes(
118118
class SurfaceDistance2DTest(SurfaceDistanceTest, parameterized.TestCase):
119119

120120
def test_on_2_pixels_2mm_away(self):
121-
mask_gt = np.zeros((128, 128), np.bool)
122-
mask_pred = np.zeros((128, 128), np.bool)
121+
mask_gt = np.zeros((128, 128), bool)
122+
mask_pred = np.zeros((128, 128), bool)
123123
mask_gt[50, 70] = 1
124124
mask_pred[50, 72] = 1
125125
surface_distances = surface_distance.compute_surface_distances(
@@ -160,7 +160,7 @@ def test_two_squares_shifted_by_one_pixel(self):
160160
[0, 0, 0, 0, 0, 0],
161161
[0, 0, 0, 0, 0, 0],
162162
],
163-
dtype=np.bool)
163+
dtype=bool)
164164

165165
mask_pred = np.asarray(
166166
[
@@ -171,7 +171,7 @@ def test_two_squares_shifted_by_one_pixel(self):
171171
[0, 0, 0, 0, 0, 0],
172172
[0, 0, 0, 0, 0, 0],
173173
],
174-
dtype=np.bool)
174+
dtype=bool)
175175

176176
vertical = 2
177177
horizontal = 1
@@ -236,8 +236,8 @@ def test_two_squares_shifted_by_one_pixel(self):
236236
mask_gt, mask_pred)))
237237

238238
def test_empty_prediction_mask(self):
239-
mask_gt = np.zeros((128, 128), np.bool)
240-
mask_pred = np.zeros((128, 128), np.bool)
239+
mask_gt = np.zeros((128, 128), bool)
240+
mask_pred = np.zeros((128, 128), bool)
241241
mask_gt[50, 60] = 1
242242
surface_distances = surface_distance.compute_surface_distances(
243243
mask_gt, mask_pred, spacing_mm=(3, 2))
@@ -253,8 +253,8 @@ def test_empty_prediction_mask(self):
253253
expected_volumetric_dice=0.0)
254254

255255
def test_empty_ground_truth_mask(self):
256-
mask_gt = np.zeros((128, 128), np.bool)
257-
mask_pred = np.zeros((128, 128), np.bool)
256+
mask_gt = np.zeros((128, 128), bool)
257+
mask_pred = np.zeros((128, 128), bool)
258258
mask_pred[50, 60] = 1
259259
surface_distances = surface_distance.compute_surface_distances(
260260
mask_gt, mask_pred, spacing_mm=(3, 2))
@@ -270,8 +270,8 @@ def test_empty_ground_truth_mask(self):
270270
expected_volumetric_dice=0.0)
271271

272272
def test_both_empty_masks(self):
273-
mask_gt = np.zeros((128, 128), np.bool)
274-
mask_pred = np.zeros((128, 128), np.bool)
273+
mask_gt = np.zeros((128, 128), bool)
274+
mask_pred = np.zeros((128, 128), bool)
275275
surface_distances = surface_distance.compute_surface_distances(
276276
mask_gt, mask_pred, spacing_mm=(3, 2))
277277
self._assert_metrics(
@@ -289,8 +289,8 @@ def test_both_empty_masks(self):
289289
class SurfaceDistance3DTest(SurfaceDistanceTest):
290290

291291
def test_on_2_pixels_2mm_away(self):
292-
mask_gt = np.zeros((128, 128, 128), np.bool)
293-
mask_pred = np.zeros((128, 128, 128), np.bool)
292+
mask_gt = np.zeros((128, 128, 128), bool)
293+
mask_pred = np.zeros((128, 128, 128), bool)
294294
mask_gt[50, 60, 70] = 1
295295
mask_pred[50, 60, 72] = 1
296296
surface_distances = surface_distance.compute_surface_distances(
@@ -304,8 +304,8 @@ def test_on_2_pixels_2mm_away(self):
304304
expected_volumetric_dice=0.0)
305305

306306
def test_two_cubes_shifted_by_one_pixel(self):
307-
mask_gt = np.zeros((100, 100, 100), np.bool)
308-
mask_pred = np.zeros((100, 100, 100), np.bool)
307+
mask_gt = np.zeros((100, 100, 100), bool)
308+
mask_pred = np.zeros((100, 100, 100), bool)
309309
mask_gt[0:50, :, :] = 1
310310
mask_pred[0:51, :, :] = 1
311311
surface_distances = surface_distance.compute_surface_distances(
@@ -320,8 +320,8 @@ def test_two_cubes_shifted_by_one_pixel(self):
320320
expected_volumetric_dice=0.990)
321321

322322
def test_empty_prediction_mask(self):
323-
mask_gt = np.zeros((128, 128, 128), np.bool)
324-
mask_pred = np.zeros((128, 128, 128), np.bool)
323+
mask_gt = np.zeros((128, 128, 128), bool)
324+
mask_pred = np.zeros((128, 128, 128), bool)
325325
mask_gt[50, 60, 70] = 1
326326
surface_distances = surface_distance.compute_surface_distances(
327327
mask_gt, mask_pred, spacing_mm=(3, 2, 1))
@@ -335,8 +335,8 @@ def test_empty_prediction_mask(self):
335335
expected_volumetric_dice=0.0)
336336

337337
def test_empty_ground_truth_mask(self):
338-
mask_gt = np.zeros((128, 128, 128), np.bool)
339-
mask_pred = np.zeros((128, 128, 128), np.bool)
338+
mask_gt = np.zeros((128, 128, 128), bool)
339+
mask_pred = np.zeros((128, 128, 128), bool)
340340
mask_pred[50, 60, 72] = 1
341341
surface_distances = surface_distance.compute_surface_distances(
342342
mask_gt, mask_pred, spacing_mm=(3, 2, 1))
@@ -350,8 +350,8 @@ def test_empty_ground_truth_mask(self):
350350
expected_volumetric_dice=0.0)
351351

352352
def test_both_empty_masks(self):
353-
mask_gt = np.zeros((128, 128, 128), np.bool)
354-
mask_pred = np.zeros((128, 128, 128), np.bool)
353+
mask_gt = np.zeros((128, 128, 128), bool)
354+
mask_pred = np.zeros((128, 128, 128), bool)
355355
surface_distances = surface_distance.compute_surface_distances(
356356
mask_gt, mask_pred, spacing_mm=(3, 2, 1))
357357
self._assert_metrics(

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
setup(
1212
name="segmentationmetrics",
13-
version="1.0.0",
13+
version="1.0.1",
1414
description="Binary segmentation accuracy metrics",
1515
long_description=long_description,
1616
long_description_content_type="text/markdown",
1717
url="https://github.com/alexdaniel654/Segmentation_Metrics",
1818
license="Apache-2.0",
1919

20-
python_requires='>=3.8, <4',
20+
python_requires='>=3.9, <4',
2121
packages=find_packages(),
2222
install_requires=requirements,
2323
include_package_data=True,
@@ -29,9 +29,9 @@
2929
'Topic :: Scientific/Engineering',
3030
'Environment :: Console',
3131
'Operating System :: OS Independent',
32-
'Programming Language :: Python :: 3.8',
3332
'Programming Language :: Python :: 3.9',
3433
'Programming Language :: Python :: 3.10',
34+
'Programming Language :: Python :: 3.11',
3535
'License :: OSI Approved :: Apache Software License',
3636
],
3737
)

0 commit comments

Comments
 (0)