Skip to content
Snippets Groups Projects
Commit f6808728 authored by even's avatar even
Browse files

Auxiliary views repaired

parent 9f190e4c
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,8 @@ BSAccumulatorItem::BSAccumulatorItem (BSDetector *sd, int w, int h)
detector = sd;
width = w;
height = h;
selaccu = 0;
selaccu = (sd->isFiltering (BSDetector::STEP_FINAL) ?
BSDetector::STEP_FINAL : BSDetector::STEP_INITIAL);
map[0] = NULL;
map[1] = NULL;
solution[0] = -1;
......
......@@ -29,11 +29,14 @@ public:
/** \brief Inquires if the pre-filter accumulator is displayed.
*/
inline bool isPrefilterDisplayed () const {return (selaccu == 0); }
inline bool isPrefilterDisplayed () const {
return (selaccu == BSDetector::STEP_INITIAL); }
/** \brief Switches the displayed accumulator filter.
*/
inline void switchAccumulator () { selaccu = (selaccu != 0 ? 0 : 1); }
inline void switchAccumulator () {
selaccu = (selaccu != BSDetector::STEP_INITIAL ?
BSDetector::STEP_INITIAL : BSDetector::STEP_FINAL); }
/** \brief Returns the size of the filter accumulator graphics item.
*/
......@@ -82,7 +85,7 @@ private:
/** Blurred segment detector. */
BSDetector *detector;
/** Accumulator displayed (0 = prefilter, 1 = final filter). */
/** Accumulator displayed (1 = prefilter, 0 = final filter). */
int selaccu;
/** Accumulator width. */
......
......@@ -377,9 +377,10 @@ void BSDetectionWidget::keyPressEvent (QKeyEvent *event)
break;
case Qt::Key_F :
detector.switchFiltering (1);
detector.switchFiltering (BSDetector::STEP_FINAL);
cout << "Final filtering "
<< (detector.isFiltering (1) ? "on" : "off") << endl;
<< (detector.isFiltering (BSDetector::STEP_FINAL) ? "on" : "off")
<< endl;
extract ();
break;
......@@ -396,9 +397,10 @@ void BSDetectionWidget::keyPressEvent (QKeyEvent *event)
}
else
{
detector.switchFiltering (0);
detector.switchFiltering (BSDetector::STEP_INITIAL);
cout << "Pre-filtering "
<< (detector.isFiltering (0) ? "on" : "off") << endl;
<< (detector.isFiltering (BSDetector::STEP_INITIAL) ? "on" : "off")
<< endl;
extract ();
}
break;
......@@ -826,8 +828,8 @@ void BSDetectionWidget::localTest ()
p2 = Pt2i (232, 152);
*/
p1 = Pt2i (157, 125);
p2 = Pt2i (165, 88);
p1 = Pt2i (175, 40);
p2 = Pt2i (246, 79);
extract ();
cout << "Test run" << endl;
......
......@@ -273,8 +273,10 @@ void BSStructureItem::toggleDisplay (bool next)
displayItem += (next ? 1 : -1);
if (displayItem > DISPLAY_MAX) displayItem = DISPLAY_MIN;
else if (displayItem < DISPLAY_MIN) displayItem = DISPLAY_MAX;
det->setScanRecord (1, displayItem == DISPLAY_FINAL_SCANS_AND_FILTER);
det->setScanRecord (0, displayItem == DISPLAY_INITIAL_SCANS_AND_FILTER);
det->setScanRecord (BSDetector::STEP_FINAL,
displayItem == DISPLAY_FINAL_SCANS_AND_FILTER);
det->setScanRecord (BSDetector::STEP_INITIAL,
displayItem == DISPLAY_INITIAL_SCANS_AND_FILTER);
}
......
......@@ -313,7 +313,7 @@ void BSDetector::switchOrthoScans ()
vector<Pt2i> BSDetector::getRejected (int step) const
{
vector<Pt2i> res;
if (step != 0)
if (step == STEP_FINAL)
{
if (filteringOn) res = lsf2->getRejected ();
}
......@@ -324,7 +324,7 @@ vector<Pt2i> BSDetector::getRejected (int step) const
void BSDetector::switchFiltering (int step)
{
if (step != 0)
if (step == STEP_FINAL)
{
filteringOn = ! filteringOn;
if (filteringOn && lsf2 == NULL) lsf2 = new LineSpaceFilter ();
......
......@@ -268,28 +268,31 @@ public:
* @param step Initial step addressed if set to 0, final step otherwise.
*/
inline vector<Pt2i> getScanBound1 (int step) const {
return (step != 0 ? bst2->getScanBound1 () : bst1->getScanBound1 ()); }
return (step == STEP_FINAL ?
bst2->getScanBound1 () : bst1->getScanBound1 ()); }
/**
* \brief Returns the lower bound of the final scan of the given step.
* @param step Initial step addressed if set to 0, final step otherwise.
*/
inline vector<Pt2i> getScanBound2 (int step) const {
return (step != 0 ? bst2->getScanBound2 () : bst1->getScanBound2 ()); }
return (step == STEP_FINAL ?
bst2->getScanBound2 () : bst1->getScanBound2 ()); }
/**
* \brief Returns the scan lines of the given step.
* @param step Initial step addressed if set to 0, final step otherwise.
*/
inline vector <vector <Pt2i> > getScans (int step) const {
return (step != 0 ? bst2->getScans () : bst1->getScans ()); }
return (step == STEP_FINAL ? bst2->getScans () : bst1->getScans ()); }
/**
* \brief Returns whether the scan record modality is set for the given step.
* @param step Initial step addressed if set to 0, final step otherwise.
*/
inline bool scanRecordOn (int step) {
return (step != 0 ? bst2->scanRecordOn () : bst1->scanRecordOn ()); }
return (step == STEP_FINAL ?
bst2->scanRecordOn () : bst1->scanRecordOn ()); }
/**
* \brief Sets the scan record modality of initial or final step.
......@@ -297,7 +300,7 @@ public:
* @param status Sets on if true, off otherwise.
*/
inline void setScanRecord (int step, bool status) {
if (step != 0) bst2->setScanRecord (status);
if (step == STEP_FINAL) bst2->setScanRecord (status);
else bst1->setScanRecord (status); }
/**
......@@ -355,14 +358,14 @@ public:
* @param step Initial step addressed if set to 0, final step otherwise.
*/
inline LineSpaceFilter *getFilter (int step) const {
return (step != 0 ? lsf2 : lsf1); }
return (step == STEP_FINAL ? lsf2 : lsf1); }
/**
* \brief Returns the accepted points by the line space based filter.
* @param step Initial step addressed if set to 0, final step otherwise.
*/
inline vector<Pt2i> getAccepted (int step) const {
return (step != 0 ?
return (step == STEP_FINAL ?
(filteringOn ? lsf2->getAccepted () : bsf->getAllPoints ()) :
(prefilteringOn ? lsf1->getAccepted () : bsini->getAllPoints ())); }
......@@ -377,7 +380,7 @@ public:
* @param step Initial step addressed if set to 0, final step otherwise.
*/
inline bool isFiltering (int step) const {
return (step != 0 ? filteringOn : prefilteringOn); }
return (step == STEP_FINAL ? filteringOn : prefilteringOn); }
/**
* \brief Toggles the use of the given line space based filter.
......
......@@ -73,6 +73,21 @@ public:
*/
virtual ~DigitalStraightLine () { }
/**
* \brief Returns the parameters of the digital straight line equations.
* @param a X slope parameter to provide.
* @param b Y slope parameter to provide.
* @param c intercept parameter to provide.
* @param nu width parameter to provide.
*/
inline void equation (int &a, int &b, int &c, int &nu) const
{
a = this->a;
b = this->b;
c = this->c;
nu = this->nu;
}
/**
* \brief Fills in the given array with the three medial axis parameters.
* @param a X slope parameter to provide.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment