Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Cabieces
otb
Commits
1e121101
Commit
1e121101
authored
9 years ago
by
Julien Michel
Browse files
Options
Downloads
Patches
Plain Diff
DOC: Adding filter documentation / ENH: use the NaNIsNoData flag
parent
85bbd176
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/Filtering/ImageManipulation/include/otbImageToNoDataMaskFilter.h
+42
-4
42 additions, 4 deletions
...ng/ImageManipulation/include/otbImageToNoDataMaskFilter.h
with
42 additions
and
4 deletions
Modules/Filtering/ImageManipulation/include/otbImageToNoDataMaskFilter.h
+
42
−
4
View file @
1e121101
...
...
@@ -27,6 +27,11 @@ namespace otb
{
namespace
Functor
{
/** \class NoDataFunctor
* \brief Functor used by ImageToNoDataMaskFilter
*
* See ImageToNoDataMaskFilter for complete documentation.
*/
template
<
typename
TInputPixel
,
typename
TOutputPixel
>
class
NoDataFunctor
{
...
...
@@ -35,25 +40,42 @@ public:
m_Flags
(),
m_Values
(),
m_OutsideValue
(
0
),
m_InsideValue
(
1
)
m_InsideValue
(
1
),
m_NaNIsNoData
(
false
)
{}
virtual
~
NoDataFunctor
(){}
inline
TOutputPixel
operator
()(
const
TInputPixel
&
in
)
const
{
return
otb
::
IsNoData
(
in
,
m_Flags
,
m_Values
)
?
m_OutsideValue
:
m_InsideValue
;
return
otb
::
IsNoData
(
in
,
m_Flags
,
m_Values
,
m_NaNIsNoData
)
?
m_OutsideValue
:
m_InsideValue
;
}
std
::
vector
<
bool
>
m_Flags
;
std
::
vector
<
double
>
m_Values
;
TOutputPixel
m_OutsideValue
;
TOutputPixel
m_InsideValue
;
bool
m_NaNIsNoData
;
};
}
// End namespace Functor
/** \class ImageToNoDataMaskFilter
* \brief Builds a no-data mask image from no-data flags and values
*
* This filter reads the no-data flags (a boolean vector indicating
* for each band if a no-data value exists) and values (the actual
* value to be used as no-data for each band) from
* MetaDataDictionary, and builds a binary mask indicating presence
* or absence of no-data for each pixel.
*
* If NaNIsNoData is true, NaN pixels will also be considered as
* no-data pixels.
*
* \ingroup Streamed
* \ingroup MultiThreaded
* \ingroup OTBImageManipulation
*/
template
<
typename
TInputImage
,
typename
TOutputImage
>
class
ImageToNoDataMaskFilter
:
public
itk
::
UnaryFunctorImageFilter
<
TInputImage
,
...
...
@@ -77,15 +99,31 @@ public:
/** Creation through object factory macro */
itkTypeMacro
(
SpectralAngleDistanceImageFilter
,
itk
::
ImageToImageFilter
);
/**
* Set inside value of output mask. This value will be used to
* indicate absence of no-data for the pixel in the output mask
*/
void
SetInsideValue
(
const
typename
TOutputImage
::
PixelType
&
value
)
{
this
->
GetFunctor
().
m_InsideValue
=
value
;
}
/**
* Set outside value of output mask. This value will be used to
* indicate presence of no-data for the pixel in the output mask
*/
void
SetOutsideValue
(
const
typename
TOutputImage
::
PixelType
&
value
)
{
this
->
GetFunctor
().
m_OutsideValue
=
value
;
}
/**
* Set the NaN is no data flags
* \param nanIsNoData If true, NaN values will be considered as
* no-data as well (default is false)
*/
void
SetNaNIsNoData
(
bool
nanIsNoData
)
{
this
->
GetFunctor
().
m_NaNIsNoData
=
nanIsNoData
;
}
protected
:
ImageToNoDataMaskFilter
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment