dbdicom.Record.export_as_png#

Record.export_as_png(path: str, center: float | None = None, width: float | None = None, colormap: str | None = None)[source]#

Export record in PNG format.

Parameters:
  • path (str) – path to export directory.

  • center (float, optional) – center of the color window. Defaults to None, in which case the center is taken from the DICOM header.

  • width (float, optional) – width of the color window. Defaults to None, in which case the width is taken from the DICOM header.

  • colormap (str, optional) – color map to use as lookup table. Any valid matplotlib colormap can be entered here. Please the matplotlib colormap reference for a complete list. Defaults to None, in which case the colormap is taken from the DICOM header.

Example

Create a 4D series and export as PNG, using the colormap plasma:

>>> series = db.ones((128, 128, 10, 5))
>>> path = 'path\to\empty\folder'
>>> series.export_as_png(path, center=1, width=0.5, colormap='plasma')

This should create a single folder in the directory, populated with 50 PNG files.