Bsoft  2.1.0
Bernard's software package
rwDM.h
Go to the documentation of this file.
1 
11 #include "rwimg.h"
12 
13 enum DMDataType {
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;
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);
UNSIGNED_INT32_DATA
@ UNSIGNED_INT32_DATA
Definition: rwDM.h:16
REAL4_DATA
@ REAL4_DATA
Definition: rwDM.h:14
DMDataType
DMDataType
Definition: rwDM.h:13
DM3head
Definition: rwDM.h:73
RGB_DATA
@ RGB_DATA
Definition: rwDM.h:15
RGBA_UINT16_DATA
@ RGBA_UINT16_DATA
Definition: rwDM.h:18
DM4head::sorted
char sorted
Definition: rwDM.h:86
SIGNED_INT16_DATA
@ SIGNED_INT16_DATA
Definition: rwDM.h:14
readDM
int readDM(Bimage *p, int readdata, int img_select)
Reading a Digital Micrograph image file format.
Definition: rwDM.cpp:41
DM4head::ntag
int ntag
Definition: rwDM.h:88
SIGNED_INT32_DATA
@ SIGNED_INT32_DATA
Definition: rwDM.h:15
RGB_UINT8_DATA
@ RGB_UINT8_DATA
Definition: rwDM.h:19
DM3head::endianness
int endianness
Definition: rwDM.h:76
BINARY_DATA
@ BINARY_DATA
Definition: rwDM.h:17
DM4head::endianness
int endianness
Definition: rwDM.h:85
UNSIGNED_INT16_DATA
@ UNSIGNED_INT16_DATA
Definition: rwDM.h:16
COMPLEX16_DATA
@ COMPLEX16_DATA
Definition: rwDM.h:17
RGBA_FLOAT64_DATA
@ RGBA_FLOAT64_DATA
Definition: rwDM.h:18
RGB_UINT16_DATA
@ RGB_UINT16_DATA
Definition: rwDM.h:17
RGBA_UINT8_DATA
@ RGBA_UINT8_DATA
Definition: rwDM.h:19
DMhead::depth
int depth
Definition: rwDM.h:27
DM3head::ntag
int ntag
Definition: rwDM.h:79
Bimage
General image parameter class.
Definition: Bimage.h:177
DM3head::open
char open
Definition: rwDM.h:78
DMhead::endian
unsigned int endian
Definition: rwDM.h:23
UNSIGNED_INT8_DATA
@ UNSIGNED_INT8_DATA
Definition: rwDM.h:15
DMhead
Definition: rwDM.h:22
DMMachead
Definition: rwDM.h:31
PACKED_DATA
@ PACKED_DATA
Definition: rwDM.h:15
writeDM
int writeDM(Bimage *p)
Writing a Digital Micrograph map image file format.
Definition: rwDM.cpp:81
DM4head
Definition: rwDM.h:82
rwimg.h
Header file for 2D and 3D image I/O.
DMhead::ySize
int ySize
Definition: rwDM.h:25
DM3head::file_length
int file_length
Definition: rwDM.h:75
OS_RGBA_UINT8_DATA
@ OS_RGBA_UINT8_DATA
Definition: rwDM.h:19
COMPLEX8_DATA
@ COMPLEX8_DATA
Definition: rwDM.h:14
DMMachead::type
short type
Definition: rwDM.h:35
NULL_DATA
@ NULL_DATA
Definition: rwDM.h:14
DM4head::file_length
unsigned long file_length
Definition: rwDM.h:84
DMhead::zSize
int zSize
Definition: rwDM.h:26
LAST_DATA
@ LAST_DATA
Definition: rwDM.h:19
DM4head::open
char open
Definition: rwDM.h:87
REAL8_DATA
@ REAL8_DATA
Definition: rwDM.h:16
DMMachead::width
short width
Definition: rwDM.h:32
RGBA_FLOAT32_DATA
@ RGBA_FLOAT32_DATA
Definition: rwDM.h:17
OBSELETE_DATA
@ OBSELETE_DATA
Definition: rwDM.h:14
DMhead::xSize
int xSize
Definition: rwDM.h:24
DM3head::version
int version
Definition: rwDM.h:74
DM3head::sorted
char sorted
Definition: rwDM.h:77
DMMachead::height
short height
Definition: rwDM.h:33
DMhead::type
DMDataType type
Definition: rwDM.h:28
DM4head::version
int version
Definition: rwDM.h:83
RGB_FLOAT64_DATA
@ RGB_FLOAT64_DATA
Definition: rwDM.h:18
SIGNED_INT8_DATA
@ SIGNED_INT8_DATA
Definition: rwDM.h:16
DMMachead::bytes_per_pixel
short bytes_per_pixel
Definition: rwDM.h:34