Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Main Repositories
otb
Commits
603e3fc1
Commit
603e3fc1
authored
Jan 09, 2020
by
Guillaume Pasero
Browse files
BUG:
#1989
: keep initial interface for ReadInputListSample
parent
d1a9186e
Pipeline
#3308
passed with stages
in 76 minutes and 32 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Modules/Applications/AppClassification/include/otbVectorPrediction.h
View file @
603e3fc1
...
...
@@ -98,8 +98,8 @@ private:
/** Method returning whether the confidence map should be computed, depending on the regression mode and input parameters */
bool
shouldComputeConfidenceMap
()
const
;
/** Method returning the input list sample from the input
DataSource
*/
typename
ListSampleType
::
Pointer
ReadInputListSample
(
o
gr
::
DataSource
::
Pointer
source
);
/** Method returning the input list sample from the input
layer
*/
typename
ListSampleType
::
Pointer
ReadInputListSample
(
o
tb
::
ogr
::
Layer
const
&
layer
);
/** Normalize a list sample using the statistic file given */
typename
ListSampleType
::
Pointer
NormalizeListSample
(
ListSampleType
::
Pointer
input
);
...
...
Modules/Applications/AppClassification/include/otbVectorPrediction.hxx
View file @
603e3fc1
...
...
@@ -72,24 +72,30 @@ void VectorPrediction<RegressionMode>::DoUpdateParameters()
}
}
template
<
bool
RegressionMode
>
typename
VectorPrediction
<
RegressionMode
>::
ListSampleType
::
Pointer
VectorPrediction
<
RegressionMode
>::
ReadInputListSample
(
ogr
::
DataSource
::
Pointer
source
)
template
<
bool
RegressionMode
>
typename
VectorPrediction
<
RegressionMode
>::
ListSampleType
::
Pointer
VectorPrediction
<
RegressionMode
>
::
ReadInputListSample
(
otb
::
ogr
::
Layer
const
&
layer
)
{
auto
layer
=
source
->
GetLayer
(
0
);
typename
ListSampleType
::
Pointer
input
=
ListSampleType
::
New
();
const
auto
nbFeatures
=
GetSelectedItems
(
"feat"
).
size
();
input
->
SetMeasurementVectorSize
(
nbFeatures
);
ogr
::
Feature
feature
=
layer
.
ogr
().
GetNextFeature
();
std
::
vector
<
int
>
featureFieldIndex
(
nbFeatures
,
-
1
);
ogr
::
Layer
::
const_iterator
it_feat
=
layer
.
cbegin
();
for
(
unsigned
int
i
=
0
;
i
<
nbFeatures
;
i
++
)
{
featureFieldIndex
[
i
]
=
feature
.
ogr
().
GetFieldIndex
(
GetChoiceNames
(
"feat"
)[
GetSelectedItems
(
"feat"
)[
i
]].
c_str
());
if
(
featureFieldIndex
[
i
]
<
0
)
otbAppLogFATAL
(
"The field name for feature "
<<
GetChoiceNames
(
"feat"
)[
GetSelectedItems
(
"feat"
)[
i
]].
c_str
()
<<
" has not been found"
<<
std
::
endl
);
try
{
featureFieldIndex
[
i
]
=
(
*
it_feat
).
GetFieldIndex
(
GetChoiceNames
(
"feat"
)[
GetSelectedItems
(
"feat"
)[
i
]]);
}
catch
(...)
{
otbAppLogFATAL
(
"The field name for feature "
<<
GetChoiceNames
(
"feat"
)[
GetSelectedItems
(
"feat"
)[
i
]]
<<
" has not been found"
<<
std
::
endl
);
}
}
layer
.
ogr
().
ResetReading
();
for
(
auto
const
&
feature
:
layer
)
{
MeasurementType
mv
(
nbFeatures
);
...
...
@@ -289,7 +295,7 @@ void VectorPrediction<RegressionMode>::DoExecute()
ogr
::
DataSource
::
Pointer
source
=
ogr
::
DataSource
::
New
(
shapefileName
,
ogr
::
DataSource
::
Modes
::
Read
);
auto
layer
=
source
->
GetLayer
(
0
);
auto
input
=
ReadInputListSample
(
source
);
auto
input
=
ReadInputListSample
(
layer
);
ListSampleType
::
Pointer
listSample
=
NormalizeListSample
(
input
);
typename
LabelListSampleType
::
Pointer
target
;
...
...
Write
Preview
Supports
Markdown
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