Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Olena
pylene
Commits
7c3a92a0
Commit
7c3a92a0
authored
Jan 16, 2020
by
Edwin Carlinet
Browse files
Merge branch 'development/maxtrees' into development/cpp20
parents
f2ccdf20
1f4c2f85
Pipeline
#16027
passed with stages
in 10 minutes and 52 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pylene/CMakeLists.txt
View file @
7c3a92a0
...
...
@@ -4,7 +4,7 @@ find_package(Boost 1.58 REQUIRED)
find_package
(
FreeImage REQUIRED
)
find_package
(
TBB
)
find_package
(
range-v3 0.9.1 REQUIRED
)
find_package
(
range-v3 0.9.1 REQUIRED
CONFIG
)
find_package
(
fmt 6.0 REQUIRED
)
set
(
PYLENE_USE_TBB YES CACHE BOOL
"Set to NO to disable use of TBB and parallelization"
)
...
...
pylene/PyleneConfig.cmake.in
View file @
7c3a92a0
include(CMakeFindDependencyMacro)
find_dependency(Boost 1.58)
find_dependency(range-v3 0.5.0)
find_dependency(fmt)
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.2)
find_dependency(cmcstl2)
endif()
find_dependency(range-v3 0.9.1 CONFIG)
find_dependency(fmt 6.0)
include("${CMAKE_CURRENT_LIST_DIR}/PyleneTargets.cmake")
pylene/include/mln/core/image/experimental/private/ndbuffer_image.hpp
View file @
7c3a92a0
...
...
@@ -45,7 +45,8 @@ namespace mln
/// Type definitions
/// \{
using
point_type
=
experimental
::
ndpoint
<
N
>
;
using
point_type
=
experimental
::
ndpoint
<
N
,
short
>
;
using
fast_point_type
=
experimental
::
ndpoint
<
N
>
;
using
value_type
=
T
;
using
reference
=
T
&
;
using
const_reference
=
const
T
&
;
...
...
@@ -137,9 +138,9 @@ namespace mln
[[
deprecated
]]
T
*
data
()
noexcept
{
return
this
->
buffer
();
}
[[
deprecated
]]
const
T
*
data
()
const
noexcept
{
return
this
->
buffer
();
}
index_type
index_of_point
(
point_type
p
)
const
noexcept
;
point_type
point_at_index
(
index_type
i
)
const
noexcept
;
index_type
delta_index
(
point_type
p
)
const
noexcept
;
index_type
index_of_point
(
fast_
point_type
p
)
const
noexcept
;
fast_
point_type
point_at_index
(
index_type
i
)
const
noexcept
;
index_type
delta_index
(
fast_
point_type
p
)
const
noexcept
;
/// \}
/// Slicing & clipping operations
...
...
@@ -151,17 +152,17 @@ namespace mln
/// Value access
/// \{
const_reference
operator
()(
point_type
p
)
const
noexcept
;
reference
operator
()(
point_type
p
)
noexcept
;
const_reference
at
(
point_type
p
)
const
noexcept
;
reference
at
(
point_type
p
)
noexcept
;
const_reference
operator
()(
fast_
point_type
p
)
const
noexcept
;
reference
operator
()(
fast_
point_type
p
)
noexcept
;
const_reference
at
(
fast_
point_type
p
)
const
noexcept
;
reference
at
(
fast_
point_type
p
)
noexcept
;
const_reference
operator
[](
index_type
i
)
const
noexcept
;
reference
operator
[](
index_type
i
)
noexcept
;
new_pixel_type
new_pixel
(
point_type
p
)
noexcept
;
new_const_pixel_type
new_pixel
(
point_type
p
)
const
noexcept
;
new_pixel_type
new_pixel_at
(
point_type
p
)
noexcept
;
new_const_pixel_type
new_pixel_at
(
point_type
p
)
const
noexcept
;
new_pixel_type
new_pixel
(
fast_
point_type
p
)
noexcept
;
new_const_pixel_type
new_pixel
(
fast_
point_type
p
)
const
noexcept
;
new_pixel_type
new_pixel_at
(
fast_
point_type
p
)
noexcept
;
new_const_pixel_type
new_pixel_at
(
fast_
point_type
p
)
const
noexcept
;
new_value_range
new_values
()
noexcept
;
...
...
@@ -191,8 +192,8 @@ namespace mln
std
::
ptrdiff_t
__index_of_point
(
const
int
coords
[])
const
noexcept
;
new_pixel_type
__pixel_at
(
point_type
p
)
noexcept
;
new_const_pixel_type
__pixel_at
(
point_type
p
)
const
noexcept
;
new_pixel_type
__pixel_at
(
fast_
point_type
p
)
noexcept
;
new_const_pixel_type
__pixel_at
(
fast_
point_type
p
)
const
noexcept
;
// Get a data reference at the given coords
T
&
__at
(
const
int
coords
[])
const
noexcept
;
...
...
@@ -401,15 +402,15 @@ namespace mln
template
<
class
T
,
int
N
>
inline
auto
__ndbuffer_image
<
T
,
N
>::
point_at_index
(
index_type
i
)
const
noexcept
->
point_type
inline
auto
__ndbuffer_image
<
T
,
N
>::
point_at_index
(
index_type
i
)
const
noexcept
->
fast_
point_type
{
point_type
coords
;
fast_
point_type
coords
;
Impl
::
get_point
(
this
->
__info
(),
i
,
coords
.
data
());
return
coords
;
}
template
<
class
T
,
int
N
>
inline
auto
__ndbuffer_image
<
T
,
N
>::
index_of_point
(
point_type
p
)
const
noexcept
->
index_type
inline
auto
__ndbuffer_image
<
T
,
N
>::
index_of_point
(
fast_
point_type
p
)
const
noexcept
->
index_type
{
assert
(
Impl
::
is_point_valid
(
this
->
__info
(),
p
.
data
()));
return
Impl
::
get_index
(
this
->
__info
(),
p
.
data
());
...
...
@@ -417,7 +418,7 @@ namespace mln
template
<
class
T
,
int
N
>
inline
auto
__ndbuffer_image
<
T
,
N
>::
delta_index
(
point_type
p
)
const
noexcept
->
index_type
inline
auto
__ndbuffer_image
<
T
,
N
>::
delta_index
(
fast_
point_type
p
)
const
noexcept
->
index_type
{
return
Impl
::
get_index
(
this
->
__info
(),
p
.
data
());
}
...
...
@@ -476,74 +477,74 @@ namespace mln
template
<
class
T
,
int
N
>
inline
auto
__ndbuffer_image
<
T
,
N
>::
operator
()(
point_type
p
)
const
noexcept
->
const_reference
inline
auto
__ndbuffer_image
<
T
,
N
>::
operator
()(
fast_
point_type
p
)
const
noexcept
->
const_reference
{
assert
(
Impl
::
is_point_in_domain
(
this
->
__info
(),
p
.
data
()));
return
*
Impl
::
get_pointer
(
this
->
__info
(),
p
.
data
());
}
template
<
class
T
,
int
N
>
inline
auto
__ndbuffer_image
<
T
,
N
>::
operator
()(
point_type
p
)
noexcept
->
reference
inline
auto
__ndbuffer_image
<
T
,
N
>::
operator
()(
fast_
point_type
p
)
noexcept
->
reference
{
assert
(
Impl
::
is_point_in_domain
(
this
->
__info
(),
p
.
data
()));
return
*
Impl
::
get_pointer
(
this
->
__info
(),
p
.
data
());
}
template
<
class
T
,
int
N
>
inline
auto
__ndbuffer_image
<
T
,
N
>::
__pixel_at
(
point_type
p
)
const
noexcept
->
new_const_pixel_type
inline
auto
__ndbuffer_image
<
T
,
N
>::
__pixel_at
(
fast_
point_type
p
)
const
noexcept
->
new_const_pixel_type
{
point_type
lcoords
=
p
;
fast_
point_type
lcoords
=
p
;
lcoords
[
0
]
=
0
;
const
T
*
lineptr
=
Impl
::
get_pointer
(
this
->
__info
(),
lcoords
.
data
());
return
new_const_pixel_type
{{},
this
->
__info
(),
lineptr
,
p
};
}
template
<
class
T
,
int
N
>
inline
auto
__ndbuffer_image
<
T
,
N
>::
__pixel_at
(
point_type
p
)
noexcept
->
new_pixel_type
inline
auto
__ndbuffer_image
<
T
,
N
>::
__pixel_at
(
fast_
point_type
p
)
noexcept
->
new_pixel_type
{
point_type
lcoords
=
p
;
fast_
point_type
lcoords
=
p
;
lcoords
[
0
]
=
0
;
T
*
lineptr
=
Impl
::
get_pointer
(
this
->
__info
(),
lcoords
.
data
());
return
new_pixel_type
{{},
this
->
__info
(),
lineptr
,
p
};
}
template
<
class
T
,
int
N
>
inline
auto
__ndbuffer_image
<
T
,
N
>::
new_pixel
(
point_type
p
)
const
noexcept
->
new_const_pixel_type
inline
auto
__ndbuffer_image
<
T
,
N
>::
new_pixel
(
fast_
point_type
p
)
const
noexcept
->
new_const_pixel_type
{
assert
(
Impl
::
is_point_in_domain
(
this
->
__info
(),
p
.
data
()));
return
this
->
__pixel_at
(
p
);
}
template
<
class
T
,
int
N
>
inline
auto
__ndbuffer_image
<
T
,
N
>::
new_pixel
(
point_type
p
)
noexcept
->
new_pixel_type
inline
auto
__ndbuffer_image
<
T
,
N
>::
new_pixel
(
fast_
point_type
p
)
noexcept
->
new_pixel_type
{
assert
(
Impl
::
is_point_in_domain
(
this
->
__info
(),
p
.
data
()));
return
this
->
__pixel_at
(
p
);
}
template
<
class
T
,
int
N
>
inline
auto
__ndbuffer_image
<
T
,
N
>::
new_pixel_at
(
point_type
p
)
const
noexcept
->
new_const_pixel_type
inline
auto
__ndbuffer_image
<
T
,
N
>::
new_pixel_at
(
fast_
point_type
p
)
const
noexcept
->
new_const_pixel_type
{
assert
(
Impl
::
is_point_valid
(
this
->
__info
(),
p
.
data
()));
return
this
->
__pixel_at
(
p
);
}
template
<
class
T
,
int
N
>
inline
auto
__ndbuffer_image
<
T
,
N
>::
new_pixel_at
(
point_type
p
)
noexcept
->
new_pixel_type
inline
auto
__ndbuffer_image
<
T
,
N
>::
new_pixel_at
(
fast_
point_type
p
)
noexcept
->
new_pixel_type
{
assert
(
Impl
::
is_point_valid
(
this
->
__info
(),
p
.
data
()));
return
this
->
__pixel_at
(
p
);
}
template
<
class
T
,
int
N
>
inline
auto
__ndbuffer_image
<
T
,
N
>::
at
(
point_type
p
)
const
noexcept
->
const_reference
inline
auto
__ndbuffer_image
<
T
,
N
>::
at
(
fast_
point_type
p
)
const
noexcept
->
const_reference
{
assert
(
Impl
::
is_point_valid
(
this
->
__info
(),
p
.
data
()));
return
*
Impl
::
get_pointer
(
this
->
__info
(),
p
.
data
());
}
template
<
class
T
,
int
N
>
inline
auto
__ndbuffer_image
<
T
,
N
>::
at
(
point_type
p
)
noexcept
->
reference
inline
auto
__ndbuffer_image
<
T
,
N
>::
at
(
fast_
point_type
p
)
noexcept
->
reference
{
assert
(
Impl
::
is_point_valid
(
this
->
__info
(),
p
.
data
()));
return
*
Impl
::
get_pointer
(
this
->
__info
(),
p
.
data
());
...
...
pylene/include/mln/data/experimental/histogram.hpp
View file @
7c3a92a0
...
...
@@ -4,9 +4,9 @@
#include <vector>
#include <
range/v3/utility
/concepts.hpp>
#include <
concepts
/concepts.hpp>
#include <range/v3/algorithm/fill.hpp>
#include <range/v3/span.hpp>
#include <range/v3/
view/
span.hpp>
namespace
mln
::
data
::
experimental
...
...
@@ -34,7 +34,7 @@ namespace mln::data::experimental
{
using
V
=
image_value_t
<
std
::
remove_reference_t
<
I
>>
;
static_assert
(
::
ranges
::
v3
::
U
nsigned
I
ntegral
<
V
>
()
);
static_assert
(
::
concepts
::
u
nsigned
_i
ntegral
<
V
>
);
::
ranges
::
fill
(
hist
,
0
);
mln
::
for_each
(
std
::
forward
<
I
>
(
image
),
[
&
hist
](
int
x
)
{
hist
[
x
]
++
;
});
...
...
@@ -53,8 +53,7 @@ namespace mln::data::experimental
std
::
vector
<
std
::
size_t
>
histogram
(
I
image
)
{
using
V
=
image_value_t
<
I
>
;
static_assert
(
::
ranges
::
v3
::
UnsignedIntegral
<
V
>
());
static_assert
(
::
concepts
::
unsigned_integral
<
V
>
);
std
::
vector
<
std
::
size_t
>
histogram
;
histogram
.
resize
(
std
::
numeric_limits
<
V
>::
max
()
+
1
);
...
...
pylene/include/mln/morpho/experimental/canvas/depthfirst.hpp
View file @
7c3a92a0
...
...
@@ -74,9 +74,7 @@ namespace mln::morpho::experimental::canvas
keep_flooding:
{
int
k
=
1
;
for
(
auto
n
:
nbh
(
p
))
for
(
int
k
=
1
;
auto
n
:
nbh
(
p
))
{
int
mask
=
1
<<
k
++
;
if
((
pstatus
&
mask
)
||
status
.
at
(
n
)
!=
NONE
)
...
...
@@ -98,7 +96,6 @@ namespace mln::morpho::experimental::canvas
p
=
n
;
goto
flood
;
}
}
// All the neighbors have been seen, p is DONE
// status(p) = DONE;
...
...
pylene/include/mln/morpho/experimental/component_tree.hpp
View file @
7c3a92a0
...
...
@@ -7,7 +7,7 @@
#include <vector>
#include <range/v3/span.hpp>
#include <range/v3/
view/
span.hpp>
namespace
mln
::
morpho
::
experimental
{
...
...
pylene/include/mln/morpho/experimental/private/trie.hpp
0 → 100644
View file @
7c3a92a0
#pragma once
namespace
mln
::
morpho
::
details
{
template
<
int
Level
>
class
trie
{
};
}
test_package/conanfile.py
View file @
7c3a92a0
...
...
@@ -3,7 +3,8 @@ import os
class
PyleneTestConan
(
ConanFile
):
settings
=
"os"
,
"compiler"
,
"build_type"
,
"arch"
generators
=
"cmake_paths"
generators
=
[
"cmake_paths"
,
"cmake_find_package"
]
def
build
(
self
):
cmake
=
CMake
(
self
)
...
...
tests/core/algorithm/sort.cpp
View file @
7c3a92a0
...
...
@@ -4,12 +4,15 @@
#include <gtest/gtest.h>
using
P
=
mln
::
experimental
::
ndpoint
<
2
,
short
>
;
TEST
(
Core
,
Algorithm_Sort_UInt8
)
{
const
mln
::
experimental
::
image2d
<
std
::
uint8_t
>
ima
=
{{
1
,
4
,
2
},
{
3
,
6
,
8
}};
std
::
vector
<
mln
::
experimental
::
point2d
>
points
=
mln
::
experimental
::
sort_points
(
ima
);
std
::
vector
<
mln
::
experimental
::
point2d
>
ref
=
{{
0
,
0
},
{
2
,
0
},
{
0
,
1
},
{
1
,
0
},
{
1
,
1
},
{
2
,
1
}};
std
::
vector
<
P
>
points
=
mln
::
experimental
::
sort_points
(
ima
);
std
::
vector
<
P
>
ref
=
{{
0
,
0
},
{
2
,
0
},
{
0
,
1
},
{
1
,
0
},
{
1
,
1
},
{
2
,
1
}};
ASSERT_EQ
(
ref
,
points
);
}
...
...
@@ -20,8 +23,9 @@ TEST(Core, Algorithm_Sort_Decreasing_UInt8)
{
const
mln
::
experimental
::
image2d
<
std
::
uint8_t
>
ima
=
{{
1
,
4
,
2
},
{
3
,
6
,
8
}};
std
::
vector
<
mln
::
experimental
::
point2d
>
points
=
mln
::
experimental
::
sort_points
(
ima
,
std
::
greater
<
std
::
uint8_t
>
());
std
::
vector
<
mln
::
experimental
::
point2d
>
ref
=
{{
0
,
0
},
{
2
,
0
},
{
0
,
1
},
{
1
,
0
},
{
1
,
1
},
{
2
,
1
}};
std
::
vector
<
P
>
points
=
mln
::
experimental
::
sort_points
(
ima
,
std
::
greater
<
std
::
uint8_t
>
());
std
::
vector
<
P
>
ref
=
{{
0
,
0
},
{
2
,
0
},
{
0
,
1
},
{
1
,
0
},
{
1
,
1
},
{
2
,
1
}};
std
::
reverse
(
ref
.
begin
(),
ref
.
end
());
ASSERT_EQ
(
ref
,
points
);
}
...
...
@@ -35,8 +39,9 @@ TEST(Core, Algorithm_Sort_RGB8)
{
{
10
,
2
,
4
},
{
4
,
6
,
10
},
{
3
,
4
,
69
}
}
};
std
::
vector
<
mln
::
experimental
::
point2d
>
points
=
mln
::
experimental
::
sort_points
(
ima
,
mln
::
lexicographicalorder_less
<
mln
::
rgb8
>
());
std
::
vector
<
mln
::
experimental
::
point2d
>
ref
=
{{
2
,
1
},
{
1
,
1
},
{
1
,
0
},
{
2
,
0
},
{
0
,
1
},
{
0
,
0
}};
std
::
vector
<
P
>
points
=
mln
::
experimental
::
sort_points
(
ima
,
mln
::
lexicographicalorder_less
<
mln
::
rgb8
>
());
std
::
vector
<
P
>
ref
=
{{
2
,
1
},
{
1
,
1
},
{
1
,
0
},
{
2
,
0
},
{
0
,
1
},
{
0
,
0
}};
ASSERT_EQ
(
ref
,
points
);
}
...
...
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