[Neuroimaging] Cannot edit some NIfTI header fields

Horea Christian h.chr at mail.ru
Tue Aug 25 20:26:23 CEST 2015

Hi, I am experiencing some issues with editing my NIfTI headers. 

Apparently I can save some tags after I edit them, but not others.

I have pasted all my outputs here: https://neurostars.org/p/3362/

Can you help me out?

I have received the following suggestion:

>Just guessing, but I wonder if you are trying to edit the fields
>supporting the affines, and then saving the image?

>If you are doing this, then the image save takes the image affine and
>applies it to the header, overwriting any changes you made the qform
>fields, including pixdim.

>If you want to change the qform / sform affine in the image header,
>use the ``img.set_qform`` and `img.set_sform`` methods.

I have looked into these functions, and I cannot figure out how I could
use them to effect the changes I waqnt in the header. The most
important thing right now would be to be able to edit pixdim[3]. For
some reason this is set to the slice spacing (which is 0.5mm) but I
want it set to (and I believe it *should* be set to) the slice
thickness, which is 0.3mm.

BEst Regards,

More information about the Neuroimaging mailing list