pydicom.pixels.utils.pixel_dtype¶
- pydicom.pixels.utils.pixel_dtype(ds: Dataset, as_float: bool = False) np.dtype [source]¶
Return a
numpy.dtype
for the pixel data in ds.Suitable for use with IODs containing the Image Pixel module (with
as_float=False
) and the Floating Point Image Pixel and Double Floating Point Image Pixel modules (withas_float=True
).Element
Supported values
Tag
Keyword
Type
(0028,0101)
BitsAllocated
1
1, 8, 16, 32, 64
(0028,0103)
PixelRepresentation
1
0, 1
- Parameters:
- Returns:
A
numpy.dtype
suitable for containing the pixel data.- Return type:
- Raises:
NotImplementedError – If the pixel data is of a type that isn’t supported by either numpy or pydicom.