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