+
+///////////////////////////////////////////////////////////////////////////
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the version 3 of the GNU General Public License //
+// as published by the Free Software Foundation. //
+// //
+// This program is distributed in the hope that it will be useful, but //
+// WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+// General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// Written by Francois Fleuret, (C) IDIAP //
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports //
+///////////////////////////////////////////////////////////////////////////
+
+#ifndef PARSING_H
+#define PARSING_H
+
+/*
+
+ A Parsing is associated to a LabelledImage and stores responses over
+ cells.
+
+*/
+
+#include "fusion_sort.h"
+#include "pose_cell_hierarchy.h"
+#include "classifier.h"
+#include "labelled_image.h"
+
+class Parsing {
+ LabelledImagePool *_image_pool;
+ int _image_index;
+ int _nb_cells, _nb_positives, _nb_negatives;
+
+ PoseCell *_cells;
+ scalar_t *_responses;
+ int *_labels;
+
+public:
+
+ Parsing(LabelledImagePool *image_pool,
+ PoseCellHierarchy *hierarchy,
+ scalar_t proportion_negative_cells,
+ int image_index);
+
+ ~Parsing();
+
+ //////////////////////////////////////////////////////////////////////
+
+ inline int nb_cells() {
+ return _nb_cells;
+ }
+
+ inline int nb_positive_cells() {
+ return _nb_positives;
+ }
+
+ inline int nb_negative_cells() {
+ return _nb_negatives;
+ }
+
+ inline scalar_t response(int c) {
+ ASSERT(c >= 0 && c < _nb_cells);
+ return _responses[c];
+ }
+
+ inline int label(int c) {
+ ASSERT(c >= 0 && c < _nb_cells);
+ return _labels[c];
+ }
+
+ void down_one_level(PoseCellHierarchy *hierarchy, int level, int *sample_nb_occurences, scalar_t *sample_responses);
+
+ void update_cell_responses(PiFeatureFamily *pi_feature_family,
+ Classifier *classifier);
+
+ void collect_samples(SampleSet *samples,
+ PiFeatureFamily *pi_feature_family,
+ int s,
+ int *to_collect);
+};
+
+#endif