Skip to content

Commit 65de3fe

Browse files
committed
DOC Add docstring to DicomExtension __init__
1 parent 8534bb4 commit 65de3fe

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

nibabel/nifti1.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,37 @@ def write_to(self, fileobj, byteswap):
382382

383383

384384
class Nifti1DicomExtension(Nifti1Extension):
385-
"""NIfTI1 DICOM header extension.
385+
"""NIfTI1 DICOM header extension
386386
387387
This class is a thin wrapper around pydicom to read a binary DICOM
388388
byte string. If pydicom is not available, it silently falls back to the
389389
standard NiftiExtension class.
390390
"""
391391
def __init__(self, code, content, parent_hdr=None):
392+
"""
393+
Parameters
394+
----------
395+
code : int|str
396+
Canonical extension code as defined in the NIfTI standard, given
397+
either as integer or corresponding label
398+
(see :data:`~nibabel.nifti1.extension_codes`)
399+
content : bytes|pydicom Dataset|None
400+
Extension content - either a bytestring as read from the NIfTI file
401+
header or an existing pydicom Dataset. If a bystestring, the content
402+
is converted into a Dataset on initialization. If None, a new empty
403+
Dataset is created.
404+
parent_hdr : :data:`~nibabel.nifti1.Nifti1Header`
405+
Optional - If a dicom extension belongs to an existing
406+
:data:`~nibabel.nifti1.Nifti1Header`, it may be provided here to
407+
ensure that the DICOM dataset is written with correctly corresponding
408+
endianness; otherwise it is assumed the dataset is little endian.
409+
410+
Notes
411+
-----
412+
413+
code should always be 2 for DICOM.
414+
"""
415+
392416
self._code = code
393417
if parent_hdr:
394418
self._is_little_endian = parent_hdr.endianness == '<'

0 commit comments

Comments
 (0)