dbdicom.Series.set_gridcoords#

Series.set_gridcoords(gridcoords: dict, dims=(), slice={}, coords={}, **filters)[source]#

Set a dictionary of grid coordinates.

Parameters:
  • coords (dict) – dictionary of grid coordinates

  • dims (tuple, optional) – Dimensions of at which the new coordinates are to be best. If dims is not set, the dimensions are assumed to be the same as those of coords or grid. Defaults to None.

Examples

Create an empty series with 3 slice dimensions:

>>> gridcoords = {
...     'SliceLocation': np.arange(4),
...     'FlipAngle': np.array([2, 15, 30]),
...     'RepetitionTime': np.array([2.5, 5.0]),
... }
>>> series = db.empty_series()
>>> series.set_gridcoords(gridcoords)

Get the coordinates as a mesh

>>> dims = tuple(gridcoords)
>>> coords = series.meshcoords(dims)
>>> coords['SliceLocation'].shape
(4, 3, 2)
>>> coords['FlipAngle'][1,1,1]
15