Nrrd File Format

From NRIMS External Wiki
Jump to: navigation, search

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.)

  1. NRRD0004
  2. # Created by OpenMIMS at Tue May 15 12:41:43 EDT 2012
  3. type: uint16
  4. encoding: raw
  5. endian: big
  6. dimension: 4
  7. sizes: 512 512 1 4
  8. kinds: space space space list
  9. spacings: 1.0 1.0 1.0 NaN
  10. centers: node node node node
  11. units: "pixel" "pixel" "pixel" "pixel"
  12. Mims_mass_numbers:=12.04 13.04 26.05 27.03 
  13. Mims_mass_symbols:=12C 13C 12C14N 12C15N 
  14. Mims_position:=6100,-6491
  15. Mims_date:=02.07.04
  16. Mims_hour:=15:23
  17. Mims_user_name:= 
  18. Mims_sample_name:= 
  19. Mims_z_position:=0
  20. Mims_dwell_time:=55.000
  21. Mims_count_time:=14417.92
  22. Mims_duration:=14417.000
  23. Mims_raster:=41402
  24. Mims_pixel_width:=80.86328
  25. Mims_pixel_height:=80.86328
  26. Mims_deadtime_correction_applied:=false
  27. Mims_QSA_correction_applied:=false
  28. 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).