00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00080 #ifndef __GUARD_MAPLIB
00081 #define __GUARD_MAPLIB
00082
00083 #include "ccp4_utils.h"
00084
00085 #ifdef __cplusplus
00086 namespace CMap_io {
00087 typedef CCP4::CCP4File CCP4File;
00088 extern "C" {
00089 #endif
00090
00091 typedef struct _CMMFile_Skew CMMFile_Skew;
00092 typedef struct _CMMFile_Labels CMMFile_Labels;
00093 typedef struct _CMMFile_Symop CMMFile_Symop;
00094 typedef struct _CMMFile_Data CMMFile_Data;
00095 typedef struct _CMMFile_Stats CMMFile_Stats;
00096 typedef struct _CMMFile CMMFile;
00097
00098 struct _CMMFile_Labels {
00099 unsigned int number;
00100 char *labels[10];
00101 };
00102
00103 struct _CMMFile_Skew {
00104 float rotation[3][3];
00105 float translation[3];
00106 };
00107
00108 struct _CMMFile_Symop {
00109 unsigned int offset;
00110 unsigned int size;
00111 unsigned int number;
00112 };
00113
00114 struct _CMMFile_Data {
00115 size_t offset;
00116 size_t section_size;
00117 size_t header_size;
00118 size_t block_size;
00119 unsigned int number;
00120 };
00121
00122 struct _CMMFile_Stats {
00123 float offset;
00124 float min;
00125 float max;
00126 double mean;
00127 double rms;
00128 int total;
00129 };
00130
00131 struct _CMMFile {
00132 CCP4File *stream;
00133 char *file_name;
00134 unsigned int data_mode;
00135 unsigned int close_mode;
00136 float cell[6];
00137 int spacegroup;
00138 int map_dim[3];
00139 int origin[3];
00140 int cell_grid[3];
00141 int axes_order[3];
00142 CMMFile_Symop symop;
00143 CMMFile_Data data;
00144 CMMFile_Stats stats;
00145 CMMFile_Labels labels;
00146 CMMFile_Skew skew;
00147 int reserved[8];
00148 char user_access[24];
00149 };
00150
00151
00152 void *ccp4_cmap_open(const char *filename, int mode);
00153
00154
00155 void ccp4_cmap_close(CMMFile *mfile);
00156
00157
00158 void ccp4_cmap_closemode(CMMFile *mfile, unsigned int closemode);
00159
00160
00161 int ccp4_cmap_seek_section(CMMFile *mfile, int offset, unsigned int seek_mode);
00162
00163
00164 int ccp4_cmap_seek_row(CMMFile *, int offset, unsigned int seek_mode);
00165
00166
00167 int ccp4_cmap_seek_data(CMMFile *, int offset, unsigned int seek_mode);
00168
00169
00170 int ccp4_cmap_read_section(CMMFile *mfile, void *section);
00171
00172
00173 int ccp4_cmap_read_row(CMMFile *mfile, void *row);
00174
00175
00176 int ccp4_cmap_read_data(const CMMFile *mfile, void *items, int n_items);
00177
00178
00179 int ccp4_cmap_write_section(CMMFile *mfile, const void *section);
00180
00181
00182 int ccp4_cmap_write_row(CMMFile *mfile, const void *row);
00183
00184
00185 int ccp4_cmap_write_data(CMMFile *mfile, const void *items, int n_items);
00186
00187
00188 int ccp4_cmap_read_section_header(const CMMFile *mfile, char *header);
00189
00190
00191 int ccp4_cmap_write_section_header(CMMFile *mfile, const char *header);
00192
00193
00194 void ccp4_cmap_get_cell(const CMMFile *mfile, float *cell);
00195 void ccp4_cmap_get_grid(const CMMFile *mfile, int *grid);
00196 void ccp4_cmap_get_origin(const CMMFile *mfile, int *origin);
00197 void ccp4_cmap_get_order(const CMMFile *mfile, int *axes_order);
00198 void ccp4_cmap_get_dim(const CMMFile *mfile, int *map_dim);
00199 int ccp4_cmap_get_spacegroup(const CMMFile *mfile);
00200 void ccp4_cmap_get_mapstats(const CMMFile *mfile, float *min, float* max,
00201 double *mean, double *rms);
00202
00203
00204 void ccp4_cmap_set_cell(CMMFile *mfile, const float *cell);
00205 void ccp4_cmap_set_grid(CMMFile *mfile, const int *grid);
00206 void ccp4_cmap_set_origin(CMMFile *mfile, const int *origin);
00207 void ccp4_cmap_set_order(CMMFile *mfile, const int *axes_order);
00208 void ccp4_cmap_set_dim(CMMFile *mfile, const int *map_dim);
00209 void ccp4_cmap_set_spacegroup(CMMFile *mfile, int spacegroup);
00210 void ccp4_cmap_set_mapstats(CMMFile *mfile, const float min, const float max,
00211 const double mean, const double rms);
00212
00213
00214 unsigned int ccp4_cmap_get_datamode(const CMMFile *mfile);
00215
00216
00217 void ccp4_cmap_set_datamode(CMMFile *mfile, unsigned int datamode);
00218
00219
00220 size_t ccp4_cmap_get_local_header(CMMFile *mfile);
00221
00222
00223 void ccp4_cmap_set_local_header(CMMFile *mfile, size_t size);
00224
00225
00226 int ccp4_cmap_num_symop(const CMMFile *mfile);
00227
00228
00229 int ccp4_cmap_seek_symop(CMMFile *mfile, int isymop, unsigned int whence);
00230
00231
00232 int ccp4_cmap_get_symop(CMMFile *mfile, char *buffer);
00233
00234
00235 int ccp4_cmap_set_symop(CMMFile *mfile, const char *buffer);
00236
00237
00238 int ccp4_cmap_get_mask(const CMMFile *mfile, float *skew_mat, float *skew_trans);
00239
00240
00241 int ccp4_cmap_set_mask(CMMFile *mfile, const float *skew_mat, const float *skew_trans);
00242
00243
00244 int ccp4_cmap_number_label(const CMMFile *mfile);
00245
00246
00247 int ccp4_cmap_set_label(CMMFile *mfile, const char *label, int posn);
00248
00249
00250 char *ccp4_cmap_get_label(const CMMFile *mfile, int posn);
00251
00252
00253 int ccp4_cmap_set_title(CMMFile *mfile, const char *label);
00254
00255
00256 char *ccp4_cmap_get_title(const CMMFile *mfile);
00257
00258 #ifdef __cplusplus
00259 }
00260 }
00261 #endif
00262
00263 #endif