Index: ChangeLog
from Christophe Berger <christophe(a)lrde.epita.fr>
* oln/appli/astro/tree_coherance_checks.hh: Update doc.
* oln/appli/astro/tree_statistics.hh: Add count of local root.
* oln/appli/astro/graphical_interface/interface.pro: Qmake options to compile without -w
-Wall.
* oln/appli/astro/graphical_interface/visualization_window.ui: Add options in interface.
* oln/appli/astro/graphical_interface/filterinterface.hh: Handle these options.
graphical_interface/filterinterface.hh | 45 ++-
graphical_interface/interface.pro | 6
graphical_interface/visualization_window.ui | 347 ++++++++++++++++++++++------
tree_coherance_checks.hh | 22 -
tree_statistics.hh | 60 ++++
5 files changed, 375 insertions(+), 105 deletions(-)
Index: oln/appli/astro/graphical_interface/visualization_window.ui
--- oln/appli/astro/graphical_interface/visualization_window.ui (revision 214)
+++ oln/appli/astro/graphical_interface/visualization_window.ui (working copy)
@@ -118,133 +118,148 @@
<string></string>
</property>
</widget>
- <widget class="QSpinBox">
+ <widget class="QLabel">
<property name="name">
- <cstring>value_height</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
+ <cstring>area_min</cstring>
</property>
<property name="geometry">
<rect>
- <x>330</x>
- <y>180</y>
- <width>59</width>
- <height>29</height>
+ <x>310</x>
+ <y>130</y>
+ <width>30</width>
+ <height>31</height>
</rect>
</property>
- <property name="maxValue">
- <number>999999</number>
+ <property name="text">
+ <string>min</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
- <cstring>active_tower</cstring>
+ <cstring>active_level</cstring>
</property>
<property name="geometry">
<rect>
<x>230</x>
- <y>330</y>
- <width>180</width>
+ <y>80</y>
+ <width>80</width>
<height>26</height>
</rect>
</property>
<property name="text">
- <string>Rectangular "towers"</string>
+ <string>Level</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
- <cstring>active_center_point</cstring>
+ <cstring>active_area</cstring>
</property>
<property name="geometry">
<rect>
<x>230</x>
- <y>280</y>
- <width>120</width>
+ <y>130</y>
+ <width>80</width>
<height>26</height>
</rect>
</property>
<property name="text">
- <string>Center point</string>
+ <string>Area</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
- <cstring>active_circle</cstring>
+ <cstring>active_height</cstring>
</property>
<property name="geometry">
<rect>
<x>230</x>
- <y>230</y>
+ <y>180</y>
<width>80</width>
<height>26</height>
</rect>
</property>
<property name="text">
- <string>Circle</string>
+ <string>Height</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
- <cstring>active_height</cstring>
+ <cstring>active_circle</cstring>
</property>
<property name="geometry">
<rect>
<x>230</x>
- <y>180</y>
+ <y>230</y>
<width>80</width>
<height>26</height>
</rect>
</property>
<property name="text">
- <string>Height</string>
+ <string>Circle</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
- <cstring>active_area</cstring>
+ <cstring>active_center_point</cstring>
</property>
<property name="geometry">
<rect>
<x>230</x>
- <y>130</y>
- <width>80</width>
+ <y>280</y>
+ <width>120</width>
<height>26</height>
</rect>
</property>
<property name="text">
- <string>Area</string>
+ <string>Center point</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
- <cstring>active_level</cstring>
+ <cstring>active_tower</cstring>
</property>
<property name="geometry">
<rect>
<x>230</x>
- <y>80</y>
- <width>80</width>
+ <y>330</y>
+ <width>180</width>
<height>26</height>
</rect>
</property>
<property name="text">
- <string>Level</string>
+ <string>Rectangular "towers"</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
<widget class="QSpinBox">
<property name="name">
- <cstring>value_area</cstring>
+ <cstring>value_area_min</cstring>
</property>
<property name="enabled">
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property name="geometry">
<rect>
- <x>330</x>
+ <x>350</x>
<y>130</y>
- <width>60</width>
+ <width>80</width>
<height>31</height>
</rect>
</property>
@@ -257,16 +272,57 @@
</widget>
<widget class="QSpinBox">
<property name="name">
+ <cstring>value_area_max</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>490</x>
+ <y>130</y>
+ <width>80</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="maxValue">
+ <number>999999</number>
+ </property>
+ <property name="lineStep">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>999999</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>area_min_2</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>450</x>
+ <y>130</y>
+ <width>30</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>max</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
<cstring>value_level</cstring>
</property>
<property name="enabled">
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property name="geometry">
<rect>
- <x>330</x>
+ <x>350</x>
<y>80</y>
- <width>60</width>
+ <width>80</width>
<height>29</height>
</rect>
</property>
@@ -274,11 +330,174 @@
<number>255</number>
</property>
</widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>value_height</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>350</x>
+ <y>180</y>
+ <width>80</width>
+ <height>29</height>
+ </rect>
+ </property>
+ <property name="maxValue">
+ <number>999999</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2_3</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>440</x>
+ <y>230</y>
+ <width>20</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>%</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>440</x>
+ <y>280</y>
+ <width>20</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>%</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>value_center_point</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>350</x>
+ <y>280</y>
+ <width>80</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="maxValue">
+ <number>100</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>500</x>
+ <y>330</y>
+ <width>20</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>%</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>value_tower</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>420</x>
+ <y>330</y>
+ <width>70</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="maxValue">
+ <number>100</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>value_circle</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>350</x>
+ <y>230</y>
+ <width>80</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="maxValue">
+ <number>100</number>
+ </property>
+ </widget>
</widget>
<toolbars>
</toolbars>
<connections>
<connection>
+ <sender>value_tower</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>UpdateValues()</slot>
+ </connection>
+ <connection>
+ <sender>active_area</sender>
+ <signal>stateChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>Attribute_area()</slot>
+ </connection>
+ <connection>
+ <sender>active_center_point</sender>
+ <signal>stateChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>Attribute_center_point()</slot>
+ </connection>
+ <connection>
+ <sender>active_circle</sender>
+ <signal>stateChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>Attribute_circle()</slot>
+ </connection>
+ <connection>
+ <sender>active_height</sender>
+ <signal>stateChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>Attribute_height()</slot>
+ </connection>
+ <connection>
+ <sender>active_level</sender>
+ <signal>stateChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>Attribute_level()</slot>
+ </connection>
+ <connection>
+ <sender>active_tower</sender>
+ <signal>stateChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>Attribute_tower()</slot>
+ </connection>
+ <connection>
<sender>compute_button</sender>
<signal>clicked()</signal>
<receiver>visualisation_window</receiver>
@@ -297,64 +516,46 @@
<slot>SaveResult()</slot>
</connection>
<connection>
- <sender>value_area</sender>
+ <sender>value_area_max</sender>
<signal>valueChanged(int)</signal>
<receiver>visualisation_window</receiver>
<slot>UpdateValues()</slot>
</connection>
<connection>
- <sender>value_height</sender>
+ <sender>value_area_min</sender>
<signal>valueChanged(int)</signal>
<receiver>visualisation_window</receiver>
<slot>UpdateValues()</slot>
</connection>
<connection>
- <sender>value_level</sender>
+ <sender>value_center_point</sender>
<signal>valueChanged(int)</signal>
<receiver>visualisation_window</receiver>
<slot>UpdateValues()</slot>
</connection>
<connection>
- <sender>view_input_image_button</sender>
- <signal>clicked()</signal>
- <receiver>visualisation_window</receiver>
- <slot>DisplayInputImage()</slot>
- </connection>
- <connection>
- <sender>active_area</sender>
- <signal>stateChanged(int)</signal>
- <receiver>visualisation_window</receiver>
- <slot>Attribute_area()</slot>
- </connection>
- <connection>
- <sender>active_center_point</sender>
- <signal>stateChanged(int)</signal>
- <receiver>visualisation_window</receiver>
- <slot>Attribute_center_point()</slot>
- </connection>
- <connection>
- <sender>active_circle</sender>
- <signal>stateChanged(int)</signal>
+ <sender>value_height</sender>
+ <signal>valueChanged(int)</signal>
<receiver>visualisation_window</receiver>
- <slot>Attribute_circle()</slot>
+ <slot>UpdateValues()</slot>
</connection>
<connection>
- <sender>active_height</sender>
- <signal>stateChanged(int)</signal>
+ <sender>value_level</sender>
+ <signal>valueChanged(int)</signal>
<receiver>visualisation_window</receiver>
- <slot>Attribute_height()</slot>
+ <slot>UpdateValues()</slot>
</connection>
<connection>
- <sender>active_level</sender>
- <signal>stateChanged(int)</signal>
+ <sender>view_input_image_button</sender>
+ <signal>clicked()</signal>
<receiver>visualisation_window</receiver>
- <slot>Attribute_level()</slot>
+ <slot>DisplayInputImage()</slot>
</connection>
<connection>
- <sender>active_tower</sender>
- <signal>stateChanged(int)</signal>
+ <sender>value_circle</sender>
+ <signal>valueChanged(int)</signal>
<receiver>visualisation_window</receiver>
- <slot>Attribute_tower()</slot>
+ <slot>UpdateValues()</slot>
</connection>
</connections>
<slots>
Index: oln/appli/astro/tree_statistics.hh
--- oln/appli/astro/tree_statistics.hh (revision 214)
+++ oln/appli/astro/tree_statistics.hh (working copy)
@@ -112,10 +112,50 @@
template<typename I>
int node_count(oln::appli::astro::clean<I>& tree)
{
- return tree.input.width() * tree.input.height()
+ return tree.input.size().nrows() * tree.input.size().ncols()
- leaf_count(tree);
}
+
+ /**
+ ** Counts the number of local root points in the tree.
+ **
+ ** \param I Type of maxtree's image.
+ **
+ ** \arg tree Maxtree structure to check.
+ **
+ ** \warning Maxtree should have already been computed.
+ **
+ ** \code
+ ** Algorithm used :
+ **
+ ** count <- 0
+ ** for all points of input
+ ** if p is global root or if p has a different value than his parent's value
in input image
+ ** then increment count (p is a local root)
+ ** at the end, return the count
+ **
+ ** \endcode
+ **
+ ** \return Number of local roots.
+ **
+ */
+ template<typename I>
+ int local_root_count(oln::appli::astro::clean<I>& tree)
+ {
+ typedef oln_type_of(I, point) point_type;
+ oln_type_of(I, fwd_piter) p(tree.input.size());
+ int count = 0;
+ for_all_p(p)
+ {
+ if (tree.parent[p] == p ||
+ tree.input[p] != tree.input[tree.parent[p]])
+ ++count;
+ }
+ return count;
+ }
+
+
/**
** Makes the children per node average.
**
Index: oln/appli/astro/graphical_interface/interface.pro
--- oln/appli/astro/graphical_interface/interface.pro (revision 214)
+++ oln/appli/astro/graphical_interface/interface.pro (working copy)
@@ -1,11 +1,13 @@
TEMPLATE = app
LANGUAGE = C++
-INCLUDEPATH += .
+CONFIG += warn_off release qt
+
+INCLUDEPATH += . ../../../../../olena ../../../../../metalic ../../../../../integre
SOURCES += main.cc
-HEADERS += filterinterface.hh image_viewer.hh qtincludes.hh utils.hh
+HEADERS += filterinterface.hh image_viewer.hh qtincludes.hh utils.hh
../../../canvas/tree.hh ../../../canvas/maxtree.hh
FORMS = visualization_window.ui
Index: oln/appli/astro/tree_coherance_checks.hh
Index: oln/appli/astro/graphical_interface/filterinterface.hh
--- oln/appli/astro/graphical_interface/filterinterface.hh (revision 214)
+++ oln/appli/astro/graphical_interface/filterinterface.hh (working copy)
@@ -57,9 +57,14 @@
virtual void UpdateValues()
{
- mt_.set_area(value_area->value());
+ mt_.set_area_min(value_area_min->value());
+ mt_.set_area_max(value_area_max->value());
mt_.set_level(value_level->value());
mt_.set_height(value_height->value());
+ mt_.set_circle(value_circle->value() / 100);
+ mt_.set_center_point(value_center_point->value() / 100);
+ mt_.set_tower(value_tower->value() / 100);
+
std::string out = "attributes value changed.";// area("
// + Utils::int2string(value_area->value())
// + "), point_value("
@@ -78,6 +83,8 @@
this->redraw_button->setEnabled(true);
this->save_result_button->setEnabled(true);
this->text_state->setText("Tree computed, please choose
attributes'values to draw the result.");
+
+ UpdateValues();
}
virtual void DisplayImage()
@@ -108,12 +115,14 @@
{
if (this->active_area->isChecked())
{
- this->value_area->setEnabled(true);
+ this->value_area_min->setEnabled(true);
+ this->value_area_max->setEnabled(true);
mt_.area_tag_ = true;
}
else
{
- this->value_area->setEnabled(false);
+ this->value_area_min->setEnabled(false);
+ this->value_area_max->setEnabled(false);
mt_.area_tag_ = false;
}
}
@@ -149,25 +158,43 @@
virtual void Attribute_circle()
{
if (this->active_circle->isChecked())
+ {
+ this->value_circle->setEnabled(true);
mt_.circle_tag_ = true;
+ }
else
+ {
mt_.circle_tag_ = false;
+ this->value_circle->setEnabled(false);
+ }
}
virtual void Attribute_center_point()
{
if (this->active_center_point->isChecked())
+ {
+ this->value_center_point->setEnabled(true);
mt_.center_p_tag_ = true;
+ }
else
+ {
mt_.center_p_tag_ = false;
+ this->value_center_point->setEnabled(false);
+ }
}
virtual void Attribute_tower()
{
if (this->active_tower->isChecked())
+ {
+ this->value_tower->setEnabled(true);
mt_.tour_tag_ = true;
+ }
else
+ {
mt_.tour_tag_ = false;
+ this->value_tower->setEnabled(false);
+ }
}
protected: