# pydicom.pixels.utils.pixel_dtype

pydicom.pixels.utils.pixel_dtype(ds: Dataset, as_float: bool = False) → np.dtype

  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 (with `as_float=True`).

  Element | Supported values
  --- | ---
  Tag | Keyword | Type
  (0028,0101) | BitsAllocated | 1 | 1, 8, 16, 32, 64
  (0028,0103) | PixelRepresentation | 1 | 0, 1

  Parameters:

    - ds (Dataset) – The `Dataset` containing the pixel data you wish to get the data type for.

    - as_float (bool, optional) – If `True` then return a float dtype, otherwise return an integer dtype (default `False`). Float dtypes are only supported when (0028,0101) Bits Allocated is 32 or 64.

  Returns:

    A `numpy.dtype` suitable for containing the pixel data.

  Return type:

    numpy.dtype

  Raises:

    NotImplementedError – If the pixel data is of a type that isn’t supported by either numpy or pydicom.