Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
99f83d7e
Commit
99f83d7e
authored
Jun 12, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug picking in histogram
add marking/getting cells corresponding to a column of histo or quantiles
parent
e44709ec
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
120 additions
and
22 deletions
+120
-22
Apps/Tuto/tuto_histo.cpp
Apps/Tuto/tuto_histo.cpp
+24
-0
include/Algo/Histogram/histogram.h
include/Algo/Histogram/histogram.h
+24
-4
include/Algo/Histogram/histogram.hpp
include/Algo/Histogram/histogram.hpp
+54
-1
include/Utils/Qt/qthistodraw.h
include/Utils/Qt/qthistodraw.h
+5
-2
src/Algo/Histogram/histogram.cpp
src/Algo/Histogram/histogram.cpp
+11
-13
src/Utils/Qt/qthistodraw.cpp
src/Utils/Qt/qthistodraw.cpp
+2
-2
No files found.
Apps/Tuto/tuto_histo.cpp
View file @
99f83d7e
...
...
@@ -268,6 +268,30 @@ void MyQT::cb_redraw()
void
MyQT
::
clickHisto
(
unsigned
int
i
,
unsigned
int
j
)
{
std
::
cout
<<
"CLICK on column Histo: "
<<
i
<<
" / Quantiles: "
<<
j
<<
std
::
endl
;
if
(
i
!=
Utils
::
QT
::
RenderHistogram
::
NONE
)
{
std
::
vector
<
unsigned
int
>
vc
;
l_histo
->
cellsOfHistogramColumn
(
i
,
vc
);
std
::
cout
<<
"Cells of histo: "
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
vc
.
size
();
++
k
)
std
::
cout
<<
vc
[
k
]
<<
"/"
;
std
::
cout
<<
std
::
endl
;
CellMarker
<
VERTEX
>
cm
(
myMap
);
std
::
cout
<<
l_histo
->
markCellsOfHistogramColumn
(
i
,
cm
)
<<
" marked cells"
<<
std
::
endl
;
}
if
(
j
!=
Utils
::
QT
::
RenderHistogram
::
NONE
)
{
std
::
vector
<
unsigned
int
>
vc
;
l_histo
->
cellsOfHistogramColumn
(
j
,
vc
);
std
::
cout
<<
"Cells of quantile: "
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
vc
.
size
();
++
k
)
std
::
cout
<<
vc
[
k
]
<<
"/"
;
std
::
cout
<<
std
::
endl
;
}
}
...
...
include/Algo/Histogram/histogram.h
View file @
99f83d7e
...
...
@@ -26,6 +26,7 @@
#define __HISTOGRAM__
#include "Topology/generic/attributeHandler.h"
#include "Topology/generic/cellmarker.h"
#include "Geometry/vector_gen.h"
#include "Utils/colorMaps.h"
#include "Utils/vbo.h"
...
...
@@ -311,24 +312,43 @@ public:
* return cells of histogram's column
* @param c column of histogram
* @param vc vector of cells (indices)
* @return
true if not empty
* @return
number of cells
*/
bool
cellsOfHistogramColumn
(
unsigned
int
c
,
std
::
vector
<
unsigned
int
>
vc
)
const
;
unsigned
int
cellsOfHistogramColumn
(
unsigned
int
c
,
std
::
vector
<
unsigned
int
>&
vc
)
const
;
/**
* return cells of quantile's column
* @param c column of quantile
* @param vc vector of cells (indices)
* @return
true if not empty
* @return
number of cells
*/
bool
cellsOfQuauntilesColumn
(
unsigned
int
c
,
std
::
vector
<
unsigned
int
>
vc
)
const
;
unsigned
int
cellsOfQuantilesColumn
(
unsigned
int
c
,
std
::
vector
<
unsigned
int
>&
vc
)
const
;
/**
* mark cells of histogram's column
* @param c column of quantile
* @param cm marker
* @return number of marked cells
*/
template
<
typename
CELLMARKER
>
unsigned
int
markCellsOfHistogramColumn
(
unsigned
int
c
,
CELLMARKER
&
cm
)
const
;
/**
* mark cells of quantile's column
* @param c column of quantile
* @param cm marker
* @return number of marked cells
*/
template
<
typename
CELLMARKER
>
unsigned
int
markCellsOfQuantilesColumn
(
unsigned
int
c
,
CELLMARKER
&
cm
)
const
;
/**
* get the colorMap
*/
const
HistoColorMap
&
colorMap
()
const
;
};
...
...
include/Algo/Histogram/histogram.hpp
View file @
99f83d7e
...
...
@@ -22,7 +22,8 @@
* *
*******************************************************************************/
// forward
#include <algorithm>
namespace
CGoGN
{
...
...
@@ -224,6 +225,58 @@ inline bool Histogram::dataComp( const std::pair<double, unsigned int>& a, const
}
template
<
typename
CELLMARKER
>
unsigned
int
Histogram
::
markCellsOfHistogramColumn
(
unsigned
int
c
,
CELLMARKER
&
cm
)
const
{
if
(
!
m_sorted
)
{
std
::
sort
(
m_dataIdx
.
begin
(),
m_dataIdx
.
end
(),
dataComp
);
m_sorted
=
true
;
}
double
bi
=
(
m_max
-
m_min
)
/
m_nbclasses
*
c
+
m_min
;
double
bs
=
(
m_max
-
m_min
)
/
m_nbclasses
*
(
c
+
1
)
+
m_min
;
unsigned
int
nb
=
m_dataIdx
.
size
();
unsigned
int
i
=
0
;
while
((
i
<
nb
)
&&
(
data
(
i
)
<
bi
))
++
i
;
unsigned
int
nbc
=
0
;
while
((
i
<
nb
)
&&
(
data
(
i
)
<
bs
))
{
cm
.
mark
(
idx
(
i
++
));
++
nbc
;
}
return
nbc
;
}
template
<
typename
CELLMARKER
>
unsigned
int
Histogram
::
markCellsOfQuantilesColumn
(
unsigned
int
c
,
CELLMARKER
&
cm
)
const
{
double
bi
=
m_interv
[
c
];
double
bs
=
m_interv
[
c
+
1
];
unsigned
int
nb
=
m_dataIdx
.
size
();
unsigned
int
i
=
0
;
while
((
i
<
nb
)
&&
(
data
(
i
)
<
bi
))
++
i
;
unsigned
int
nbc
=
0
;
while
((
i
<
nb
)
&&
(
data
(
i
)
<
bs
))
{
cm
.
mark
(
idx
(
i
++
));
++
nbc
;
}
return
nbc
;
}
}
}
...
...
include/Utils/Qt/qthistodraw.h
View file @
99f83d7e
...
...
@@ -74,6 +74,9 @@ class RenderHistogram : public QWidget
void
axeVals
();
public:
static
const
unsigned
int
NONE
=
0xffffffff
;
/**
* constructor
* @param parent parent widget
...
...
@@ -143,8 +146,8 @@ public:
signals:
/**
* emitted signal when a column of histogram is clicked
* @param i column of histo (
0xffffffff
if none)
* @param j column of quantileq (
0xffffffff
if none)
* @param i column of histo (
NONE
if none)
* @param j column of quantileq (
NONE
if none)
*/
void
clicked
(
unsigned
int
,
unsigned
int
);
...
...
src/Algo/Histogram/histogram.cpp
View file @
99f83d7e
...
...
@@ -23,7 +23,7 @@
*******************************************************************************/
#include "Algo/Histogram/histogram.h"
#include <algorithm>
namespace
CGoGN
{
...
...
@@ -157,7 +157,7 @@ void Histogram::histoColorizeVBO(Utils::VBO& vbo)
}
bool
Histogram
::
cellsOfHistogramColumn
(
unsigned
int
c
,
std
::
vector
<
unsigned
int
>
vc
)
const
unsigned
int
Histogram
::
cellsOfHistogramColumn
(
unsigned
int
c
,
std
::
vector
<
unsigned
int
>&
vc
)
const
{
if
(
!
m_sorted
)
{
...
...
@@ -167,8 +167,8 @@ bool Histogram::cellsOfHistogramColumn(unsigned int c, std::vector<unsigned int>
vc
.
clear
();
double
bi
=
(
m_m
in
+
m_max
)
/
m_nbclasses
*
c
+
m_min
;
double
bs
=
(
m_m
in
+
m_max
)
/
m_nbclasses
*
(
c
+
1
)
+
m_min
;
double
bi
=
(
m_m
ax
-
m_min
)
/
m_nbclasses
*
c
+
m_min
;
double
bs
=
(
m_m
ax
-
m_min
)
/
m_nbclasses
*
(
c
+
1
)
+
m_min
;
unsigned
int
nb
=
m_dataIdx
.
size
();
unsigned
int
i
=
0
;
...
...
@@ -177,14 +177,12 @@ bool Histogram::cellsOfHistogramColumn(unsigned int c, std::vector<unsigned int>
++
i
;
while
((
i
<
nb
)
&&
(
data
(
i
)
<
bs
))
{
vc
.
push_back
(
idx
(
i
));
}
vc
.
push_back
(
idx
(
i
++
));
return
!
vc
.
empty
();
return
vc
.
size
();
}
bool
Histogram
::
cellsOfQuauntilesColumn
(
unsigned
int
c
,
std
::
vector
<
unsigned
int
>
vc
)
const
unsigned
int
Histogram
::
cellsOfQuantilesColumn
(
unsigned
int
c
,
std
::
vector
<
unsigned
int
>&
vc
)
const
{
vc
.
clear
();
...
...
@@ -198,14 +196,14 @@ bool Histogram::cellsOfQuauntilesColumn( unsigned int c, std::vector<unsigned in
++
i
;
while
((
i
<
nb
)
&&
(
data
(
i
)
<
bs
))
{
vc
.
push_back
(
idx
(
i
));
}
vc
.
push_back
(
idx
(
i
++
));
return
!
vc
.
empty
();
return
vc
.
size
();
}
}
}
}
...
...
src/Utils/Qt/qthistodraw.cpp
View file @
99f83d7e
...
...
@@ -288,7 +288,7 @@ void RenderHistogram::svgExport(const std::string& filename)
void
RenderHistogram
::
mousePressEvent
(
QMouseEvent
*
event
)
{
int
x
=
-
1
;
int
x
=
NONE
;
int
widthAxl
=
8
*
m_axl_nbd
;
const
std
::
vector
<
unsigned
int
>&
pop
=
m_histo
.
getPopulation
();
...
...
@@ -307,7 +307,7 @@ void RenderHistogram::mousePressEvent(QMouseEvent* event)
}
const
std
::
vector
<
double
>&
interv
=
m_histo
.
getQuantilesIntervals
();
int
xx
=
-
1
;
int
xx
=
NONE
;
if
(
m_drawQuantiles
&&
!
interv
.
empty
())
{
double
lw
=
(
m_histo
.
getMax
()
-
m_histo
.
getMin
())
/
double
(
m_w
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment