@@ -382,13 +382,37 @@ def write_to(self, fileobj, byteswap):
382
382
383
383
384
384
class Nifti1DicomExtension (Nifti1Extension ):
385
- """NIfTI1 DICOM header extension.
385
+ """NIfTI1 DICOM header extension
386
386
387
387
This class is a thin wrapper around pydicom to read a binary DICOM
388
388
byte string. If pydicom is not available, it silently falls back to the
389
389
standard NiftiExtension class.
390
390
"""
391
391
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
+
392
416
self ._code = code
393
417
if parent_hdr :
394
418
self ._is_little_endian = parent_hdr .endianness == '<'
0 commit comments