Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pylene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Olena
pylene
Commits
5e76699d
Commit
5e76699d
authored
Dec 11, 2020
by
Edwin Carlinet
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'development/fix-organoids' into 'next'
Fix bug
#72
See merge request
!107
parents
1d14830c
686b34c3
Pipeline
#26617
passed with stages
in 20 minutes and 53 seconds
Changes
5
Pipelines
83
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
31 deletions
+93
-31
pylene/include/mln/core/image/private/ndbuffer_image.hpp
pylene/include/mln/core/image/private/ndbuffer_image.hpp
+2
-22
pylene/include/mln/core/image/private/ndbuffer_image_impl.hpp
...ne/include/mln/core/image/private/ndbuffer_image_impl.hpp
+0
-9
pylene/include/mln/core/neighborhood/c26.hpp
pylene/include/mln/core/neighborhood/c26.hpp
+15
-0
pylene/include/mln/core/neighborhood/c6.hpp
pylene/include/mln/core/neighborhood/c6.hpp
+17
-0
tests/core/image/ndbuffer_image.cpp
tests/core/image/ndbuffer_image.cpp
+59
-0
No files found.
pylene/include/mln/core/image/private/ndbuffer_image.hpp
View file @
5e76699d
...
...
@@ -438,33 +438,13 @@ namespace mln
template
<
class
T
,
int
N
>
inline
__ndbuffer_image
<
T
,
2
>
__ndbuffer_image
<
T
,
N
>::
slice
(
int
z
)
const
{
int
begin
[
N
]
=
{
this
->
__axes
(
0
).
domain_begin
,
this
->
__axes
(
1
).
domain_begin
,
z
};
int
end
[
N
]
=
{
this
->
__axes
(
0
).
domain_end
,
this
->
__axes
(
1
).
domain_end
,
z
+
1
};
for
(
int
k
=
3
;
k
<
m_pdim
;
++
k
)
{
begin
[
k
]
=
0
;
end
[
k
]
=
1
;
}
ndbuffer_image_info_t
tmp
=
*
this
->
__info
();
Impl
::
select
(
&
tmp
,
2
,
begin
,
end
);
return
*
Impl
::
template
cast
<
T
,
2
>(
&
tmp
);
return
static_cast
<
__ndbuffer_image
<
T
,
2
>&&>
(
this
->
base
::
slice
(
z
));
}
template
<
class
T
,
int
N
>
inline
__ndbuffer_image
<
T
,
1
>
__ndbuffer_image
<
T
,
N
>::
row
(
int
y
)
const
{
int
begin
[
N
]
=
{
m_axes
[
0
].
domain_begin
,
y
};
int
end
[
N
]
=
{
m_axes
[
0
].
domain_end
,
y
+
1
};
for
(
int
k
=
2
;
k
<
m_pdim
;
++
k
)
{
begin
[
k
]
=
0
;
end
[
k
]
=
1
;
}
ndbuffer_image_info_t
tmp
=
*
this
->
__info
();
Impl
::
select
(
&
tmp
,
1
,
begin
,
end
);
return
*
Impl
::
template
cast
<
T
,
1
>(
&
tmp
);
return
static_cast
<
__ndbuffer_image
<
T
,
1
>&&>
(
this
->
base
::
row
(
y
));
}
template
<
class
T
,
int
N
>
...
...
pylene/include/mln/core/image/private/ndbuffer_image_impl.hpp
View file @
5e76699d
...
...
@@ -6,9 +6,6 @@ namespace mln::details
{
static
void
select
(
ndbuffer_image_info_t
*
ima
,
int
dim
,
const
int
begin_coords
[],
const
int
end_coords
[]);
static
std
::
size_t
get_sample_byte_size
(
const
ndbuffer_image_info_t
*
ima
);
template
<
class
T
,
int
pdim
>
static
__ndbuffer_image
<
T
,
pdim
>*
cast
(
ndbuffer_image_info_t
*
ima
);
};
template
<
class
T
>
...
...
@@ -58,12 +55,6 @@ namespace mln::details
/**** Implementation ****/
/******************************************/
template
<
class
T
,
int
pdim
>
__ndbuffer_image
<
T
,
pdim
>*
ndbuffer_image_impl_base_0
::
cast
(
ndbuffer_image_info_t
*
ima
)
{
return
reinterpret_cast
<
__ndbuffer_image
<
T
,
pdim
>*>
(
ima
);
}
template
<
int
pdim
>
constexpr
int
ndbuffer_image_impl_base_2
<
pdim
>::
get_pdim
(
const
ndbuffer_image_info_t
*
)
{
...
...
pylene/include/mln/core/neighborhood/c26.hpp
View file @
5e76699d
...
...
@@ -25,6 +25,21 @@ namespace mln
static
constexpr
int
radial_extent
()
{
return
1
;
}
/// \brief Return the input ROI for 3D box.
mln
::
box3d
compute_input_region
(
mln
::
box3d
roi
)
const
{
roi
.
inflate
(
1
);
return
roi
;
}
/// \brief Return the output ROI for 3D box.
mln
::
box3d
compute_output_region
(
mln
::
box3d
roi
)
const
{
roi
.
inflate
(
-
1
);
return
roi
;
}
private:
static
inline
constexpr
std
::
array
<
point_t
,
26
>
m_offsets
=
{{
// clang-format off
...
...
pylene/include/mln/core/neighborhood/c6.hpp
View file @
5e76699d
...
...
@@ -25,9 +25,26 @@ namespace mln
static
constexpr
int
radial_extent
()
{
return
1
;
}
/// \brief Return the input ROI for 3D box.
mln
::
box3d
compute_input_region
(
mln
::
box3d
roi
)
const
{
roi
.
inflate
(
1
);
return
roi
;
}
/// \brief Return the output ROI for 3D box.
mln
::
box3d
compute_output_region
(
mln
::
box3d
roi
)
const
{
roi
.
inflate
(
-
1
);
return
roi
;
}
private:
static
inline
constexpr
std
::
array
<
point_t
,
6
>
m_offsets
=
{
{{
+
0
,
+
0
,
-
1
},
{
+
0
,
-
1
,
+
0
},
{
-
1
,
+
0
,
+
0
},
{
+
1
,
+
0
,
+
0
},
{
+
0
,
+
1
,
+
0
},
{
+
0
,
+
0
,
+
1
}}};
};
...
...
tests/core/image/ndbuffer_image.cpp
View file @
5e76699d
...
...
@@ -808,6 +808,65 @@ TEST(ndbuffer_image, clip_invalid_roi)
EXPECT_THROW
(
img
.
clip
(
roi
),
std
::
runtime_error
);
}
/********************************************************************/
/**** Test Slicing ****/
/********************************************************************/
TEST
(
ndbuffer_image
,
slice2d
)
{
mln
::
image_build_params
params
;
params
.
border
=
0
;
{
mln
::
ndbuffer_image
img
(
kSampleType
,
kWidth
,
kHeight
,
params
);
iota
(
img
);
auto
f
=
img
.
row
(
1
);
EXPECT_EQ
(
f
.
width
(),
kWidth
);
EXPECT_EQ
(
f
.
pdim
(),
1
);
EXPECT_EQ
(
*
static_cast
<
const
uint32_t
*>
(
f
({
0
})),
kWidth
);
}
{
mln
::
image2d
<
uint32_t
>
img
(
kWidth
,
kHeight
,
params
);
iota
(
img
);
mln
::
image1d
<
uint32_t
>
f
=
img
.
row
(
1
);
EXPECT_EQ
(
f
.
width
(),
kWidth
);
EXPECT_EQ
(
f
.
pdim
(),
1
);
EXPECT_EQ
(
f
({
0
}),
kWidth
);
}
}
TEST
(
ndbuffer_image
,
slice3d
)
{
mln
::
image_build_params
params
;
params
.
border
=
0
;
{
mln
::
ndbuffer_image
img
(
kSampleType
,
kWidth
,
kHeight
,
kDepth
,
params
);
iota
(
img
);
auto
f
=
img
.
slice
(
1
);
EXPECT_EQ
(
f
.
width
(),
kWidth
);
EXPECT_EQ
(
f
.
height
(),
kHeight
);
EXPECT_EQ
(
f
.
pdim
(),
2
);
EXPECT_EQ
(
*
static_cast
<
const
uint32_t
*>
(
f
({
0
,
0
})),
kWidth
*
kHeight
);
}
{
mln
::
image3d
<
uint32_t
>
img
(
kWidth
,
kHeight
,
kDepth
,
params
);
iota
(
img
);
mln
::
image2d
<
uint32_t
>
f
=
img
.
slice
(
1
);
EXPECT_EQ
(
f
.
width
(),
kWidth
);
EXPECT_EQ
(
f
.
height
(),
kHeight
);
EXPECT_EQ
(
f
.
pdim
(),
2
);
EXPECT_EQ
(
f
({
0
,
0
}),
kWidth
*
kHeight
);
}
}
/********************************************************************/
/**** Test Border Size Computation ****/
/********************************************************************/
...
...
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