Skip to content

Commit

Permalink
Remove references to np.float_ (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
CPBridge authored Jun 22, 2024
1 parent e827aba commit b7f81f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/highdicom/seg/sop.py
Original file line number Diff line number Diff line change
Expand Up @@ -2551,7 +2551,7 @@ def _check_and_cast_pixel_array(
else:
segments_overlap = SegmentsOverlapValues.NO

elif pixel_array.dtype in (np.float_, np.float32, np.float64):
elif pixel_array.dtype in (np.float32, np.float64):
unique_values = np.unique(pixel_array)
if np.min(unique_values) < 0.0 or np.max(unique_values) > 1.0:
raise ValueError(
Expand Down Expand Up @@ -2737,7 +2737,7 @@ def _get_segment_pixel_array(
(0 or 1).
"""
if pixel_array.dtype in (np.float_, np.float32, np.float64):
if pixel_array.dtype in (np.float32, np.float64):
# Based on the previous checks and casting, if we get here the
# output is a FRACTIONAL segmentation Floating-point numbers must
# be mapped to 8-bit integers in the range [0,
Expand Down
10 changes: 5 additions & 5 deletions tests/test_seg.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ def fractional_transfer_syntax_uid(request):
return request.param

@staticmethod
@pytest.fixture(params=[np.bool_, np.uint8, np.uint16, np.float_])
@pytest.fixture(params=[np.bool_, np.uint8, np.uint16, np.float64])
def pix_type(request):
return request.param

Expand Down Expand Up @@ -1788,7 +1788,7 @@ def test_pixel_types_fractional(
max_fractional_value=max_fractional_value,
transfer_syntax_uid=fractional_transfer_syntax_uid
)
if pix_type == np.float_:
if pix_type == np.float64:
assert (
instance.SegmentsOverlap ==
SegmentsOverlapValues.UNDEFINED.value
Expand Down Expand Up @@ -1822,7 +1822,7 @@ def test_pixel_types_fractional(
max_fractional_value=max_fractional_value,
transfer_syntax_uid=fractional_transfer_syntax_uid
)
if pix_type == np.float_:
if pix_type == np.float64:
assert (
instance.SegmentsOverlap ==
SegmentsOverlapValues.UNDEFINED.value
Expand Down Expand Up @@ -2315,7 +2315,7 @@ def test_construction_empty_invalid_floats(self):
with pytest.raises(ValueError):
Segmentation(
source_images=[self._ct_image], # empty
pixel_array=self._ct_pixel_array.astype(np.float_) * 2,
pixel_array=self._ct_pixel_array.astype(np.float64) * 2,
segmentation_type=SegmentationTypeValues.FRACTIONAL.value,
segment_descriptions=(
self._segment_descriptions
Expand All @@ -2335,7 +2335,7 @@ def test_construction_empty_invalid_floats_binary(self):
with pytest.raises(ValueError):
Segmentation(
source_images=[self._ct_image],
pixel_array=self._ct_pixel_array.astype(np.float_) * 0.5,
pixel_array=self._ct_pixel_array.astype(np.float64) * 0.5,
segmentation_type=SegmentationTypeValues.BINARY.value,
segment_descriptions=(
self._segment_descriptions
Expand Down

0 comments on commit b7f81f6

Please sign in to comment.