Skip to content
Snippets Groups Projects
Commit 30a248dc authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

RF: Include identity transforms in image affines. Basic flirt matrix

read/write routines
parent dbaa3029
No related branches found
No related tags found
No related merge requests found
......@@ -376,6 +376,9 @@ class Nifti(notifier.Notifier, meta.Meta):
[ x, 0, 0])
voxToScaledVoxMat = transform.concat(flip, voxToScaledVoxMat)
affines['fsl', 'fsl'] = np.eye(4)
affines['voxel', 'voxel'] = np.eye(4)
affines['world', 'world'] = np.eye(4)
affines['voxel', 'world'] = voxToWorldMat
affines['world', 'voxel'] = transform.invert(voxToWorldMat)
affines['voxel', 'fsl'] = voxToScaledVoxMat
......
......@@ -17,9 +17,21 @@ matrices. The following functions are available:
"""
import numpy as np
from .affine import concat
def readFlirt(fname):
"""Reads a FLIRT matrix from a file. """
return np.loadtxt(fname)
def writeFlirt(xform, fname):
"""Writes the given FLIRT matrix to a file. """
np.savetxt(fname, xform, fmt='%1.15g')
def fromFlirt(xform, src, ref, from_='voxel', to='world'):
"""Convert a FLIRT affine matrix into another affine.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment