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