Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
otb
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
212
Issues
212
List
Boards
Labels
Milestones
Merge Requests
10
Merge Requests
10
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main Repositories
otb
Commits
c4be05b9
Commit
c4be05b9
authored
Apr 15, 2019
by
Julien Michel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TEST: Fix failing tests and fix band index convention (always start at 1)
parent
9da9922e
Pipeline
#1022
failed with stages
in 65 minutes and 41 seconds
Changes
7
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
20 deletions
+28
-20
Data/Baseline/Examples/Radiometry/ARVIMultiChannelRAndBAndNIRVegetationIndex.tif
...Radiometry/ARVIMultiChannelRAndBAndNIRVegetationIndex.tif
+2
-2
Examples/Radiometry/ARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx
...ARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx
+1
-1
Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx
...les/Applications/AppIndices/app/otbRadiometricIndices.cxx
+10
-1
Modules/Radiometry/Indices/include/otbNDVIDataNodeFeatureFunction.h
...diometry/Indices/include/otbNDVIDataNodeFeatureFunction.h
+4
-4
Modules/Radiometry/Indices/include/otbRadiometricIndice.h
Modules/Radiometry/Indices/include/otbRadiometricIndice.h
+4
-4
Modules/Radiometry/Indices/include/otbVegetationIndicesFunctor.h
.../Radiometry/Indices/include/otbVegetationIndicesFunctor.h
+1
-2
Modules/Radiometry/Indices/test/otbRadiometricIndicesTest.cxx
...les/Radiometry/Indices/test/otbRadiometricIndicesTest.cxx
+6
-6
No files found.
Data/Baseline/Examples/Radiometry/ARVIMultiChannelRAndBAndNIRVegetationIndex.tif
LFS
View file @
c4be05b9
No preview for this file type
Examples/Radiometry/ARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx
View file @
c4be05b9
...
...
@@ -134,7 +134,7 @@ int main(int argc, char* argv[])
// The three used index bands (red, blue and NIR) are declared.
filter
->
GetFunctor
().
SetBandIndex
(
CommonBandNames
::
RED
,
::
atoi
(
argv
[
5
]));
filter
->
GetFunctor
().
SetBandIndex
(
CommonBandNames
::
GREEN
,
::
atoi
(
argv
[
6
]));
filter
->
GetFunctor
().
SetBandIndex
(
CommonBandNames
::
BLUE
,
::
atoi
(
argv
[
6
]));
filter
->
GetFunctor
().
SetBandIndex
(
CommonBandNames
::
NIR
,
::
atoi
(
argv
[
7
]));
// The filter input is linked to the reader output and
...
...
Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx
View file @
c4be05b9
...
...
@@ -94,18 +94,27 @@ private:
AddParameter
(
ParameterType_Int
,
"channels.blue"
,
"Blue Channel"
);
SetParameterDescription
(
"channels.blue"
,
"Blue channel index"
);
SetDefaultParameterInt
(
"channels.blue"
,
1
);
SetMinimumParameterIntValue
(
"channels.blue"
,
1
);
AddParameter
(
ParameterType_Int
,
"channels.green"
,
"Green Channel"
);
SetParameterDescription
(
"channels.green"
,
"Green channel index"
);
SetDefaultParameterInt
(
"channels.green"
,
1
);
SetMinimumParameterIntValue
(
"channels.green"
,
1
);
AddParameter
(
ParameterType_Int
,
"channels.red"
,
"Red Channel"
);
SetParameterDescription
(
"channels.red"
,
"Red channel index"
);
SetDefaultParameterInt
(
"channels.red"
,
1
);
SetMinimumParameterIntValue
(
"channels.red"
,
1
);
AddParameter
(
ParameterType_Int
,
"channels.nir"
,
"NIR Channel"
);
SetParameterDescription
(
"channels.nir"
,
"NIR channel index"
);
SetDefaultParameterInt
(
"channels.nir"
,
1
);
SetMinimumParameterIntValue
(
"channels.nir"
,
1
);
AddParameter
(
ParameterType_Int
,
"channels.mir"
,
"Mir Channel"
);
SetParameterDescription
(
"channels.mir"
,
"Mir channel index"
);
SetDefaultParameterInt
(
"channels.mir"
,
1
);
SetMinimumParameterIntValue
(
"channels.mir"
,
1
);
AddParameter
(
ParameterType_ListView
,
"list"
,
"Available Radiometric Indices"
);
SetParameterDescription
(
"list"
,
...
...
@@ -212,7 +221,7 @@ private:
}
else
{
indicesMap
[
band
]
=
idx
-
1
;
indicesMap
[
band
]
=
idx
;
}
}
};
...
...
Modules/Radiometry/Indices/include/otbNDVIDataNodeFeatureFunction.h
View file @
c4be05b9
...
...
@@ -97,22 +97,22 @@ public:
//TODO replace by metadata parsing
unsigned
int
GetREDChannelIndex
()
const
{
return
m_NDVIFunctor
.
GetBandIndex
(
CommonBandNames
::
RED
)
+
1
;
return
m_NDVIFunctor
.
GetBandIndex
(
CommonBandNames
::
RED
);
}
void
SetREDChannelIndex
(
unsigned
int
id
)
{
m_NDVIFunctor
.
SetBandIndex
(
CommonBandNames
::
RED
,
id
-
1
);
m_NDVIFunctor
.
SetBandIndex
(
CommonBandNames
::
RED
,
id
);
}
unsigned
int
GetNIRChannelIndex
()
const
{
return
m_NDVIFunctor
.
GetBandIndex
(
CommonBandNames
::
NIR
)
+
1
;
return
m_NDVIFunctor
.
GetBandIndex
(
CommonBandNames
::
NIR
);
}
void
SetNIRChannelIndex
(
unsigned
int
id
)
{
m_NDVIFunctor
.
SetBandIndex
(
CommonBandNames
::
NIR
,
id
-
1
);
m_NDVIFunctor
.
SetBandIndex
(
CommonBandNames
::
NIR
,
id
);
}
protected:
...
...
Modules/Radiometry/Indices/include/otbRadiometricIndice.h
View file @
c4be05b9
...
...
@@ -117,7 +117,7 @@ public:
/**
* \param band The band to set (value in TBandNameEnum)
* \param index The index of the band to set
* \param index The index of the band to set
(starts at 1 for first band)
* \throw runtime_error if band is TBandNameEnum::MAX
*/
void
SetBandIndex
(
const
BandNameType
&
band
,
const
size_t
&
index
)
...
...
@@ -131,7 +131,7 @@ public:
/**
* \param indicesMap a std::map<TBandNameEnum,size_t> containing all
* bands indices to set
* bands indices to set
(starts at 1 for first band)
* \throw runtime_error if indicesMap contains TBandNameEnum::MAX
*/
void
SetBandsIndices
(
const
std
::
map
<
BandNameType
,
size_t
>
&
indicesMap
)
...
...
@@ -160,7 +160,7 @@ public:
* Astract method which will compute the radiometric indice
* \param input A itk::VariableLengthVector<TInput> holding the
* pixel values for each band
* \return The indice value as TOutput
* \return The indice value as TOutput
(starts at 1 for first band)
*/
virtual
TOutput
operator
()(
const
itk
::
VariableLengthVector
<
TInput
>
&
input
)
const
=
0
;
...
...
@@ -201,7 +201,7 @@ protected:
double
Value
(
const
BandNameType
&
band
,
const
itk
::
VariableLengthVector
<
TInput
>
&
input
)
const
{
assert
(
m_RequiredBands
[
band
]
&&
"Retrieving value for a band that is not in the required bands list"
);
return
static_cast
<
double
>
(
input
[
UncheckedBandIndex
(
band
)]);
return
static_cast
<
double
>
(
input
[
UncheckedBandIndex
(
band
)
-
1
]);
}
private:
...
...
Modules/Radiometry/Indices/include/otbVegetationIndicesFunctor.h
View file @
c4be05b9
...
...
@@ -737,8 +737,7 @@ public:
{
return
static_cast
<
TOutput
>
(
0.
);
}
return
static_cast
<
TOutput
>
(
A
*
((
std
::
exp
((
nir
-
red
)
/
((
red
+
nir
)
*
B
))
-
std
::
exp
(
C
*
B
))));
return
static_cast
<
TOutput
>
(
A
*
(
std
::
exp
((
nir
-
red
)
/
(
red
+
nir
)
*
B
)
-
std
::
exp
(
C
*
B
)));
}
static
constexpr
double
A
=
0.1519
;
...
...
Modules/Radiometry/Indices/test/otbRadiometricIndicesTest.cxx
View file @
c4be05b9
...
...
@@ -68,7 +68,7 @@ using namespace otb::Functor;
int
otbVegetationIndicesTest
(
int
,
char
**
)
{
const
std
::
map
<
CommonBandNames
,
size_t
>
bandMap
=
{{
CommonBandNames
::
BLUE
,
0
},{
CommonBandNames
::
GREEN
,
1
},{
CommonBandNames
::
RED
,
2
},{
CommonBandNames
::
NIR
,
3
}};
const
std
::
map
<
CommonBandNames
,
size_t
>
bandMap
=
{{
CommonBandNames
::
BLUE
,
1
},{
CommonBandNames
::
GREEN
,
2
},{
CommonBandNames
::
RED
,
3
},{
CommonBandNames
::
NIR
,
4
}};
// Syntax: CheckResult<Indice Class>("test_name",bandMap,{red_value,nir_value},expected_result)
bool
res
=
CheckResult
<
NDVI
<
int
,
double
>
>
(
"ndvi_null "
,
bandMap
,{
0
,
0
,
0
,
0
},
0.
);
...
...
@@ -90,7 +90,7 @@ int otbVegetationIndicesTest(int, char**)
res
=
res
&
CheckResult
<
IPVI
<
int
,
double
>
>
(
"ipvi_pixel"
,
bandMap
,{
0
,
0
,
1
,
2
},
0.6666666667
);
res
=
res
&
CheckResult
<
LAIFromNDVILogarithmic
<
int
,
double
>
>
(
"lailog_pixel"
,
bandMap
,{
0
,
0
,
1
,
2
},
0.4930511672
);
res
=
res
&
CheckResult
<
LAIFromReflectancesLinear
<
int
,
double
>
>
(
"lailog_pixel"
,
bandMap
,{
0
,
0
,
1
,
2
},
6.61
);
res
=
res
&
CheckResult
<
LAIFromNDVIFormosat2Functor
<
int
,
double
>
>
(
"laifrom_pixel"
,
bandMap
,{
0
,
0
,
1
,
2
},
-
0.08836147592
);
res
=
res
&
CheckResult
<
LAIFromNDVIFormosat2Functor
<
int
,
double
>
>
(
"laifrom_pixel"
,
bandMap
,{
0
,
0
,
1
,
2
},
0.3120010659
);
if
(
res
)
{
...
...
@@ -104,7 +104,7 @@ int otbVegetationIndicesTest(int, char**)
int
otbWaterIndicesTest
(
int
,
char
**
)
{
const
std
::
map
<
CommonBandNames
,
size_t
>
bandMap
=
{{
CommonBandNames
::
BLUE
,
0
},{
CommonBandNames
::
GREEN
,
1
},{
CommonBandNames
::
RED
,
2
},{
CommonBandNames
::
NIR
,
3
},
{
CommonBandNames
::
MIR
,
4
}};
const
std
::
map
<
CommonBandNames
,
size_t
>
bandMap
=
{{
CommonBandNames
::
BLUE
,
1
},{
CommonBandNames
::
GREEN
,
2
},{
CommonBandNames
::
RED
,
3
},{
CommonBandNames
::
NIR
,
4
},
{
CommonBandNames
::
MIR
,
5
}};
// Syntax: CheckResult<Indice Class>("test_name",bandMap,{red_value,nir_value},expected_result)
bool
res
=
CheckResult
<
NDWI
<
int
,
double
>
>
(
"ndwi_null "
,
bandMap
,{
0
,
0
,
0
,
0
,
0
},
0.
);
...
...
@@ -128,7 +128,7 @@ int otbWaterIndicesTest(int, char**)
int
otbSoilIndicesTest
(
int
,
char
**
)
{
const
std
::
map
<
CommonBandNames
,
size_t
>
bandMap
=
{{
CommonBandNames
::
BLUE
,
0
},{
CommonBandNames
::
GREEN
,
1
},{
CommonBandNames
::
RED
,
2
},{
CommonBandNames
::
NIR
,
3
},
{
CommonBandNames
::
MIR
,
4
}};
const
std
::
map
<
CommonBandNames
,
size_t
>
bandMap
=
{{
CommonBandNames
::
BLUE
,
1
},{
CommonBandNames
::
GREEN
,
2
},{
CommonBandNames
::
RED
,
3
},{
CommonBandNames
::
NIR
,
4
},
{
CommonBandNames
::
MIR
,
5
}};
// Syntax: CheckResult<Indice Class>("test_name",bandMap,{red_value,nir_value},expected_result)
bool
res
=
CheckResult
<
CI
<
int
,
double
>
>
(
"ci_null "
,
bandMap
,{
0
,
0
,
0
,
0
,
0
},
0.
);
...
...
@@ -148,7 +148,7 @@ int otbSoilIndicesTest(int, char**)
int
otbBuiltUpIndicesTest
(
int
,
char
**
)
{
const
std
::
map
<
CommonBandNames
,
size_t
>
bandMap
=
{{
CommonBandNames
::
BLUE
,
0
},{
CommonBandNames
::
GREEN
,
1
},{
CommonBandNames
::
RED
,
2
},{
CommonBandNames
::
NIR
,
3
},
{
CommonBandNames
::
MIR
,
4
}};
const
std
::
map
<
CommonBandNames
,
size_t
>
bandMap
=
{{
CommonBandNames
::
BLUE
,
1
},{
CommonBandNames
::
GREEN
,
2
},{
CommonBandNames
::
RED
,
3
},{
CommonBandNames
::
NIR
,
4
},
{
CommonBandNames
::
MIR
,
5
}};
// Syntax: CheckResult<Indice Class>("test_name",bandMap,{red_value,nir_value},expected_result)
bool
res
=
CheckResult
<
ISU
<
int
,
double
>
>
(
"isu_null"
,
bandMap
,{
0
,
0
,
0
,
0
,
0
},
0.
);
...
...
@@ -237,7 +237,7 @@ int otbIndicesStackFunctorTest(int, char**)
success
=
false
;
}
const
std
::
map
<
CommonBandNames
,
size_t
>
bandMap
=
{{
CommonBandNames
::
BLUE
,
0
},{
CommonBandNames
::
GREEN
,
1
},{
CommonBandNames
::
RED
,
2
},{
CommonBandNames
::
NIR
,
3
},
{
CommonBandNames
::
MIR
,
4
}};
const
std
::
map
<
CommonBandNames
,
size_t
>
bandMap
=
{{
CommonBandNames
::
BLUE
,
1
},{
CommonBandNames
::
GREEN
,
2
},{
CommonBandNames
::
RED
,
3
},{
CommonBandNames
::
NIR
,
4
},
{
CommonBandNames
::
MIR
,
5
}};
ndvi
.
SetBandsIndices
(
bandMap
);
ndwi
.
SetBandsIndices
(
bandMap
);
...
...
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