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