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
David Youssefi
otb
Commits
26bb134f
Commit
26bb134f
authored
13 years ago
by
Jonathan Guinet
Browse files
Options
Downloads
Patches
Plain Diff
STYLE: correct indent.
parent
b2fe9e5f
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
Applications/Classification/otbLabeledImageColorMapping.cxx
+35
-35
35 additions, 35 deletions
Applications/Classification/otbLabeledImageColorMapping.cxx
with
35 additions
and
35 deletions
Applications/Classification/otbLabeledImageColorMapping.cxx
+
35
−
35
View file @
26bb134f
...
...
@@ -35,9 +35,9 @@ class LabeledImageColorMapping: public Application
{
public:
/** Standard class typedefs. */
typedef
LabeledImageColorMapping
Self
;
typedef
Application
Superclass
;
typedef
itk
::
SmartPointer
<
Self
>
Pointer
;
typedef
LabeledImageColorMapping
Self
;
typedef
Application
Superclass
;
typedef
itk
::
SmartPointer
<
Self
>
Pointer
;
typedef
itk
::
SmartPointer
<
const
Self
>
ConstPointer
;
/** Standard macro */
...
...
@@ -88,48 +88,48 @@ private:
std
::
ifstream
ifs
;
ifs
.
open
(
GetParameterString
(
"ct"
).
c_str
());
ifs
.
open
(
GetParameterString
(
"ct"
).
c_str
());
if
(
!
ifs
)
{
itkExceptionMacro
(
"Can not read file "
<<
GetParameterString
(
"ct"
)
<<
std
::
endl
);
}
if
(
!
ifs
)
{
itkExceptionMacro
(
"Can not read file "
<<
GetParameterString
(
"ct"
)
<<
std
::
endl
);
}
otbAppLogINFO
(
"Parsing color map file "
<<
GetParameterString
(
"ct"
)
<<
"."
<<
std
::
endl
);
otbAppLogINFO
(
"Parsing color map file "
<<
GetParameterString
(
"ct"
)
<<
"."
<<
std
::
endl
);
while
(
!
ifs
.
eof
())
{
std
::
string
line
;
std
::
getline
(
ifs
,
line
);
while
(
!
ifs
.
eof
())
// Avoid commented lines or too short ones
if
(
!
line
.
empty
()
&&
line
[
0
]
!=
'#'
)
{
std
::
string
line
;
std
::
getline
(
ifs
,
line
);
// Avoid commented lines or too short ones
if
(
!
line
.
empty
()
&&
line
[
0
]
!=
'#'
)
// retrieve the label
std
::
string
::
size_type
pos
=
line
.
find_first_of
(
" "
,
0
);
LabelType
clabel
=
atoi
(
line
.
substr
(
0
,
pos
).
c_str
());
++
pos
;
// Retrieve the color
VectorPixelType
color
(
3
);
color
.
Fill
(
0
);
for
(
unsigned
int
i
=
0
;
i
<
3
;
++
i
)
{
// retrieve the label
std
::
string
::
size_type
pos
=
line
.
find_first_of
(
" "
,
0
);
LabelType
clabel
=
atoi
(
line
.
substr
(
0
,
pos
).
c_str
());
++
pos
;
// Retrieve the color
VectorPixelType
color
(
3
);
color
.
Fill
(
0
);
for
(
unsigned
int
i
=
0
;
i
<
3
;
++
i
)
{
std
::
string
::
size_type
nextpos
=
line
.
find_first_of
(
" "
,
pos
);
int
value
=
atoi
(
line
.
substr
(
pos
,
nextpos
).
c_str
());
if
(
value
<
0
||
value
>
255
)
otbAppLogWARNING
(
"WARNING: color value outside 8-bits range (<0 or >255). Value will be clamped."
<<
std
::
endl
);
color
[
i
]
=
static_cast
<
PixelType
>
(
value
);
pos
=
nextpos
+
1
;
nextpos
=
line
.
find_first_of
(
" "
,
pos
);
}
otbAppLogINFO
(
"Adding color mapping "
<<
clabel
<<
" -> ["
<<
(
int
)
color
[
0
]
<<
" "
<<
(
int
)
color
[
1
]
<<
" "
<<
(
int
)
color
[
2
]
<<
" ]"
<<
std
::
endl
);
m_Mapper
->
SetChange
(
clabel
,
color
);
std
::
string
::
size_type
nextpos
=
line
.
find_first_of
(
" "
,
pos
);
int
value
=
atoi
(
line
.
substr
(
pos
,
nextpos
).
c_str
());
if
(
value
<
0
||
value
>
255
)
otbAppLogWARNING
(
"WARNING: color value outside 8-bits range (<0 or >255). Value will be clamped."
<<
std
::
endl
);
color
[
i
]
=
static_cast
<
PixelType
>
(
value
);
pos
=
nextpos
+
1
;
nextpos
=
line
.
find_first_of
(
" "
,
pos
);
}
otbAppLogINFO
(
"Adding color mapping "
<<
clabel
<<
" -> ["
<<
(
int
)
color
[
0
]
<<
" "
<<
(
int
)
color
[
1
]
<<
" "
<<
(
int
)
color
[
2
]
<<
" ]"
<<
std
::
endl
);
m_Mapper
->
SetChange
(
clabel
,
color
);
}
ifs
.
close
();
}
ifs
.
close
();
/***/
SetParameterOutputImage
<
VectorImageType
>
(
"out"
,
m_Mapper
->
GetOutput
());
SetParameterOutputImage
<
VectorImageType
>
(
"out"
,
m_Mapper
->
GetOutput
());
}
...
...
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