dbdicom.Record.export_as_nifti#
- Record.export_as_nifti(path: str, dims: tuple | None = None)[source]#
Export record in NIFTI format to an external directory.
- Parameters:
Example
Create a 4D series and export as NIFTI:
>>> series = db.ones((128, 128, 10, 5)) >>> path = 'path\to\empty\folder' >>> series.export_as_nifti(path)
This should create a single folder in the directory, populated with 50 NIFTI files.
In order to export the entire series in a single volume, provide the dimensions along which the volume is to be taken:
>>> dims = ('SliceLocation', 'AcquisitionTime') >>> series.export_as_nifti(path, dims=dims)
This will now create a single nifti file.
Note: in this case the dimensions must be specified as slice location and acquisition time because these are the default dimensions used by series creation functions like
ones()
.