The HFH image format is a simple 128-byte header followed by the image data in rows x column format. The header will contain information about the image dimensions and data size. The filename can be of two formats, either file.im, where file is replace by any alphanumeric characters, _, ., and -, or IMG.###, where # is replaced by single-digit numbers. Any of the following naming conventions are used for file.im for proper field interpretation (underscore delimited):
name_image_location_extension.im, where:
name is any length (alphanumeric)
image is 3 or 4 characters (numeric)
location is any length (floating point string, e.g., -3.9)
extension is any length (any characters)
site_study_series_image_location_extension.im, where:
site is 3 characters (alphanumeric)
study is 5 characters (numeric)
series is 2 characters (numeric)
image is 3 or 4 characters (numeric)
location is any length (floating point string, e.g., -3.9)
extension is any length (any characters)
study_description_series_TE#, TR#_image_location_extension.im, where:
study is 5 characters (numeric)
description is any length (any characters)
series is 3 characters (numeric)
TE# starts with "TE" followed by any length (numeric)
TR# starts with "TR" followed by any length (numeric)
TI# starts with "TI" followed by any length (numeric)
image is 3 or 4 characters (numeric)
location is any length (floating point string, e.g., -3.9)
extension is any length (any characters)
study_description_series_image_location_extension.im, where:
study is 5 characters (numeric)
description is any length (any characters)
series is 3 characters (numeric)
TI# starts with "TI" followed by any length (numeric)
image is 3 or 4 characters (numeric)
location is any length (floating point string, e.g., -3.9)
extension is any length (any characters)
Click here for C code to read and write HFH format headers.
The contents of the 128 byte header are as follows:
byte offset |
# bytes |
data type |
field |
restrictions |
0 |
64 |
character string |
image label |
|
64 |
1 |
unsigned character |
revision # |
1 - 3 |
65 |
1 |
unsigned character |
orientation |
0 (top to bottom, left to right) |
66 |
1 |
unsigned character |
file flag |
ignored |
67 |
1 |
unsigned character |
compress |
ignored |
68 |
2 |
unsigned integer |
# bits used |
0 - # bits per pixel |
70 |
2 |
unsigned integer |
# bits per pixel |
8, 16, 32, 64 |
72 |
2 |
unsigned integer |
# rows |
1 - 4096 |
74 |
2 |
unsigned integer |
# columns |
1 - 4096 |
76 |
2 |
unsigned integer |
maximum value |
The maximum value of the image data if <= 65536, 0 otherwise |
78 |
2 |
unsigned integer |
minimum value |
The minimum value of the image data if <= 65536, 0 otherwise |
80 |
4 |
signed integer |
x pixel size (microns) |
|
84 |
4 |
signed integer |
y pixel size (microns) |
|
88 |
4 |
signed integer |
x pixel size (microns) |
|
92 |
4 |
floating point / unsigned integer |
sequence value |
This is usually a floating point slice location, but can be used for other sequence information |
96 |
4 |
unsigned integer |
pixel format |
0 (integer), 1 (floating point) |
100 |
8 |
floating point |
maximum value |
maximum value of the image data |
108 |
8 |
floating point |
minimum value |
minimum value of the image data |
116 |
1 |
unsigned character |
byte order |
ignored |
117 |
1 |
unsigned character |
integer format |
0 (unsigned), 1 (signed) |
118 |
1 |
unsigned character |
floating point format |
ignored |
119 |
4 |
character string |
ID |
"HFH " |
123 |
2 |
unsigned integer |
# slices |
0 (image only)
n (volume data, not used)
|
125 |
3 |
character string |
reserved |
|
To add functions to read and write HFH format data to your program, download the following files containing the C code:
hfh_hdr_def.h
header.c
|