Main Page | Modules | Data Structures | File List | Data Fields | Globals

graph/graph3D_tk.h

00001 #ifndef _GRAPH3D_TK_H_ 00002 #define _GRAPH3D_TK_H_ 00003 00004 #include <math.h> 00005 00006 #ifdef WIN32 00007 #include <windows.h> 00008 #endif 00009 00010 #ifdef GLUT 00011 #include <GL/glut.h> 00012 #else 00013 #include <gtk/gtk.h> 00014 #endif 00015 00016 #include <GL/gl.h> 00017 00018 #include "massspec/MS.rc.h" 00019 00020 #include "graph/graph3Ddataseries.h" 00021 #include "graph/graph3Dpeakseries.h" 00022 00023 /* **************************************************** */ 00024 00025 enum { GRAPH3D_OBJECT_TYPE_PLAIN_PEAK_ARRAY, 00026 GRAPH3D_OBJECT_TYPE_PEAKGROUP, 00027 GRAPH3D_OBJECT_TYPE_FPEAK_ARRAY, 00028 GRAPH3D_OBJECT_TYPE_SEQUENCE_ARRAY, 00029 GRAPH3D_OBJECT_TYPE_PEAKGROUP_ARRAY, 00030 GRAPH3D_OBJECT_TYPE_SEQUEST_RESULTS_ARRAY, 00031 GRAPH3D_OBJECT_TYPE_SQMQMAP 00032 }; 00033 00034 #define MAX_NO_HANDLES 40 00035 #define MAX_NO_DATASERIES 20 00036 #define MAX_NO_PEAKSERIES 20 00037 #define MAX_NO_ZOOMRECT 10 00038 #define MAX_NO_ISOCLUSTERS 10 00039 #define MAX_NO_PARENTS 3 00040 #define MAX_NO_CHILDREN 3 00041 #define GRAPH3D_MAX_NO_FPEAKS 5 00042 00043 extern char *GRAPH3D_FPEAK_FILENAME; 00044 00045 struct Graph3DObjectHandle 00046 { 00047 int nHandleType; 00048 int nHandles; 00049 int pHandles[10]; 00050 void* pData; 00051 int nData; 00052 00053 }; 00054 00055 typedef struct Graph3DObjectHandle Graph3DObjectHandle; 00056 00057 struct Bitmap 00058 { 00059 int BITDEPTH; 00060 int HEIGHT; 00061 int WIDTH; 00062 GLubyte* BITS; 00063 }; 00064 00065 typedef struct Bitmap Bitmap; 00066 00067 struct Graph3DMetrics 00068 { 00069 int WIN_WIDTH; 00070 int WIN_HEIGHT; 00071 double X_POINTS_PER_PIXEL; 00072 double Y_POINTS_PER_PIXEL; 00073 float ORTHO_X0; 00074 float ORTHO_X1; 00075 float ORTHO_Y0; 00076 float ORTHO_Y1; 00077 int WIN_X_POS; 00078 int WIN_Y_POS; 00079 char WIN_TITLE[128]; 00080 }; 00081 00082 typedef struct Graph3DMetrics Graph3DMetrics; 00083 00084 struct Graph3DAxis 00085 { 00086 unsigned int LOG_SCALE : 1; 00087 float LENGTH; 00088 float TICK_LENGTH; 00089 float TICK_POINT_SPACING; 00090 int TICK_PIXEL_SPACING; 00091 float FIRST_TICK; 00092 int NO_TICKS; 00093 int DECIMAL_EXPONENT; 00094 int SF; 00095 int FONT_WIDTH; 00096 int FONT_HEIGHT; 00097 }; 00098 00099 typedef struct Graph3DAxis Graph3DAxis; 00100 00101 #ifndef GRAPH3D_BASIC 00102 struct MQTools 00103 { 00104 char* FILTER; 00105 int CURVE; 00106 PeakFinder PEAKFINDER; 00107 char* PEAKFINDER_SE; 00108 int PEAKFINDER_TH; 00109 }; 00110 00111 typedef struct MQTools MQTools; 00112 #endif 00113 00114 struct Graph3DParam 00115 { 00116 unsigned MAP_ON : 1; // Is map present 00117 unsigned PEAKS_ON : 1; // Are the peaks present 00118 unsigned FPEAKS_ON : 1; // Are fpeaks present 00119 unsigned PEAK_GROUPS_ON : 1; // Are peakgroups present 00120 unsigned IC_ON : 1; // Are isoclusters present 00121 unsigned DAGS_ON : 1; // Are dags present (from clustering) 00122 unsigned RECTANGLES_ON : 1; // Are rectangle on 00123 unsigned GRID_ON : 1; 00124 unsigned RT_MOZ_ON : 1; 00125 unsigned VOLUMES_ON : 1; 00126 unsigned LMAP_ON : 1; 00127 unsigned MAP_MODIFIED : 1; 00128 00129 unsigned RCCMAP_CHOOSE_ON : 1; 00130 unsigned RCC_ON : 1; 00131 00132 unsigned DATA_ON : 1; 00133 unsigned ZOOM_ON : 1; 00134 unsigned CHOOSE_PEAKS_ON : 1; 00135 unsigned MS_ON : 1; 00136 unsigned MC_ON : 1; 00137 unsigned FILTER_ON : 1; 00138 unsigned PSD_ON : 1; 00139 unsigned TIC_ON : 1; 00140 00141 unsigned INVALID_PEAKS_ON : 1; 00142 00143 unsigned INIT_FOUND : 1; 00144 unsigned FIT_ON : 1; 00145 00146 unsigned INVALID_PEAKS_LOADED: 1; 00147 unsigned MS2_LOADED : 1; 00148 unsigned FPEAKS_LOADED : 1; 00149 unsigned PEAKS_FOUND : 1; 00150 unsigned RCCPEAKS_FOUND : 1; 00151 00152 unsigned SEQUENCES_ON : 1; 00153 00154 Experiment* EXPERIMENT; 00155 Experiment* MS2_EXPERIMENT; 00156 00157 // MAP RELATED 00158 Map2D* MAP; 00159 Map2D* ORIGINAL_MAP; 00160 Map2D* BUFFER_MAP[2]; 00161 00162 MS_Spectrum* MSSPECTRUM; 00163 00164 // Handles 00165 00166 int MS2_HANDLE; 00167 int MS1_HANDLE; 00168 int MC_HANDLE; 00169 00170 int PSD_HANDLE; 00171 int PSD_NOISE_HANDLE; 00172 00173 int LABELS_HANDLE; 00174 int PG_FPEAKS_HANDLE; 00175 int PEAKS_HANDLE; 00176 int FPEAKS_HANDLE; 00177 int RPEPTIDES_HANDLE; 00178 00179 Graph3DObjectHandle pHandles[MAX_NO_HANDLES]; 00180 00181 int CURR_SCAN; 00182 int CURR_SCAN_INDEX; 00183 int CURR_BIN; 00184 00185 BaselineMark* BASELINE_MARK; 00186 Peak2i* PEAKS; 00187 int PEAKS_NO; 00188 00189 00190 #ifndef GRAPH3D_BASIC 00191 // FITTER RELATED 00192 FPeak2i FPEAKS[GRAPH3D_MAX_NO_FPEAKS]; 00193 int FPEAKS_NO; 00194 00195 // DECONVOLUTION RELATED 00196 int* DAG_BASE_ARRAY; 00197 ISOTOPIC_CLUSTER* IC; 00198 int NO_IC; 00199 #endif 00200 00201 Rectangle4i *RECT_ARRAY; 00202 int CURR_LABEL; 00203 00204 // Zoom rectangles are in REL MODE NOT! ABSOLUTE 00205 Insets4f ZOOM_RECT[MAX_NO_ZOOMRECT]; 00206 int CURR_ZOOM_RECT; 00207 int PREV_ZOOM_RECT; 00208 00209 char LEGEND[100]; 00210 00211 }; 00212 00213 typedef struct Graph3DParam Graph3DParam; 00214 00215 struct Graph3D 00216 { 00217 unsigned EMPTY : 1; 00218 unsigned NODATA: 1; 00219 unsigned NORMALIZE_ON : 1; 00220 unsigned isRealized: 1; 00221 unsigned SMPL_VS_REAL: 1; 00222 00223 float TOP_MARGIN; 00224 float BOTTOM_MARGIN; 00225 float LEFT_MARGIN; 00226 float RIGHT_MARGIN; 00227 00228 Graph3DAxis X_AXIS; 00229 Graph3DAxis Y_AXIS; 00230 00231 Bitmap BITMAP; 00232 Bitmap BUFFER_BITMAP; 00233 DataSeries DATA [MAX_NO_DATASERIES + 1]; 00234 PeakSeries PEAKS[MAX_NO_PEAKSERIES + 1]; 00235 00236 char NAME[12]; 00237 00238 int nDataSeries; 00239 int nPeakSeries; 00240 00241 //float* X_ARRAY; 00242 //int X_START; 00243 //int X_STOP; 00244 float X_MIN; 00245 float X_MAX; 00246 00247 //float* Y_ARRAY; 00248 //int Y_START; 00249 //int Y_STOP; 00250 float Y_MIN; 00251 float Y_MAX; 00252 00253 Insets4f RECT; 00254 00255 int LOG_SCALE; 00256 Graph3DMetrics METRICS; 00257 Graph3DParam* PARAM; 00258 00259 #ifndef GRAPH3D_BASIC 00260 struct MQTools operators; 00261 #endif 00262 00263 int WHANDLE; 00264 00265 struct Graph3D* CHILDREN[MAX_NO_CHILDREN]; 00266 00267 struct Graph3D* PARENTS[MAX_NO_PARENTS]; 00268 00269 void (*createGraphWindow) (const char* name); 00270 void (*repaint) (void); 00271 float (*getY_ValueFromY_Bin) (Map2D* map, int bin); 00272 float (*getX_ValueFromX_Bin) (Map2D* map, int bin); 00273 }; 00274 00275 typedef struct Graph3D Graph3D; 00276 00277 // ############## GRAPH AND WINDOW RELATED ############ 00278 00279 void graph3D_init(); 00280 Graph3D* Graph3D_new(); 00281 void graph3D_idle(void); 00282 void graph3D_destroy(Graph3D* graph); 00283 00284 void graph3D_initGraph (Graph3D* G, const char* name); 00285 void graph3D_clearGraph(Graph3D* G); 00286 void graph3D_linkGraphs(Graph3D* parent, Graph3D* child); 00287 00288 Graph3D* Graph3D_getParentPointerWithMap(Graph3D* graph); 00289 Graph3D* Graph3D_getActiveWindow(); 00290 GLubyte* Graph3D_readWindow(Graph3D *G); 00291 void graph3D_repaintAll(); 00292 void graph3D_destroyAllWindows(); 00293 void graph3D_saveAllWindowMetrics(); 00294 void graph3D_translateMousePosToGraphPos(Graph3D* graph, int x_pixelpos, int y_pixelpos, 00295 float* x_graphpos, float* y_graphpos); 00296 00297 // ############ AXIS RELATED ################ 00298 float graph3D_findBestDeltaTick(Graph3D *G, const int axis); 00299 int graph3D_drawAxisNumbersUsingHashFunction(Graph3D *G, const int axis); 00300 int graph3D_drawAxisNumbers(Graph3D *G, const int axis); 00301 00302 // ################################################### 00303 int Graph3D_isPeak2fIn(Graph3D* graph, Peak2f* peak); 00304 00305 void graph3D_initDataSeries(Graph3D* graph); 00306 void graph3D_hideDataSeries(Graph3D* graph, int DataSeriesHandle); 00307 void graph3D_showDataSeries(Graph3D* graph, int DataSeriesHandle); 00308 00309 DataSeries* Graph3D_getDataSeriesPointer(Graph3D* graph, int handle); 00310 PeakSeries* Graph3D_getPeakSeriesPointer(Graph3D* graph, int handle); 00311 00312 void graph3D_destroyDataSeries(Graph3D* graph, int data_series_handle); 00313 void graph3D_destroyPeakSeries(Graph3D* graph, int peak_series_handle); 00314 00315 void Graph3D_fprintPeakSeries (FILE* fp, struct PeakSeries* ps, struct Graph3D* G); 00316 void Graph3D_setDataSeriesHalfWidth (Graph3D* graph, int handle, float hw); 00317 00318 00319 //############# BOUNDARIES AND INSETS4F ################# 00320 00321 void Graph3D_setBoundariesForMap (Graph3D* graph, Map2D* map); 00322 void Graph3D_setBoundariesForPeakSeries(Graph3D* graph, int handle); 00323 00324 Insets4f Graph3D_getInsets4fFromMap(Map2D* map); 00325 Insets4i Graph3D_getInsets4iFromMap(Map2D* map); 00326 00327 Insets4f Graph3D_getInsetsFromDataSeries (Graph3D* graph, int handle); 00328 Insets4f Graph3D_getInsetsForPeakSeries(Graph3D* graph, int handle); 00329 00330 Map2D* Graph3D_getMap2DPointer(Graph3D* graph); 00331 00332 void Graph3D_setBoundaries (Graph3D* G, Insets4f rect); 00333 void Graph3D_updateBoundaries (Graph3D* graph, Insets4f rect); 00334 void Graph3D_setCurrentZoomRect(Graph3D* graph, Insets4f* rect); 00335 float Graph3D_getPointsFromPixels(Graph3D* graph, int pixels, int axis); 00336 00337 void graph3D_keyboard(unsigned char key, int x, int y); 00338 void graph3D_special (int key, int x, int y); 00339 void graph3D_mouse (int button, int state, int x, int y); 00340 00341 void Graph3D_zoomIn (Graph3D* graph, Insets4f rect); 00342 void Graph3D_zoomOut (Graph3D* graph); 00343 void Graph3D_zoomInAll (Graph3D* graph, Insets4f rectangle); 00344 00345 void print_bitmap_string(void* font, char* s); 00346 00347 void Graph3D_exportFile(Graph3D* graph, int format, int sort, int options, int nbcol, char *filename, char *extension); 00348 // Graph3D Global Parameters 00349 #define MAX_NO_GRAPHS 6 00350 00351 extern Graph3D GRAPHS[MAX_NO_GRAPHS+1]; 00352 extern int GRAPH3D_CURR_WINDOW; 00353 00354 extern int GRAPH3D_ZOOM_LINKED; 00355 extern int GRAPH3D_HISTOGRAM_ON; 00356 00357 00358 // ############ PALLETE RELATED ################ 00359 typedef GLfloat Color[3]; 00360 extern Color palette[256]; 00361 extern int GRAPH3D_NO_GRAYS; 00362 extern GLfloat** GRAPH3D_HPAL; 00363 extern int GRAPH3D_PIXEL_DEPTH; 00364 extern int GRAPH3D_CURR_COLOR; 00365 extern int GRAPH3D_GRAYLEVEL_TYPE; 00366 enum 00367 { 00368 RED = 0, 00369 GREEN = 1, 00370 BLUE = 2, 00371 BLACK = 3, 00372 WHITE = 4, 00373 MAGENTA = 5, 00374 CYAN = 6, 00375 YELLOW = 7, 00376 ORANGE = 8, 00377 LRED = 9, 00378 LGREEN = 10, 00379 LBLUE = 11, 00380 HYPSOMETRIC_COLOR_INDEX = 30 00381 }; 00382 00383 void Graph3D_setGrayleverType(int gltype); 00384 void graph3D_setColor(int index); 00385 void graph3D_setHypsometricPalette(); 00386 00387 enum 00388 { 00389 GRAPH3D_MAP_LABELED, 00390 GRAPH3D_MAP_HYPSOMETRIC, 00391 GRAPH3D_MAP_HYBRID, 00392 GRAPH3D_MAP_HIGHLIGHTED, 00393 GRAPH3D_MAP_BINARY 00394 }; 00395 00396 enum 00397 { 00398 GRAPH3D_X_AXIS, 00399 GRAPH3D_Y_AXIS 00400 }; 00401 00402 enum 00403 { 00404 GRAPH3D_PMAP, 00405 GRAPH3D_LMAP 00406 }; 00407 00408 00409 enum 00410 { 00411 GRAPH3D_NO_POINTS, 00412 GRAPH3D_POINTS, 00413 GRAPH3D_CONNECTED_POINTS, 00414 GRAPH3D_HISTOGRAM, 00415 GRAPH3D_BAR, 00416 GRAPH3D_LINES, 00417 GRAPH3D_RECTS 00418 }; 00419 00420 enum 00421 { 00422 GRAPH3D_LOG, 00423 GRAPH3D_LINEAR, 00424 GRAPH3D_NORMALIZED_LINEAR 00425 }; 00426 00427 void Graph3D_key_show (Graph3D* graph, unsigned char key, int x, int y); 00428 void Graph3D_key_perform(Graph3D* graph, unsigned char key, int x, int y); 00429 void Graph3D_key_view (Graph3D* graph, unsigned char key, int x, int y); 00430 void Graph3DParam_init (Graph3DParam* graph); 00431 00432 void Graph3D_movePeaksInRT(Graph3D* graph, int handle, float dx); 00433 00434 void graph3D_updateOrtho(Graph3D* graph); 00435 00436 #include "graph3Dmcms.h" 00437 #include "graph3Dbmp.h" 00438 00439 #ifndef GRAPH3D_BASIC 00440 #include "curves/curves.h" 00441 #include "proteome/proteome.h" 00442 #include "sequence/sequence.h" 00443 #include "graph3Dget.h" 00444 #include "graph3Dplot_obj.h" 00445 #endif 00446 00447 Peak2f* Graph3D_getSegmentationLabelsPosition(Graph3D* graph, Attributes* attr, int nattr); 00448 00449 #include "graph3Dplot.h" 00450 00451 00452 00453 #include "graph3Ddraw.h" 00454 #include "graph3Dkeys.h" 00455 00456 #include "gl2ps.h" 00457 00458 #endif 00459

Generated on Sun Feb 13 01:05:56 2005 for MapQuant by doxygen 1.3.7