dbdicom.ones#

dbdicom.ones(shape: tuple, coords: dict | None = None, **kwargs) Series[source]#

Create a DICOM series populated with ones.

This is a convenience wrapper providing a numpy-like interface for as_series().

Parameters:
Returns:

DICOM series with values of one.

Return type:

Series

See also

zeros()

Example

Create a series containing a 4-dimensional array of ones:

>>> zeros = db.ones((128, 128, 2, 3))
>>> zeros.print()
---------- SERIES --------------
Series 001 [New Series]
    Nr of instances: 6
        MRImage 000001
        MRImage 000002
        MRImage 000003
        MRImage 000004
        MRImage 000005
        MRImage 000006
--------------------------------

This is effectively shorthand for:

>>> array = np.ones((128, 128, 2, 3))
>>> zeros = db.as_series(array)