-
Notifications
You must be signed in to change notification settings - Fork 13
/
libics_ll.h
150 lines (114 loc) · 4.71 KB
/
libics_ll.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
* libics: Image Cytometry Standard file reading and writing.
*
* Copyright 2015-2017, 2022:
* Scientific Volume Imaging Holding B.V.
* Hilversum, The Netherlands.
* https://www.svi.nl
*
* Contact: [email protected]
*
* Copyright (C) 2000-2013 Cris Luengo and others
*
* Large chunks of this library written by
* Bert Gijsbers
* Dr. Hans T.M. van der Voort
* And also Damir Sudar, Geert van Kempen, Jan Jitze Krol,
* Chiel Baarslag and Fons Laan.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* FILE : libics_ll.h
*
* This file defines the low-level interface functions. Include it in your
* source code only if that is the way you want to go.
*/
#ifndef LIBICS_LL_H
#define LIBICS_LL_H
#include "libics.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef ICS Ics_Header;
/* These are the known data formats for imels. */
typedef enum {
IcsForm_unknown = 0,
IcsForm_integer,
IcsForm_real,
IcsForm_complex
} Ics_Format;
/* Definitions of separators in the .ics file for writing: */
#define ICS_FIELD_SEP '\t'
#define ICS_EOL '\n'
/* Reads a .ics file into an Ics_Header structure. */
ICSEXPORT Ics_Error IcsReadIcs(Ics_Header *icsStruct,
const char *filename,
int forcename,
int forcelocale);
/* Writes an Ics_Header structure into a .ics file. */
ICSEXPORT Ics_Error IcsWriteIcs(Ics_Header *icsStruct,
const char *filename);
/* Initializes image data reading. */
ICSEXPORT Ics_Error IcsOpenIds(Ics_Header *icsStruct);
/* Ends image data reading. */
ICSEXPORT Ics_Error IcsCloseIds(Ics_Header *icsStruct);
/* Reads image data block from disk. */
ICSEXPORT Ics_Error IcsReadIdsBlock(Ics_Header *icsStruct,
void *outbuf,
size_t len);
/* Skips image data block from disk (fseek forward). */
ICSEXPORT Ics_Error IcsSkipIdsBlock(Ics_Header *icsStruct,
size_t len);
/* Sets the file pointer into the image data on disk (fseek anywhere). */
ICSEXPORT Ics_Error IcsSetIdsBlock(Ics_Header *icsStruct,
ptrdiff_t offset,
int whence);
/* Reads image data from disk. */
ICSEXPORT Ics_Error IcsReadIds(Ics_Header *icsStruct,
void *dest,
size_t n);
/* Writes image data to disk. */
ICSEXPORT Ics_Error IcsWriteIds(const Ics_Header *icsStruct);
/* Initializes the Ics_Header structure to default values and zeros. */
ICSEXPORT void IcsInit(Ics_Header *icsStruct);
/* Appends ".ics" to the filename (removing ".ids" if present) If (forcename) we
do change ".ids" into ".ics", but do not add anything. */
ICSEXPORT char *IcsGetIcsName(char *dest,
const char *src,
int forcename);
/* Appends ".ids" to the filename (removing ".ics" if present). */
ICSEXPORT char *IcsGetIdsName(char *dest,
const char *src);
/* Return pointer to .ics or .ids extension or NULL if not found. */
ICSEXPORT char *IcsExtensionFind(const char *str);
/* Returns the size in bytes of the data type. */
ICSEXPORT size_t IcsGetDataTypeSize(Ics_DataType DataType);
/* Fills in format, sign and bits according to the data type. */
ICSEXPORT void IcsGetPropsDataType(Ics_DataType DataType,
Ics_Format *format,
int *sign,
size_t *bits);
/* Sets the data type according to format, sign and bits. */
ICSEXPORT void IcsGetDataTypeProps(Ics_DataType *DataType,
Ics_Format format,
int sign,
size_t bits);
/* Free the memory allocated for history. */
ICSEXPORT void IcsFreeHistory(Ics_Header *ics);
#ifdef __cplusplus
}
#endif
#endif