File: brick.h

package info (click to toggle)
gwyddion 2.57-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 48,860 kB
  • sloc: ansic: 405,916; python: 7,867; sh: 5,241; makefile: 4,507; xml: 3,786; cpp: 2,572; pascal: 418; perl: 154; ruby: 130
file content (360 lines) | stat: -rw-r--r-- 19,337 bytes parent folder | download
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
/*
 *  $Id: brick.h 22618 2019-10-29 16:37:40Z yeti-dn $
 *  Copyright (C) 2003-2019 David Necas (Yeti), Petr Klapetek.
 *  E-mail: yeti@gwyddion.net, klapetek@gwyddion.net.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
 *  Boston, MA 02110-1301, USA.
 */

#ifndef __GWY_BRICK_H__
#define __GWY_BRICK_H__

#include <libgwyddion/gwysiunit.h>
#include <libprocess/gwyprocessenums.h>
#include <libprocess/datafield.h>
#include <libprocess/dataline.h>

G_BEGIN_DECLS

#define GWY_TYPE_BRICK            (gwy_brick_get_type())
#define GWY_BRICK(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GWY_TYPE_BRICK, GwyBrick))
#define GWY_BRICK_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GWY_TYPE_BRICK, GwyBrickClass))
#define GWY_IS_BRICK(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GWY_TYPE_BRICK))
#define GWY_IS_BRICK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GWY_TYPE_BRICK))
#define GWY_BRICK_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GWY_TYPE_BRICK, GwyBrickClass))

typedef struct _GwyBrick      GwyBrick;
typedef struct _GwyBrickClass GwyBrickClass;

/* XXX: Unused.  But Petr copied it here so we must keep it in the API. */
typedef struct {
    guint col;
    guint row;
    guint level;
    guint width;
    guint height;
    guint depth;
} GwyBrickPart;

struct _GwyBrick {
    GObject parent_instance;

    gint xres;
    gint yres;
    gint zres;

    gdouble xreal;
    gdouble yreal;
    gdouble zreal;

    gdouble xoff;
    gdouble yoff;
    gdouble zoff;

    gdouble *data;

    GwySIUnit *si_unit_x;
    GwySIUnit *si_unit_y;
    GwySIUnit *si_unit_z;
    GwySIUnit *si_unit_w;

    gpointer priv;
    gint int1;
};

struct _GwyBrickClass {
    GObjectClass parent_class;

    void (*data_changed)(GwyBrick *brick);
    /*< private >*/
    void (*reserved1)(void);
};

#define gwy_brick_duplicate(brick) \
        (GWY_BRICK(gwy_serializable_duplicate(G_OBJECT(brick))))
#define gwy_brick_assign(dest, source) \
        gwy_serializable_clone_with_type(G_OBJECT(source), \
                                         G_OBJECT(dest), \
                                         GWY_TYPE_BRICK)

GType     gwy_brick_get_type    (void)                   G_GNUC_CONST;
GwyBrick* gwy_brick_new         (gint xres,
                                 gint yres,
                                 gint zres,
                                 gdouble xreal,
                                 gdouble yreal,
                                 gdouble zreal,
                                 gboolean nullme);
GwyBrick* gwy_brick_new_alike   (GwyBrick *model,
                                 gboolean nullme);
GwyBrick* gwy_brick_new_part    (const GwyBrick *brick,
                                 gint xpos,
                                 gint ypos,
                                 gint zpos,
                                 gint xres,
                                 gint yres,
                                 gint zres,
                                 gboolean keep_offsets);
void      gwy_brick_data_changed(GwyBrick *brick);

void              gwy_brick_copy              (GwyBrick *src,
                                               GwyBrick *dest,
                                               gboolean nondata_too);

void              gwy_brick_resample          (GwyBrick *brick,
                                               gint xres,
                                               gint yres,
                                               gint zres,
                                               GwyInterpolationType interpolation);
gint              gwy_brick_get_xres          (GwyBrick *brick);
gint              gwy_brick_get_yres          (GwyBrick *brick);
gint              gwy_brick_get_zres          (GwyBrick *brick);
gdouble           gwy_brick_get_xreal         (GwyBrick *brick);
gdouble           gwy_brick_get_yreal         (GwyBrick *brick);
gdouble           gwy_brick_get_zreal         (GwyBrick *brick);
gdouble           gwy_brick_get_xoffset       (GwyBrick *brick);
gdouble           gwy_brick_get_yoffset       (GwyBrick *brick);
gdouble           gwy_brick_get_zoffset       (GwyBrick *brick);
const gdouble*    gwy_brick_get_data_const    (GwyBrick *brick);
void              gwy_brick_set_xreal         (GwyBrick *brick,
                                               gdouble xreal);
void              gwy_brick_set_yreal         (GwyBrick *brick,
                                               gdouble yreal);
void              gwy_brick_set_zreal         (GwyBrick *brick,
                                               gdouble zreal);
void              gwy_brick_set_xoffset       (GwyBrick *brick,
                                               gdouble xoffset);
void              gwy_brick_set_yoffset       (GwyBrick *brick,
                                               gdouble yoffset);
void              gwy_brick_set_zoffset       (GwyBrick *brick,
                                               gdouble zoffset);
gdouble           gwy_brick_get_dx            (GwyBrick *brick);
gdouble           gwy_brick_get_dy            (GwyBrick *brick);
gdouble           gwy_brick_get_dz            (GwyBrick *brick);
GwySIUnit*        gwy_brick_get_si_unit_x     (GwyBrick *brick);
GwySIUnit*        gwy_brick_get_si_unit_y     (GwyBrick *brick);
GwySIUnit*        gwy_brick_get_si_unit_z     (GwyBrick *brick);
GwySIUnit*        gwy_brick_get_si_unit_w     (GwyBrick *brick);
void              gwy_brick_set_si_unit_x     (GwyBrick *brick,
                                               GwySIUnit *si_unit);
void              gwy_brick_set_si_unit_y     (GwyBrick *brick,
                                               GwySIUnit *si_unit);
void              gwy_brick_set_si_unit_z     (GwyBrick *brick,
                                               GwySIUnit *si_unit);
void              gwy_brick_set_si_unit_w     (GwyBrick *brick,
                                               GwySIUnit *si_unit);
gdouble           gwy_brick_get_min           (GwyBrick *brick);
gdouble           gwy_brick_get_max           (GwyBrick *brick);
void              gwy_brick_copy_units        (const GwyBrick *brick,
                                               GwyBrick *target);
GwySIValueFormat* gwy_brick_get_value_format_x(GwyBrick *brick,
                                               GwySIUnitFormatStyle style,
                                               GwySIValueFormat *format);
GwySIValueFormat* gwy_brick_get_value_format_y(GwyBrick *brick,
                                               GwySIUnitFormatStyle style,
                                               GwySIValueFormat *format);
GwySIValueFormat* gwy_brick_get_value_format_z(GwyBrick *brick,
                                               GwySIUnitFormatStyle style,
                                               GwySIValueFormat *format);
GwySIValueFormat* gwy_brick_get_value_format_w(GwyBrick *brick,
                                               GwySIUnitFormatStyle style,
                                               GwySIValueFormat *format);
gdouble*          gwy_brick_get_data          (GwyBrick *brick);
gdouble           gwy_brick_itor              (GwyBrick *brick,
                                               gdouble pixpos);
gdouble           gwy_brick_rtoi              (GwyBrick *brick,
                                               gdouble realpos);
gdouble           gwy_brick_jtor              (GwyBrick *brick,
                                               gdouble pixpos);
gdouble           gwy_brick_rtoj              (GwyBrick *brick,
                                               gdouble realpos);
gdouble           gwy_brick_ktor              (GwyBrick *brick,
                                               gdouble pixpos);
gdouble           gwy_brick_rtok              (GwyBrick *brick,
                                               gdouble realpos);
gdouble           gwy_brick_ktor_cal          (GwyBrick *brick,
                                               gdouble pixpos);
gdouble           gwy_brick_rtok_cal          (GwyBrick *brick,
                                               gdouble realpos);
gdouble           gwy_brick_get_val           (GwyBrick *brick,
                                               gint col,
                                               gint row,
                                               gint lev);
void              gwy_brick_set_val           (GwyBrick *brick,
                                               gint col,
                                               gint row,
                                               gint lev,
                                               gdouble value);
gdouble           gwy_brick_get_val_real      (GwyBrick *brick,
                                               gdouble x,
                                               gdouble y,
                                               gdouble z);
void              gwy_brick_set_val_real      (GwyBrick *brick,
                                               gdouble x,
                                               gdouble y,
                                               gdouble z,
                                               gdouble value);
gdouble           gwy_brick_get_dval          (GwyBrick *brick,
                                               gdouble x,
                                               gdouble y,
                                               gdouble z,
                                               gint interpolation);
gdouble           gwy_brick_get_dval_real     (GwyBrick *brick,
                                               gdouble x,
                                               gdouble y,
                                               gdouble z,
                                               gint interpolation);
void              gwy_brick_clear             (GwyBrick *brick);
void              gwy_brick_fill              (GwyBrick *brick,
                                               gdouble value);
void              gwy_brick_multiply          (GwyBrick *brick,
                                               gdouble value);
void              gwy_brick_add               (GwyBrick *brick,
                                               gdouble value);
void              gwy_brick_extract_plane     (const GwyBrick *brick,
                                               GwyDataField *target,
                                               gint istart,
                                               gint jstart,
                                               gint kstart,
                                               gint width,
                                               gint height,
                                               gint depth,
                                               gboolean keep_offsets);
