dbdicom.Series.set_pixel_values#

Series.set_pixel_values(values: ndarray, dims: tuple | None = None, slice={}, coords={}, **filters)[source]#

Set a numpy.ndarray with pixel data.

Parameters:
  • dims (tuple, optional) – Dimensions of the pixel values, as a tuple of valid DICOM tags of any length. If dims is not provided, pixel values are ordered by instance number. Defaults to None.

  • inds (dict, optional) – Dictionary with indices to set a slice of the entire array. Defaults to None.

  • select (dict, optional) – A dictionary of values for DICOM attributes to set specific frames.

  • filters (dict, optional) – keyword arguments to set specific frames.

Raises:

ValueError – if the values are the incorrect shape for the dimensions.

See also

pixel_values

Example

Create a zero-filled array with 3 slice dimensions:

>>> coords = {
...    'SliceLocation': 10*np.arange(4),
...    'FlipAngle': np.array([2, 15, 30]),
...    'RepetitionTime': np.array([2.5, 5.0]),
... }
>>> zeros = db.zeros((128,64,4,3,2), coords)