I am new to the medical image processing. I am trying to read a Nifti image and write the header information into a csv file.
import nibabel as nib
img = nib.load("xxx.hdr.gz")
hdr = img.header
print(hdr)
<class 'nibabel.nifti1.Nifti1PairHeader'> object, endian='>'
sizeof_hdr : 348
data_type : b''
db_name : b''
extents : 0
session_error : 0
regular : b'r'
dim_info : 0
dim : [ 3 91 109 91 1 1 1 1]
...............
Now how do i manage to save this information into a csv file? When i get the data into Numpy it is a 3 Dimensional numpy but what is the right way to save this information into a csv format.