Nibabel has a get_csa_header function : https://github.com/nipy/nibabel/blob/master/nibabel/nicom/csareader.py#L31
It implements the logic of finding the image or series CSA header from the DICOM file. I see from that file that there is logic for finding where the relevant private elements start: https://github.com/nipy/nibabel/blob/master/nibabel/nicom/utils.py#L7. . So, for example, instead of doing this:
raw_csa = dcm.get((0x29, 0x1020)).value
CsaHeader(raw_csa).read()
you can do this:
get_csa_header(dcm, 'image')
Nibabel has a
get_csa_headerfunction : https://github.com/nipy/nibabel/blob/master/nibabel/nicom/csareader.py#L31It implements the logic of finding the
imageorseriesCSA header from the DICOM file. I see from that file that there is logic for finding where the relevant private elements start: https://github.com/nipy/nibabel/blob/master/nibabel/nicom/utils.py#L7. . So, for example, instead of doing this:you can do this: