1 | /* --------------- */ |
---|
2 | /* --- nrio2.h --- */ |
---|
3 | /* --------------- */ |
---|
4 | |
---|
5 | /* |
---|
6 | * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved |
---|
7 | * Univ Paris Sud XI, CNRS |
---|
8 | */ |
---|
9 | |
---|
10 | #ifndef _NR_IO2_H_ |
---|
11 | #define _NR_IO2_H_ |
---|
12 | |
---|
13 | |
---|
14 | /* |
---|
15 | * ---------------------- |
---|
16 | * --- display_matrix --- |
---|
17 | * --- display_matrix_T --- |
---|
18 | * --- display_matrix_number --- |
---|
19 | * --- display_matrix_positive --- |
---|
20 | * ---------------------- |
---|
21 | */ |
---|
22 | |
---|
23 | #define display_type_matrix(t) \ |
---|
24 | void short_name(t,display_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, char * format, char * name); \ |
---|
25 | void short_name(t,display_,matrix_T)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, char * format, char * name); \ |
---|
26 | void short_name(t,display_,matrix_number)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, char * format, char * name); \ |
---|
27 | void short_name(t,display_,matrix_positive)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, int32_t iformat, char * name) |
---|
28 | |
---|
29 | |
---|
30 | display_type_matrix(int8_t); |
---|
31 | display_type_matrix(uint8_t); |
---|
32 | display_type_matrix(int16_t); |
---|
33 | display_type_matrix(uint16_t); |
---|
34 | display_type_matrix(int32_t); |
---|
35 | display_type_matrix(uint32_t); |
---|
36 | display_type_matrix(int64_t); |
---|
37 | display_type_matrix(uint64_t); |
---|
38 | display_type_matrix(float); |
---|
39 | display_type_matrix(double); |
---|
40 | display_type_matrix(rgb8); |
---|
41 | display_type_matrix(rgbx8); |
---|
42 | |
---|
43 | |
---|
44 | /* |
---|
45 | * -------------------- |
---|
46 | * --- write_matrix --- |
---|
47 | * --- write_matrix_T --- |
---|
48 | * --- write_matrix_number --- |
---|
49 | * --- write_matrix_T_number --- |
---|
50 | * --- fwrite_matrix --- |
---|
51 | * --- fread_matrix --- |
---|
52 | * -------------------- |
---|
53 | */ |
---|
54 | |
---|
55 | #define write_type_matrix(t) \ |
---|
56 | void short_name(t,write_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, char * format, char * filename); \ |
---|
57 | void short_name(t,write_,matrix_T)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, char * format, char * filename); \ |
---|
58 | void short_name(t,write_,matrix_number)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, char * format, char * filename); \ |
---|
59 | void short_name(t,write_,matrix_T_number)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, char * format, char * filename); \ |
---|
60 | void short_name(t,fwrite_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, char * filename); \ |
---|
61 | void short_name(t,fread_,matrix)(char * filename, t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \ |
---|
62 | |
---|
63 | write_type_matrix(int8_t); |
---|
64 | write_type_matrix(uint8_t); |
---|
65 | write_type_matrix(int16_t); |
---|
66 | write_type_matrix(uint16_t); |
---|
67 | write_type_matrix(int32_t); |
---|
68 | write_type_matrix(uint32_t); |
---|
69 | write_type_matrix(int64_t); |
---|
70 | write_type_matrix(uint64_t); |
---|
71 | write_type_matrix(float); |
---|
72 | write_type_matrix(double); |
---|
73 | write_type_matrix(rgb8); |
---|
74 | write_type_matrix(rgbx8); |
---|
75 | |
---|
76 | |
---|
77 | // ------------------------------- |
---|
78 | // --- write_matrix_positive --- |
---|
79 | // ------------------------------- |
---|
80 | |
---|
81 | #define write_type_matrix_positive(t) \ |
---|
82 | void short_name(t,write_,matrix_positive)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, int32_t iformat, char * filename) |
---|
83 | |
---|
84 | write_type_matrix_positive(uint8_t); |
---|
85 | write_type_matrix_positive(uint16_t); |
---|
86 | write_type_matrix_positive(uint32_t); |
---|
87 | |
---|
88 | /* ------------------------ */ |
---|
89 | /* -- PGM IO for bmatrix -- */ |
---|
90 | /* ------------------------ */ |
---|
91 | |
---|
92 | uint8_t ** LoadPGM_ui8matrix (char * filename, int32_t * nrl, int32_t * nrh, int32_t * ncl, int32_t * nch); |
---|
93 | void LoadPGM_ui8matrix2 (char * filename, int32_t * nrl, int32_t * nrh, int32_t * ncl, int32_t * nch, uint8_t ** m); |
---|
94 | rgb8 ** LoadPPM_rgb8matrix (char * filename, int32_t * nrl, int32_t * nrh, int32_t * ncl, int32_t * nch); |
---|
95 | void LoadPPM_rgb8matrix2(char * filename, int32_t * nrl, int32_t * nrh, int32_t * ncl, int32_t * nch, rgb8 ** m); |
---|
96 | |
---|
97 | void MLoadPGM_ui8matrix(char * filename, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, uint8 ** m); |
---|
98 | void SavePGM_ui8matrix (uint8_t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, char * filename); |
---|
99 | void SavePPM_rgb8matrix (rgb8 ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, char * filename); |
---|
100 | |
---|
101 | |
---|
102 | |
---|
103 | #endif // _NR_IO2_H_ |
---|
104 | |
---|