Skip to content

Commit b7f81f6

Browse files
authored
Remove references to np.float_ (#295)
1 parent e827aba commit b7f81f6

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/highdicom/seg/sop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2551,7 +2551,7 @@ def _check_and_cast_pixel_array(
25512551
else:
25522552
segments_overlap = SegmentsOverlapValues.NO
25532553

2554-
elif pixel_array.dtype in (np.float_, np.float32, np.float64):
2554+
elif pixel_array.dtype in (np.float32, np.float64):
25552555
unique_values = np.unique(pixel_array)
25562556
if np.min(unique_values) < 0.0 or np.max(unique_values) > 1.0:
25572557
raise ValueError(
@@ -2737,7 +2737,7 @@ def _get_segment_pixel_array(
27372737
(0 or 1).
27382738
27392739
"""
2740-
if pixel_array.dtype in (np.float_, np.float32, np.float64):
2740+
if pixel_array.dtype in (np.float32, np.float64):
27412741
# Based on the previous checks and casting, if we get here the
27422742
# output is a FRACTIONAL segmentation Floating-point numbers must
27432743
# be mapped to 8-bit integers in the range [0,

tests/test_seg.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ def fractional_transfer_syntax_uid(request):
743743
return request.param
744744

745745
@staticmethod
746-
@pytest.fixture(params=[np.bool_, np.uint8, np.uint16, np.float_])
746+
@pytest.fixture(params=[np.bool_, np.uint8, np.uint16, np.float64])
747747
def pix_type(request):
748748
return request.param
749749

@@ -1788,7 +1788,7 @@ def test_pixel_types_fractional(
17881788
max_fractional_value=max_fractional_value,
17891789
transfer_syntax_uid=fractional_transfer_syntax_uid
17901790
)
1791-
if pix_type == np.float_:
1791+
if pix_type == np.float64:
17921792
assert (
17931793
instance.SegmentsOverlap ==
17941794
SegmentsOverlapValues.UNDEFINED.value
@@ -1822,7 +1822,7 @@ def test_pixel_types_fractional(
18221822
max_fractional_value=max_fractional_value,
18231823
transfer_syntax_uid=fractional_transfer_syntax_uid
18241824
)
1825-
if pix_type == np.float_:
1825+
if pix_type == np.float64:
18261826
assert (
18271827
instance.SegmentsOverlap ==
18281828
SegmentsOverlapValues.UNDEFINED.value
@@ -2315,7 +2315,7 @@ def test_construction_empty_invalid_floats(self):
23152315
with pytest.raises(ValueError):
23162316
Segmentation(
23172317
source_images=[self._ct_image], # empty
2318-
pixel_array=self._ct_pixel_array.astype(np.float_) * 2,
2318+
pixel_array=self._ct_pixel_array.astype(np.float64) * 2,
23192319
segmentation_type=SegmentationTypeValues.FRACTIONAL.value,
23202320
segment_descriptions=(
23212321
self._segment_descriptions
@@ -2335,7 +2335,7 @@ def test_construction_empty_invalid_floats_binary(self):
23352335
with pytest.raises(ValueError):
23362336
Segmentation(
23372337
source_images=[self._ct_image],
2338-
pixel_array=self._ct_pixel_array.astype(np.float_) * 0.5,
2338+
pixel_array=self._ct_pixel_array.astype(np.float64) * 0.5,
23392339
segmentation_type=SegmentationTypeValues.BINARY.value,
23402340
segment_descriptions=(
23412341
self._segment_descriptions

0 commit comments

Comments
 (0)