[Neuroimaging] Change sform and save
Markus.Gramer at kuleuven.be
Mon Aug 3 14:19:15 CEST 2015
I am new to nibabel (and also python) so maybe I am making an obvious mistake, but I could not find anything in the manual that would help me…
I am trying to update the sform in a Nifty1 image and save it with:
def update_sform(file_in, file_out, affine_out):
img = nib.load(file_in)
img_hdr = img.header
However, I realised that due to the comparison between current header and affine:
np.allclose(self._affine, hdr.get_best_affine()) [spatialimages.py, line 426]
The sform in the header is reset to the affine when I am saving the image. Is there a way to directly set the affine? Or any other method that I can use to achieve this?
Thanks in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Neuroimaging