Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
WASP
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
Container Registry
Model registry
Operate
Environments
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
Remote Modules
WASP
Commits
56f28bec
Commit
56f28bec
authored
5 years ago
by
Guillaume Pasero
Browse files
Options
Downloads
Patches
Plain Diff
ADD: splitter filter to handle properly no-data flags
parent
55041c80
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1
Resolve "Venus no-data values"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Common/include/VectorImageSplitter.h
+109
-0
109 additions, 0 deletions
Common/include/VectorImageSplitter.h
ProductFormatter/include/ProductCreatorAdapter.h
+3
-3
3 additions, 3 deletions
ProductFormatter/include/ProductCreatorAdapter.h
with
112 additions
and
3 deletions
Common/include/VectorImageSplitter.h
0 → 100644
+
109
−
0
View file @
56f28bec
/*
* Copyright (C) 2018-2019, Centre National d'Etudes Spatiales (CNES)
* All rights reserved
*
* This file is part of Weighted Average Synthesis Processor (WASP)
*
* Authors:
* - Guillaume PASERO <guillaume.pasero@c-s.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* See the LICENSE.md file for more details.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef VECTOR_IMAGE_SPLITTER_H
#define VECTOR_IMAGE_SPLITTER_H
#include
"otbVectorImageToImageListFilter.h"
namespace
ts
{
/** \class VectorImageSplitter
* \brief This class aims at converting a multi-band image to a list of scalar images.
*
* This class take a VectorImage and converts it to an ImageList.
*
* It also handles properly the no-data flags if present.
*/
template
<
class
TVectorImageType
,
class
TImageList
>
class
ITK_EXPORT
VectorImageSplitter
:
public
otb
::
VectorImageToImageListFilter
<
TVectorImageType
,
TImageList
>
{
public:
/** Standard typedefs */
typedef
VectorImageSplitter
Self
;
typedef
otb
::
VectorImageToImageListFilter
<
TVectorImageType
,
TImageList
>
Superclass
;
typedef
itk
::
SmartPointer
<
Self
>
Pointer
;
typedef
itk
::
SmartPointer
<
const
Self
>
ConstPointer
;
/** Type macro */
itkNewMacro
(
Self
);
/** Creation through object factory macro */
itkTypeMacro
(
VectorImageSplitter
,
VectorImageToImageListFilter
);
/** Template parameters typedefs */
typedef
TVectorImageType
InputVectorImageType
;
typedef
typename
InputVectorImageType
::
Pointer
InputVectorImagePointerType
;
typedef
TImageList
OutputImageListType
;
typedef
typename
OutputImageListType
::
Pointer
OutputImageListPointerType
;
/** Generate the output information by building the output list. */
void
GenerateOutputInformation
(
void
)
override
{
Superclass
::
GenerateOutputInformation
();
OutputImageListPointerType
outputPtr
=
this
->
GetOutput
();
InputVectorImagePointerType
inputPtr
=
this
->
GetInput
();
if
(
inputPtr
)
{
std
::
vector
<
bool
>
noDataValueAvailable
;
bool
ret
=
itk
::
ExposeMetaData
<
std
::
vector
<
bool
>
>
(
inputPtr
->
GetMetaDataDictionary
(),
otb
::
MetaDataKey
::
NoDataValueAvailable
,
noDataValueAvailable
);
std
::
vector
<
double
>
noDataValues
;
itk
::
ExposeMetaData
<
std
::
vector
<
double
>
>
(
inputPtr
->
GetMetaDataDictionary
(),
otb
::
MetaDataKey
::
NoDataValue
,
noDataValues
);
if
(
ret
&&
noDataValueAvailable
.
size
()
>=
inputPtr
->
GetNumberOfComponentsPerPixel
())
{
// Dispatch the no-data values in each image of the list
std
::
vector
<
bool
>
noDataFlagOut
(
1
);
std
::
vector
<
double
>
noDataValueOut
(
1
);
for
(
unsigned
int
i
=
0
;
i
<
inputPtr
->
GetNumberOfComponentsPerPixel
()
;
++
i
)
{
itk
::
MetaDataDictionary
&
dict
=
outputPtr
->
GetNthElement
(
i
)
->
GetMetaDataDictionary
();
noDataFlagOut
[
0
]
=
noDataValueAvailable
[
i
];
noDataValueOut
[
0
]
=
noDataValues
[
i
];
itk
::
EncapsulateMetaData
<
std
::
vector
<
bool
>
>
(
dict
,
otb
::
MetaDataKey
::
NoDataValueAvailable
,
noDataFlagOut
);
itk
::
EncapsulateMetaData
<
std
::
vector
<
double
>
>
(
dict
,
otb
::
MetaDataKey
::
NoDataValue
,
noDataValueOut
);
}
}
}
}
protected
:
/** Constructor */
VectorImageSplitter
()
{};
/** Destructor */
~
VectorImageSplitter
()
override
{}
private
:
VectorImageSplitter
(
const
Self
&
)
=
delete
;
void
operator
=
(
const
Self
&
)
=
delete
;
};
}
// End namespace ts
#endif
This diff is collapsed.
Click to expand it.
ProductFormatter/include/ProductCreatorAdapter.h
+
3
−
3
View file @
56f28bec
...
...
@@ -33,7 +33,7 @@
#include
"MuscateMetadataWriter.hpp"
#include
"ProductDefinitions.h"
#include
"BaseImageTypes.h"
#include
"
otb
VectorImage
ToImageListFil
ter.h"
#include
"VectorImage
Split
ter.h"
#include
"itkLightObject.h"
/**
...
...
@@ -90,8 +90,8 @@ public:
protected
:
typedef
muscate
::
MuscateMetadataReader
MuscateMetadataReaderType
;
typedef
muscate
::
MuscateMetadataWriter
MuscateMetadataWriterType
;
typedef
otb
::
VectorImage
ToImageListFil
ter
<
ShortVectorImageType
,
ByteImageListType
>
ExtractMaskType
;
typedef
otb
::
VectorImage
ToImageListFil
ter
<
ShortVectorImageType
,
ShortImageListType
>
ExtractRasterType
;
typedef
ts
::
VectorImage
Split
ter
<
ShortVectorImageType
,
ByteImageListType
>
ExtractMaskType
;
typedef
ts
::
VectorImage
Split
ter
<
ShortVectorImageType
,
ShortImageListType
>
ExtractRasterType
;
/**
* @brief Read all metadata files and FillMetadataInfo for each file. Also determines the GeoInfo to be used
...
...
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