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
d5264ea5
Commit
d5264ea5
authored
10 years ago
by
Christophe Palmann
Browse files
Options
Downloads
Patches
Plain Diff
WIP : otbBandMathX --> multioutputs
parent
86382f4f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/BasicFilters/otbBandMathImageFilterX.h
+8
-6
8 additions, 6 deletions
Code/BasicFilters/otbBandMathImageFilterX.h
Code/BasicFilters/otbBandMathImageFilterX.txx
+44
-27
44 additions, 27 deletions
Code/BasicFilters/otbBandMathImageFilterX.txx
with
52 additions
and
33 deletions
Code/BasicFilters/otbBandMathImageFilterX.h
+
8
−
6
View file @
d5264ea5
...
...
@@ -134,11 +134,6 @@ protected :
void
AfterThreadedGenerateData
();
private
:
BandMathImageFilterX
(
const
Self
&
);
//purposely not implemented
void
operator
=
(
const
Self
&
);
//purposely not implemented
void
generateVariables
();
typedef
struct
{
std
::
string
name
;
...
...
@@ -153,7 +148,14 @@ private :
int
info
[
5
];
}
adhocStruct2
;
std
::
string
m_Expression
;
BandMathImageFilterX
(
const
Self
&
);
//purposely not implemented
void
operator
=
(
const
Self
&
);
//purposely not implemented
void
addVariable
(
adhocStruct
&
);
void
generateVariables
();
std
::
vector
<
std
::
string
>
m_Expression
;
std
::
vector
<
ParserType
::
Pointer
>
m_VParser
;
std
::
vector
<
std
::
vector
<
adhocStruct2
>
>
m_AImage
;
std
::
vector
<
adhocStruct
>
m_VVarName
;
...
...
This diff is collapsed.
Click to expand it.
Code/BasicFilters/otbBandMathImageFilterX.txx
+
44
−
27
View file @
d5264ea5
...
...
@@ -79,7 +79,7 @@ void BandMathImageFilterX<TImage>
{
Superclass::PrintSelf(os, indent);
os << indent << "Expression: " << m_Expression << std::endl;
os << indent << "Expression: " << m_Expression
[0]
<< std::endl;
os << indent << "Computed values follow:" << std::endl;
os << indent << "UnderflowCount: " << m_UnderflowCount << std::endl;
os << indent << "OverflowCount: " << m_OverflowCount << std::endl;
...
...
@@ -182,8 +182,8 @@ template< typename TImage >
void BandMathImageFilterX<TImage>
::SetExpression(const std::string& expression)
{
if (m_Expression != expression)
m_Expression
=
expression;
//
if (m_Expression != expression)
m_Expression
.push_back(
expression
)
;
this->Modified();
}
...
...
@@ -191,7 +191,7 @@ template< typename TImage >
std::string BandMathImageFilterX<TImage>
::GetExpression() const
{
return m_Expression;
return m_Expression
[0]
;
}
template< typename TImage >
...
...
@@ -202,6 +202,20 @@ std::string BandMathImageFilterX<TImage>
}
template< typename TImage >
void BandMathImageFilterX<TImage>
::addVariable(adhocStruct &ahc)
{
bool found=false;
for(int i=0; i<m_VVarName.size(); ++i)
if (m_VVarName[i].name == ahc.name)
found=true;
if (!found)
m_VVarName.push_back(ahc);
}
template< typename TImage >
void BandMathImageFilterX<TImage>
::generateVariables()
...
...
@@ -210,32 +224,35 @@ void BandMathImageFilterX<TImage>
m_VVarName.clear();
m_VNotAllowedVarName.clear();
ParserType::Pointer dummyParser = ParserType::New();
dummyParser->SetExpr(this->GetExpression());
mup::var_maptype vmap = dummyParser->GetExprVar();
for (mup::var_maptype::iterator item = vmap.begin(); item!=vmap.end(); ++item)
for(int IDExpression=0; IDExpression<m_Expression.size(); ++IDExpression)
{
bool OK=false; int i=0;
while( ( !OK ) && (i<m_VAllowedVarName.size()) )
{
if (item->first == m_VAllowedVarName[i].name)
OK=true;
else
i++;
}
if (OK) {m_VVarName.push_back(m_VAllowedVarName[i]);}
else {
adhocStruct ahc;
ahc.name = item->first;
m_VNotAllowedVarName.push_back(ahc);
}
ParserType::Pointer dummyParser = ParserType::New();
dummyParser->SetExpr(this->GetExpression());
mup::var_maptype vmap = dummyParser->GetExprVar();
for (mup::var_maptype::iterator item = vmap.begin(); item!=vmap.end(); ++item)
{
bool OK=false; int i=0;
while( ( !OK ) && (i<m_VAllowedVarName.size()) )
{
if (item->first == m_VAllowedVarName[i].name)
OK=true;
else
i++;
}
if (OK) {addVariable(m_VAllowedVarName[i]);} //<<<<<<------------
else {
adhocStruct ahc;
ahc.name = item->first;
m_VNotAllowedVarName.push_back(ahc);
}
}
}
for(int y=0; y<m_VVarName.size(); y++)
std::cout << "--> " << m_VVarName[y].name << " " << m_VVarName[y].type << std::endl;
/*
for(int y=0; y<m_VVarName.size(); y++)
std::cout << "--> " << m_VVarName[y].name << " " << m_VVarName[y].type << std::endl;
*/
if (m_VNotAllowedVarName.size()>0)
{
...
...
@@ -299,7 +316,7 @@ void BandMathImageFilterX<TImage>
for(int i = 0; i < nbThreads; ++i)
{
m_AImage[i].resize(m_NbVar);
m_VParser[i]->SetExpr(m_Expression);
m_VParser[i]->SetExpr(m_Expression
[0]
);
for(int j=0; j < m_NbVar; ++j)
{
...
...
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