00001 /* The Partitions Musics Recognition System project. 00002 * (c)2003 by Fabien Pelisson (fabien dot pelisson at wanadoo dot fr) 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 */ 00018 00019 #ifndef MR_LAG_SECTION_H 00020 #define MR_LAG_SECTION_H 00021 00022 #include <mr_vector.h> 00023 #include <mr_line.h> 00024 00025 #ifdef __cplusplus 00026 extern "C" 00027 { 00028 #endif /* __cplusplus */ 00029 00030 #define LAG_SECTION_WIDTH(s) (((MrLagSegment*)mr_vector_get(s->segments, 0))->x - ((MrLagSegment*)mr_vector_get(s->segments, s->segments->size -1))->x + 1) 00031 00032 #define SECTION_START(s) ((MrLagSegment*)mr_vector_get(s->segments, 0)) 00033 #define SECTION_START_X(s) (SECTION_START(s)->x) 00034 #define SECTION_END(s) ((MrLagSegment*)mr_vector_get(s->segments, s->segments->size - 1)) 00035 #define SECTION_END_X(s) (SECTION_END(s)->x) 00036 00037 00038 typedef struct MrLagSection MrLagSection; 00039 00040 00047 struct MrLagSection 00048 { 00052 MrVector* segments; 00054 MrVector* right_junctions; 00056 MrVector* left_junctions; 00057 00059 unsigned int sum_height; 00060 00064 unsigned int mean_height; 00065 00067 unsigned int sum_y; 00068 00071 unsigned int mean_y; 00072 00079 short int filament; 00080 00082 short int removed; 00083 00084 MrLine* bb; 00085 }; 00086 00088 MrLagSection* mr_lag_section_new(); 00089 00093 void mr_lag_section_free(void *p); 00094 00098 void mr_lag_section_add_segment(MrLagSection* section, void* segment); 00099 00101 unsigned int mr_lag_section_area(MrLagSection* section); 00102 00106 unsigned int mr_lag_section_mean_Y(MrLagSection* section); 00107 00111 void mr_lag_section_remove(MrLagSection* section); 00112 00113 00114 00115 #ifdef __cplusplus 00116 } 00117 #endif /* __cplusplus */ 00118 00119 #endif /* MR_LAG_SECTION_H */