| Bsoft 2.0.5 Bernard's software package

rwDM.h
Go to the documentation of this file.
1
11 #include "rwimg.h"
12
13 enum DMDataType {
14 NULL_DATA, SIGNED_INT16_DATA, REAL4_DATA, COMPLEX8_DATA, OBSELETE_DATA, // 4
15 PACKED_DATA, UNSIGNED_INT8_DATA, SIGNED_INT32_DATA, RGB_DATA, // 8
16 SIGNED_INT8_DATA, UNSIGNED_INT16_DATA, UNSIGNED_INT32_DATA, REAL8_DATA, // 12
17 COMPLEX16_DATA, BINARY_DATA, RGBA_FLOAT32_DATA, RGB_UINT16_DATA , // 16
18 RGB_FLOAT64_DATA, RGBA_FLOAT64_DATA, RGBA_UINT16_DATA, // 19
19 RGB_UINT8_DATA , RGBA_UINT8_DATA, LAST_DATA, OS_RGBA_UINT8_DATA // 23
20 } ;
21
22 struct DMhead { // file header for DM Fixed Format Specification
23 unsigned int endian; // if not 0x0000FFFF then byte swap (including next 5 parameters).
24 int xSize;
25 int ySize;
26 int zSize;
27 int depth; // data type size in bytes - may be determined by data atype below
28 DMDataType type; // An enumerated value
29 } ;
30
31 struct DMMachead { // file header for old DM Macintosh Format Specification
32 short width;
33 short height;
34 short bytes_per_pixel;
35 short type;
36 } ;
37
38 /* The header information is stored in four short integers (16 bits each).
39 Each integer is stored with the high byte first (Motorola or 'big-endian' format).
40 The image data is stored row by row as a continuous stream of data (i.e. no line feeds,
41 carriage returns, or end of file control characters are present in the file).
42 The amount of storage space that each pixel in the image occupies depends on the
43 data type. The header and the image data are stored in the binary format
44 (not in the ASCII format).
45
46 The format for the small header image file is described below.
47
48 Field Position Length
49 Width of image 0 2 bytes (integer)
50 Height of image 2 2 bytes (integer)
51 Bytes per pixel 4 2 bytes (integer)
52 Encoded data type6 2 bytes (integer)
53 Image data 8 Width * height * bytes per pixel
54
55 The encoding of the data type (at position 6) is shown below.
56
57 Value Data Type
58 1 2 byte signed integer
59 2 Floating point IEEE standard 754
60 3 8 byte complex floating point (real, imaginary)
61 5 Packed complex
62 6 1 byte unsigned integer
63 7 4 byte signed integer
64 8 4 byte RGB
65 9 1 byte signed integer
66 10 2 byte unsigned integer
67 11 4 byte unsigned integer
68 12 8 byte double
69 13 16 byte complex double (real, imaginary)
70 14 1 byte binary data
71 */
72
73 struct DM3head { // All 3 fields must be big-endian
74 int version; // 2/3/4
75 int file_length; // Actually file length - 16 = size of root tag directory
76 int endianness; // 0=big, 1=little
77 char sorted; // Flag for sorted tag (1)
78 char open; // Flag for open tag (1)
79 int ntag; // Number of tags
80 } ;
81
82 struct DM4head { // All 3 fields must be big-endian
83 int version; // 2/3/4
84 unsigned long file_length; // Actually file length - 16 = size of root tag directory
85 int endianness; // 0=big, 1=little
86 char sorted; // Flag for sorted tag (1)
87 char open; // Flag for open tag (1)
88 int ntag; // Number of tags
89 } ;
90
91 // I/O prototypes
92 int readDM(Bimage* p, int readdata, int img_select);
93 int writeDM(Bimage* p);
DM3head
Definition: rwDM.h:73
DMDataType
DMDataType
Definition: rwDM.h:13
DM4head::ntag
int ntag
Definition: rwDM.h:88
DMMachead::height
short height
Definition: rwDM.h:33
UNSIGNED_INT8_DATA
Definition: rwDM.h:15
RGBA_FLOAT32_DATA
Definition: rwDM.h:17
RGBA_UINT16_DATA
Definition: rwDM.h:18
UNSIGNED_INT32_DATA
Definition: rwDM.h:16
OBSELETE_DATA
Definition: rwDM.h:14
DMMachead::type
short type
Definition: rwDM.h:35
DMhead::ySize
int ySize
Definition: rwDM.h:25
NULL_DATA
Definition: rwDM.h:14
OS_RGBA_UINT8_DATA
Definition: rwDM.h:19
DM3head::endianness
int endianness
Definition: rwDM.h:76
DM4head
Definition: rwDM.h:82
SIGNED_INT16_DATA
Definition: rwDM.h:14
RGB_FLOAT64_DATA
Definition: rwDM.h:18
REAL4_DATA
Definition: rwDM.h:14
RGB_UINT8_DATA
Definition: rwDM.h:19
DM3head::open
char open
Definition: rwDM.h:78
Bimage
General image parameter class.
Definition: Bimage.h:163
SIGNED_INT32_DATA
Definition: rwDM.h:15
DM3head::ntag
int ntag
Definition: rwDM.h:79
DMhead::depth
int depth
Definition: rwDM.h:27
DMhead::type
DMDataType type
Definition: rwDM.h:28
RGB_UINT16_DATA
Definition: rwDM.h:17
BINARY_DATA
Definition: rwDM.h:17
DM4head::file_length
unsigned long file_length
Definition: rwDM.h:84
DM4head::endianness
int endianness
Definition: rwDM.h:85
readDM
int readDM(Bimage *p, int readdata, int img_select)
Reading a Digital Micrograph image file format.
Definition: rwDM.cpp:41
PACKED_DATA
Definition: rwDM.h:15
DM3head::version
int version
Definition: rwDM.h:74
writeDM
int writeDM(Bimage *p)
Writing a Digital Micrograph map image file format.
Definition: rwDM.cpp:81
DM3head::sorted
char sorted
Definition: rwDM.h:77
COMPLEX16_DATA
Definition: rwDM.h:17
DMhead
Definition: rwDM.h:22
DM4head::open
char open
Definition: rwDM.h:87
COMPLEX8_DATA
Definition: rwDM.h:14
DMhead::zSize
int zSize
Definition: rwDM.h:26
REAL8_DATA
Definition: rwDM.h:16
RGBA_FLOAT64_DATA
Definition: rwDM.h:18
DMhead::xSize
int xSize
Definition: rwDM.h:24
DMMachead::bytes_per_pixel
short bytes_per_pixel
Definition: rwDM.h:34
RGBA_UINT8_DATA
Definition: rwDM.h:19
LAST_DATA
Definition: rwDM.h:19
DM4head::version
int version
Definition: rwDM.h:83
rwimg.h
Header file for 2D and 3D image I/O.
DMhead::endian
unsigned int endian
Definition: rwDM.h:23
DM4head::sorted
char sorted
Definition: rwDM.h:86
RGB_DATA
Definition: rwDM.h:15
SIGNED_INT8_DATA
Definition: rwDM.h:16
DM3head::file_length
int file_length
Definition: rwDM.h:75
DMMachead::width
short width
Definition: rwDM.h:32
DMMachead
Definition: rwDM.h:31
UNSIGNED_INT16_DATA
Definition: rwDM.h:16