NiBabel

Access a cacophony of neuro-imaging file formats

This Page

Reggie -- the one

nibabel.parrec.PARRECHeader

digraph inheritance6c55a609a4 { rankdir=LR; ratio=compress; fontsize=14; size="6.0, 8.0"; "Header" [shape=ellipse,URL="nibabel.spatialimages.Header.html#nibabel.spatialimages.Header",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "PARRECHeader" [shape=ellipse,URL="#nibabel.parrec.PARRECHeader",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "Header" -> "PARRECHeader" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

class nibabel.parrec.PARRECHeader(info, image_defs)

PAR/REC header

Methods

copy
data_from_fileobj
data_to_fileobj
from_fileobj
from_header
get_affine
get_base_affine
get_data_dtype
get_data_scaling
get_data_shape
get_data_shape_in_file
get_default_affine
get_ndim
get_slice_orientation
get_voxel_size
get_zooms
raw_data_from_fileobj
set_data_dtype
set_data_shape
set_zooms
write_to
Parameters :

info : dict

“General information” from the PAR file (as returned by parse_PAR_header()).

image_defs : array

Structured array with image definitions from the PAR file (as returned by parse_PAR_header()).

Methods

copy
data_from_fileobj
data_to_fileobj
from_fileobj
from_header
get_affine
get_base_affine
get_data_dtype
get_data_scaling
get_data_shape
get_data_shape_in_file
get_default_affine
get_ndim
get_slice_orientation
get_voxel_size
get_zooms
raw_data_from_fileobj
set_data_dtype
set_data_shape
set_zooms
write_to
copy()
data_from_fileobj(fileobj)

Returns scaled image data.

Behaves identical to PARRECHeader.raw_data_from_fileobj(), but returns scaled image data. This causes the images data to be loaded into memory.

classmethod from_fileobj(klass, fileobj)
classmethod from_header(klass, header=None)
get_affine(origin='scanner')

Compute affine transformation into scanner space.

The method only considers global rotation and offset settings in the header and ignore potentially deviating information in the image definitions.

Parameters :

origin : {‘scanner’, ‘fov’}

Transformation origin. By default the transformation is computed relative to the scanner’s iso center. If ‘fov’ is requested the transformation origin will be the center of the field of view instead.

Returns :

array :

4x4 array, with axis order corresponding to (x,y,z) or (lr, pa, fh).

get_data_scaling(method='dv')

Returns scaling slope and intercept.

Parameters :

method : {‘fp’, ‘dv’}

Scaling settings to be reported – see notes below.

Notes

The PAR header contains two different scaling settings: ‘dv’ (value on console) and ‘fp’ (floating point value). Here is how they are defined:

PV: value in REC RS: rescale slope RI: rescale intercept SS: scale slope

DV = PV * RS + RI FP = DV / (RS * SS)

get_data_shape_in_file()

Return the shape of the binary blob in the REC file.

Returns :

tuple :

(inplaneX, inplaneY, nslices, ndynamics/ndirections)

get_ndim()

Return the number of dimensions of the image data.

get_slice_orientation()

Returns the slice orientation label.

Returns :{‘transversal’, ‘sagital’, ‘coronal’} :
get_voxel_size()

Returns the spatial extent of a voxel.

Returns :Array :
raw_data_from_fileobj(fileobj)

Returns memmap array of raw unscaled image data.

Array axes correspond to x,y,z,t.