diff --git a/src/dicomweb_client/file.py b/src/dicomweb_client/file.py index 47eab49..3e16c80 100644 --- a/src/dicomweb_client/file.py +++ b/src/dicomweb_client/file.py @@ -565,6 +565,11 @@ def __init__( self._create_db() + # numpy 2 no longer has prod, but Python >= 3.8 does. We either have + # one or the other, so use the python math.prod method when available + # and fall abck to np if not. + self._prod = getattr(math, 'prod', np.prod) + self._attributes = { _QueryResourceType.STUDIES: self._get_attributes( _QueryResourceType.STUDIES @@ -857,7 +862,7 @@ def _update_db(self): getattr(ds, 'NumberOfFrames', '1') ), number_of_pixels_per_frame=int( - np.prod([ + self._prod([ # type: ignore ds.Rows, ds.Columns, ds.SamplesPerPixel, @@ -2027,7 +2032,7 @@ def insert_instances( getattr(ds, 'NumberOfFrames', '1') ), number_of_pixels_per_frame=int( - np.prod([ + self._prod([ # type: ignore ds.Rows, ds.Columns, ds.SamplesPerPixel