void              gwy_brick_extract_xy_plane  (const GwyBrick *brick,
                                               GwyDataField *target,
                                               gint lev);
void              gwy_brick_sum_plane         (const GwyBrick *brick,
                                               GwyDataField *target,
                                               gint istart,
                                               gint jstart,
                                               gint kstart,
                                               gint width,
                                               gint height,
                                               gint depth,
                                               gboolean keep_offsets);
void              gwy_brick_sum_xy_plane      (const GwyBrick *brick,
                                               GwyDataField *target);
void              gwy_brick_min_plane         (const GwyBrick *brick,
                                               GwyDataField *target,
                                               gint istart,
                                               gint jstart,
                                               gint kstart,
                                               gint width,
                                               gint height,
                                               gint depth,
                                               gboolean keep_offsets);
void              gwy_brick_min_xy_plane      (const GwyBrick *brick,
                                               GwyDataField *target);
void              gwy_brick_max_plane         (const GwyBrick *brick,
                                               GwyDataField *target,
                                               gint istart,
                                               gint jstart,
                                               gint kstart,
                                               gint width,
                                               gint height,
                                               gint depth,
                                               gboolean keep_offsets);
void              gwy_brick_max_xy_plane      (const GwyBrick *brick,
                                               GwyDataField *target);
void              gwy_brick_minpos_plane      (const GwyBrick *brick,
                                               GwyDataField *target,
                                               gint istart,
                                               gint jstart,
                                               gint kstart,
                                               gint width,
                                               gint height,
                                               gint depth,
                                               gboolean keep_offsets);
void              gwy_brick_minpos_xy_plane   (const GwyBrick *brick,
                                               GwyDataField *target);
void              gwy_brick_maxpos_plane      (const GwyBrick *brick,
                                               GwyDataField *target,
                                               gint istart,
                                               gint jstart,
                                               gint kstart,
                                               gint width,
                                               gint height,
                                               gint depth,
                                               gboolean keep_offsets);
void              gwy_brick_maxpos_xy_plane   (const GwyBrick *brick,
                                               GwyDataField *target);
void              gwy_brick_mean_plane        (const GwyBrick *brick,
                                               GwyDataField *target,
                                               gint istart,
                                               gint jstart,
                                               gint kstart,
                                               gint width,
                                               gint height,
                                               gint depth,
                                               gboolean keep_offsets);
void              gwy_brick_mean_xy_plane     (const GwyBrick *brick,
                                               GwyDataField *target);
void              gwy_brick_rms_plane         (const GwyBrick *brick,
                                               GwyDataField *target,
                                               gint istart,
                                               gint jstart,
                                               gint kstart,
                                               gint width,
                                               gint height,
                                               gint depth,
                                               gboolean keep_offsets);
void              gwy_brick_rms_xy_plane      (const GwyBrick *brick,
                                               GwyDataField *target);
void              gwy_brick_extract_line      (const GwyBrick *brick,
                                               GwyDataLine *target,
                                               gint istart,
                                               gint jstart,
                                               gint kstart,
                                               gint iend,
                                               gint jend,
                                               gint kend,
                                               gboolean keep_offsets);
void              gwy_brick_extract_z_line    (const GwyBrick *brick,
                                               GwyDataLine *target,
                                               gint i,
                                               gint j);
GwyDataLine*      gwy_brick_get_zcalibration  (const GwyBrick *brick);
void              gwy_brick_set_zcalibration  (GwyBrick *brick,
                                               GwyDataLine *calibration);
void              gwy_brick_copy_zcalibration (const GwyBrick *brick,
                                               GwyBrick *target);
void              gwy_brick_transpose         (GwyBrick *brick,
                                               GwyBrick *target,
                                               GwyBrickTransposeType type,
                                               gboolean xflipped,
                                               gboolean yflipped,
                                               gboolean zflipped);
void              gwy_brick_set_plane         (GwyBrick *brick,
                                               GwyDataField *plane,
                                               gint istart,
                                               gint jstart,
                                               gint kstart,
                                               gint width,
                                               gint height,
                                               gint depth);
void              gwy_brick_set_xy_plane      (GwyBrick *brick,
                                               GwyDataField *plane,
                                               gint lev);
void              gwy_brick_add_to_xy_planes  (GwyBrick *brick,
                                               GwyDataField *plane);
void              gwy_brick_add_to_z_lines    (GwyBrick *brick,
                                               GwyDataLine *line);

G_END_DECLS

#endif /* __GWY_BRICK_H__ */

/* vim: set cin et ts=4 sw=4 cino=>1s,e0,n0,f0,{0,}0,^0,\:1s,=0,g1s,h0,t0,+1s,c3,(0,u0 : */