Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Main Repositories
otb
Commits
8771759a
Commit
8771759a
authored
Sep 21, 2018
by
Cédric Traizet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
STYLE : implementation iof methods in .hxx instead of .h
parent
8cab5ffd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
123 additions
and
61 deletions
+123
-61
Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.h
...onversion/include/otbLabelImageSmallRegionMergingFilter.h
+20
-60
Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.hxx
...version/include/otbLabelImageSmallRegionMergingFilter.hxx
+103
-1
No files found.
Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.h
View file @
8771759a
...
...
@@ -25,7 +25,6 @@
#include "otbPersistentFilterStreamingDecorator.h"
#include <unordered_map>
#include <unordered_set>
namespace
otb
{
...
...
@@ -80,7 +79,7 @@ public:
typedef
std
::
unordered_map
<
InputLabelType
,
RealVectorPixelType
>
LabelStatisticType
;
typedef
std
::
unordered_map
<
InputLabelType
,
double
>
typedef
std
::
unordered_map
<
InputLabelType
,
double
>
LabelPopulationType
;
typedef
std
::
unordered_map
<
InputLabelType
,
InputLabelType
>
LUTType
;
...
...
@@ -89,41 +88,20 @@ public:
itkSetMacro
(
Size
,
unsigned
int
);
/** Set the Label population and initialize the LUT */
void
SetLabelPopulation
(
LabelPopulationType
const
&
labelPopulation
)
{
m_LabelPopulation
=
labelPopulation
;
// Initialize m_CorrespondingMap to the identity (i.e. m[label] = label)
for
(
auto
label
:
m_LabelPopulation
)
{
m_LUT
[
label
.
first
]
=
label
.
first
;
}
}
void
SetLabelPopulation
(
LabelPopulationType
const
&
labelPopulation
);
/** Get the Label population */
LabelPopulationType
const
&
GetLabelPopulation
()
const
{
return
m_LabelPopulation
;
}
LabelPopulationType
const
&
GetLabelPopulation
()
const
;
/** Set the label statistic */
void
SetLabelStatistic
(
LabelStatisticType
const
&
labelStatistic
)
{
m_LabelStatistic
=
labelStatistic
;
}
void
SetLabelStatistic
(
LabelStatisticType
const
&
labelStatistic
);
/** Get the label statistic */
LabelStatisticType
const
&
GetLabelStatistic
()
const
{
return
m_LabelStatistic
;
}
LabelStatisticType
const
&
GetLabelStatistic
()
const
;
/** Get the LUT */
LUTType
const
&
GetLUT
()
const
{
return
m_LUT
;
}
LUTType
const
&
GetLUT
()
const
;
virtual
void
Reset
(
void
)
override
;
virtual
void
Synthetize
(
void
)
override
;
...
...
@@ -226,43 +204,25 @@ public:
itkSetMacro
(
MinSize
,
unsigned
int
);
/** Set the Label population map */
void
SetInputLabelImage
(
const
TInputLabelImage
*
labelImage
)
{
m_SmallRegionMergingFilter
->
GetFilter
()
->
SetInput
(
labelImage
);
}
void
SetInputLabelImage
(
const
TInputLabelImage
*
labelImage
);
/** Set the Label population map */
void
SetLabelPopulation
(
LabelPopulationType
const
&
labelPopulation
)
{
m_SmallRegionMergingFilter
->
GetFilter
()
->
SetLabelPopulation
(
labelPopulation
);
}
void
SetLabelPopulation
(
LabelPopulationType
const
&
labelPopulation
);
/** Get the Label population map */
LabelPopulationType
const
&
GetLabelPopulation
(
)
const
{
return
m_SmallRegionMergingFilter
->
GetFilter
()
->
GetLabelPopulation
();
}
LabelPopulationType
const
&
GetLabelPopulation
()
const
;
/** Set the Label statistic map */
void
SetLabelStatistic
(
LabelStatisticType
const
&
labelStatistic
)
{
m_SmallRegionMergingFilter
->
GetFilter
()
->
SetLabelStatistic
(
labelStatistic
);
}
void
SetLabelStatistic
(
LabelStatisticType
const
&
labelStatistic
);
/** Get the Label statistic map */
LabelStatisticType
const
&
GetLabelStatistic
()
const
{
return
m_SmallRegionMergingFilter
->
GetFilter
()
->
GetLabelStatistic
();
}
LabelStatisticType
const
&
GetLabelStatistic
()
const
;
/** Get the Label statistic map */
LUTType
const
&
GetLUT
(
)
const
{
return
m_SmallRegionMergingFilter
->
GetFilter
()
->
GetLUT
();
}
LUTType
const
&
GetLUT
()
const
;
void
Update
(
void
)
override
;
/** Call GenerateData() */
void
Update
()
override
;
protected:
/** Constructor */
...
...
Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.hxx
View file @
8771759a
...
...
@@ -34,6 +34,56 @@ PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage >
{
}
template
<
class
TInputLabelImage
>
void
PersistentLabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
SetLabelPopulation
(
LabelPopulationType
const
&
labelPopulation
)
{
m_LabelPopulation
=
labelPopulation
;
// Initialize m_CorrespondingMap to the identity (i.e. m[label] = label)
for
(
auto
label
:
m_LabelPopulation
)
{
m_LUT
[
label
.
first
]
=
label
.
first
;
}
}
template
<
class
TInputLabelImage
>
typename
PersistentLabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
LabelPopulationType
const
&
PersistentLabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
GetLabelPopulation
()
const
{
return
m_LabelPopulation
;
}
template
<
class
TInputLabelImage
>
void
PersistentLabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
SetLabelStatistic
(
LabelStatisticType
const
&
labelStatistic
)
{
m_LabelStatistic
=
labelStatistic
;
}
template
<
class
TInputLabelImage
>
typename
PersistentLabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
LabelStatisticType
const
&
PersistentLabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
GetLabelStatistic
()
const
{
return
m_LabelStatistic
;
}
template
<
class
TInputLabelImage
>
typename
PersistentLabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
LUTType
const
&
PersistentLabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
GetLUT
()
const
{
return
m_LUT
;
}
template
<
class
TInputLabelImage
>
void
PersistentLabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
...
...
@@ -248,10 +298,62 @@ LabelImageSmallRegionMergingFilter< TInputLabelImage >
m_SmallRegionMergingFilter
=
LabelImageSmallRegionMergingFilterType
::
New
();
}
template
<
class
TInputLabelImage
>
void
LabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
SetInputLabelImage
(
const
TInputLabelImage
*
labelImage
)
{
m_SmallRegionMergingFilter
->
GetFilter
()
->
SetInput
(
labelImage
);
}
template
<
class
TInputLabelImage
>
void
LabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
SetLabelPopulation
(
LabelPopulationType
const
&
labelPopulation
)
{
m_SmallRegionMergingFilter
->
GetFilter
()
->
SetLabelPopulation
(
labelPopulation
);
}
template
<
class
TInputLabelImage
>
typename
LabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
LabelPopulationType
const
&
LabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
GetLabelPopulation
()
const
{
return
m_SmallRegionMergingFilter
->
GetFilter
()
->
GetLabelPopulation
();
}
template
<
class
TInputLabelImage
>
void
LabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
SetLabelStatistic
(
LabelStatisticType
const
&
labelStatistic
)
{
m_SmallRegionMergingFilter
->
GetFilter
()
->
SetLabelStatistic
(
labelStatistic
);
}
template
<
class
TInputLabelImage
>
typename
LabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
LabelStatisticType
const
&
LabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
GetLabelStatistic
()
const
{
return
m_SmallRegionMergingFilter
->
GetFilter
()
->
GetLabelStatistic
();
}
template
<
class
TInputLabelImage
>
typename
LabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
LUTType
const
&
LabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
GetLUT
()
const
{
return
m_SmallRegionMergingFilter
->
GetFilter
()
->
GetLUT
();
}
template
<
class
TInputLabelImage
>
void
LabelImageSmallRegionMergingFilter
<
TInputLabelImage
>
::
Update
(
void
)
::
Update
()
{
this
->
GenerateData
();
}
...
...
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