Struct nifti::header::NiftiHeader [] [src]

pub struct NiftiHeader {
    pub sizeof_hdr: i32,
    pub data_type: [u8; 10],
    pub db_name: [u8; 18],
    pub extents: i32,
    pub session_error: i16,
    pub regular: u8,
    pub dim_info: u8,
    pub dim: [u16; 8],
    pub intent_p1: f32,
    pub intent_p2: f32,
    pub intent_p3: f32,
    pub intent_code: i16,
    pub datatype: i16,
    pub bitpix: i16,
    pub slice_start: i16,
    pub pixdim: [f32; 8],
    pub vox_offset: f32,
    pub scl_slope: f32,
    pub scl_inter: f32,
    pub slice_end: i16,
    pub slice_code: u8,
    pub xyzt_units: u8,
    pub cal_max: f32,
    pub cal_min: f32,
    pub slice_duration: f32,
    pub toffset: f32,
    pub glmax: i32,
    pub glmin: i32,
    pub descrip: Vec<u8>,
    pub aux_file: [u8; 24],
    pub qform_code: i16,
    pub sform_code: i16,
    pub quatern_b: f32,
    pub quatern_c: f32,
    pub quatern_d: f32,
    pub quatern_x: f32,
    pub quatern_y: f32,
    pub quatern_z: f32,
    pub srow_x: [f32; 4],
    pub srow_y: [f32; 4],
    pub srow_z: [f32; 4],
    pub intent_name: [u8; 16],
    pub magic: [u8; 4],
}

The NIFTI-1 header data type. All fields are public and named after the specification's header file. The type of each field was adjusted according to their use and array limitations. A builder is also available.

Examples

use nifti::{NiftiHeader, Endianness};

let (hdr1, endianness): (NiftiHeader, Endianness) =
    NiftiHeader::from_file("0000.hdr")?;
 
let hdr2: NiftiHeader = NiftiHeader::from_file("0001.hdr.gz")?.0;
let (hdr3, end3) = NiftiHeader::from_file("4321.nii.gz")?;

Or to build one yourself:

use nifti::NiftiHeaderBuilder;

let hdr = NiftiHeaderBuilder::default()
    .cal_min(0.)
    .cal_max(128.)
    .build()?;
assert_eq!(hdr.cal_min, 0.);
assert_eq!(hdr.cal_max, 128.);

Fields

Header size, must be 348

Unused in NIFTI-1

Unused in NIFTI-1

Unused in NIFTI-1

Unused in NIFTI-1

Unused in NIFTI-1

MRI slice ordering

Data array dimensions

1st intent parameter

2nd intent parameter

3rd intent parameter

NIFTI_INTENT_* code

Defines the data type!

Number of bits per voxel

First slice index

Grid spacings

Offset into .nii file to reach the volume

Data scaling: slope

Data scaling: offset

Last slice index

Slice timing order

Units of pixdim[1..4]

Max display intensity

Min display intensity

Time for 1 slice

Time axis shift

Unused in NIFTI-1

Unused in NIFTI-1

Any text you like

Auxiliary filename

NIFTI_XFORM_* code

NIFTI_XFORM_* code

Quaternion b param

Quaternion c param

Quaternion d param

Quaternion x shift

Quaternion y shift

Quaternion z shift

1st row affine transform

2nd row affine transform

3rd row affine transform

'name' or meaning of data

Magic code. Must be b"ni1\0" or b"ni+\0"

Methods

impl NiftiHeader
[src]

Retrieve a NIFTI header, along with its byte order, from a file in the file system. If the file's name ends with ".gz", the file is assumed to need GZip decoding.

Read a NIfTI-1 header, along with its byte order, from the given byte stream. It is assumed that the input is currently at the start of the NIFTI header.

Trait Implementations

impl Debug for NiftiHeader
[src]

Formats the value using the given formatter.

impl Clone for NiftiHeader
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for NiftiHeader
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Default for NiftiHeader
[src]

Returns the "default value" for a type. Read more