omni.io#

Read/write functions for various omni outputs.

Functions

convert_affine_file(output, filename, ...[, ...])

Converts input affine file to output affine file of another type.

convert_framewise_affine_to_rigid_body(...)

Converts framewise affine file to rigid body.

load_interaction_spec(model)

Parse the interaction model input.

load_target_source(target, source)

Conveinence function for loading two images (target/source).

read_affine_file(filename)

Loads affine file from disk.

read_afni_affine(filename)

Loads the afni affine matrix file.

read_afni_framewise_affine(filename)

Loads in a framewise affine from afni

read_omni_affine(filename)

Read omni format affine matrix from disk.

write_affine_file(filename, affine_mat, atype)

Write affine file.

write_afni_affine(filename, affine_mat)

Writes an afni affine matrix file to disk.

write_fsl_affine(filename, affine_mat)

Writes fsl format affine matrix to disk.

write_omni_affine(filename, affine_mat)

Writes omni format affine matrix to disk.

write_rb_params(filename, rb_params)

Writes rigid body params to disk.

write_regress_params(filename, regress_params)

Writes regression parameters to disk.

omni.io.convert_affine_file(output: str, filename: str, output_atype: str, invert: bool = False, target: Optional[str] = None, source: Optional[str] = None) None[source]#

Converts input affine file to output affine file of another type.

Parameters:
output: str

Path/name of output affine file.

filename: str

Affine file to convert.

output_atype: str

Type of affine to output (omni/afni/fsl).

invert: bool

Controls whether the affine should be inverted.

target: str

Path to target image affine is transformed to (required for fsl conversion).

source: str

Path to source image affine is applying transform to (required for fsl conversion).

omni.io.convert_framewise_affine_to_rigid_body(output: str, filename: str) None[source]#

Converts framewise affine file to rigid body.

Parameters:
output: str

Path/name of output rigid body parames file.

filename: str

Affine file to convert.

omni.io.load_interaction_spec(model: str) str[source]#

Parse the interaction model input.

omni.io.load_target_source(target: str, source: str) Tuple[Nifti1Image, Nifti1Image][source]#

Conveinence function for loading two images (target/source).

omni.io.read_affine_file(filename: str) Tuple[ndarray, str][source]#

Loads affine file from disk.

Parameters:
filename: str

Affine filename to load.

Returns:
np.ndarray

4x4 affine matrix.

str

Type of affine file loaded (omni/afni/fsl).

omni.io.read_afni_affine(filename: str) ndarray[source]#

Loads the afni affine matrix file.

omni.io.read_afni_framewise_affine(filename: str) ndarray[source]#

Loads in a framewise affine from afni

Parameters:
filename: str

Multi frame affine file to load.

Returns:
np.ndarray

n x 16 array of affines

omni.io.read_omni_affine(filename: str) ndarray[source]#

Read omni format affine matrix from disk.

omni.io.write_affine_file(filename: str, affine_mat: ndarray, atype: str) None[source]#

Write affine file.

Parameters:
filename: str

Filename of affine file to write.

affine_mat: np.ndarray

4x4 affine matrix.

atype: str

Type of affine file to write (omni/afni/fsl).

omni.io.write_afni_affine(filename: str, affine_mat: ndarray) None[source]#

Writes an afni affine matrix file to disk.

omni.io.write_fsl_affine(filename: str, affine_mat: ndarray) None[source]#

Writes fsl format affine matrix to disk.

omni.io.write_omni_affine(filename: str, affine_mat: ndarray) None[source]#

Writes omni format affine matrix to disk.

omni.io.write_rb_params(filename: str, rb_params: ndarray) None[source]#

Writes rigid body params to disk.

Parameters:
filename: str

Rigid body params file to write.

rb_params: str

n x 6 ndarray containing rigid body parameters.

omni.io.write_regress_params(filename: str, regress_params: ndarray) None[source]#

Writes regression parameters to disk.