nrrd Format - BWHCNI/OpenMIMS GitHub Wiki
Nrrd File Format
The nrrd format is a very general file format for raster data. To quote the main nrrd page :
Nrrd is a library and file format designed to support scientific visualization and image processing involving N-dimensional raster data. Nrrd stands for "nearly raw raster data". Besides dimensional generality, nrrd is flexible with respect to type (8 integral types, 2 floating point types), encoding of written files (raw, ascii, hex, or gzip or bzip2 compression), and endianness (the byte order of data is explicitly recorded when the type or encoding expose it).
For further details see the general description and the format definition. There are several ideas about the structure of a nrrd file that are useful to understand detailed below.
nrrd Header
The header of a .nrrd file is human readable ascii. Below is an example header extracted using the unu head SampleData1.nrrd command. Other unu commands are detailed on the page Unu Commands. (Note: line numbers have been added for clarity and are not part of the actual header.)
NRRD0004
# Created by OpenMIMS at Tue May 15 12:41:43 EDT 2012
type: uint16
encoding: raw
endian: big
dimension: 4
sizes: 512 512 1 4
kinds: space space space list
spacings: 1.0 1.0 1.0 NaN
centers: node node node node
units: "pixel" "pixel" "pixel" "pixel"
Mims_mass_numbers:=12.04 13.04 26.05 27.03
Mims_mass_symbols:=12C 13C 12C14N 12C15N
Mims_position:=6100,-6491
Mims_date:=02.07.04
Mims_hour:=15:23
Mims_user_name:=
Mims_sample_name:=
Mims_z_position:=0
Mims_dwell_time:=55.000
Mims_count_time:=14417.92
Mims_duration:=14417.000
Mims_raster:=41402
Mims_pixel_width:=80.86328
Mims_pixel_height:=80.86328
Mims_deadtime_correction_applied:=false
Mims_QSA_correction_applied:=false
Mims_notes:=
The first 11 lines of the header are parameters that define the structure of the .nrrd file. Lines 12-28 are key/value pairs of metadata added to the header by OpenMIMS. These include metadata from the original .im file (e.g. Mims_raster) and metadata added after the acquisition (e.g. Mims_QSA_correction_applied).