Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
otb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
273
Issues
273
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main Repositories
otb
Commits
7ba8563f
Commit
7ba8563f
authored
Dec 17, 2020
by
Guillaume Pasero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: support margin mode
parent
acd29c6f
Pipeline
#6462
failed with stages
in 9 minutes and 18 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
1 deletion
+45
-1
Modules/Applications/AppImageUtils/app/otbResetMargin.cxx
Modules/Applications/AppImageUtils/app/otbResetMargin.cxx
+45
-1
No files found.
Modules/Applications/AppImageUtils/app/otbResetMargin.cxx
View file @
7ba8563f
...
...
@@ -116,8 +116,33 @@ private:
MandatoryOff
(
"roi.sizex"
);
MandatoryOff
(
"roi.sizey"
);
AddParameter
(
ParameterType_Group
,
"margin"
,
"Margins group"
);
SetParameterDescription
(
"margin"
,
"Contains margins to define the ROI"
);
AddParameter
(
ParameterType_Int
,
"margin.top"
,
"Top margin"
);
SetParameterDescription
(
"margin.top"
,
"Top margin for ROI (in pixels)"
);
SetDefaultParameterInt
(
"margin.top"
,
0
);
AddParameter
(
ParameterType_Int
,
"margin.down"
,
"Down margin"
);
SetParameterDescription
(
"margin.down"
,
"Down margin for ROI (in pixels)"
);
SetDefaultParameterInt
(
"margin.down"
,
0
);
AddParameter
(
ParameterType_Int
,
"margin.left"
,
"Left margin"
);
SetParameterDescription
(
"margin.left"
,
"Left margin for ROI (in pixels)"
);
SetDefaultParameterInt
(
"margin.left"
,
0
);
AddParameter
(
ParameterType_Int
,
"margin.right"
,
"Right margin"
);
SetParameterDescription
(
"margin.right"
,
"Right margin for ROI (in pixels)"
);
SetDefaultParameterInt
(
"margin.right"
,
0
);
MandatoryOff
(
"margin.top"
);
MandatoryOff
(
"margin.down"
);
MandatoryOff
(
"margin.left"
);
MandatoryOff
(
"margin.right"
);
AddParameter
(
ParameterType_Choice
,
"mode"
,
"Region mode"
);
AddChoice
(
"mode.roi"
,
"Pixel region with start and size"
);
AddChoice
(
"mode.margin"
,
"Pixel region with top / bottom / left / right."
);
AddChoice
(
"mode.threshold"
,
"Threshold for X, Y top and botton (DEPRECATED)"
);
...
...
@@ -142,6 +167,8 @@ private:
void
DoExecute
()
override
{
FloatVectorImageType
*
input
=
GetParameterFloatVectorImage
(
"in"
);
// TODO : check largest possible region index
// TODO : check margins for empty region
FloatVectorImageType
::
RegionType
region
;
switch
(
GetParameterInt
(
"mode"
))
{
...
...
@@ -151,7 +178,24 @@ private:
region
.
SetSize
({(
unsigned
long
)
GetParameterInt
(
"roi.sizex"
),(
unsigned
long
)
GetParameterInt
(
"roi.sizey"
)});
break
;
}
case
1
:
// threshold
case
1
:
// margin
{
region
=
input
->
GetLargestPossibleRegion
();
FloatVectorImageType
::
IndexType
idx
=
region
.
GetIndex
();
FloatVectorImageType
::
SizeType
sz
=
region
.
GetSize
();
idx
[
0
]
+=
GetParameterInt
(
"margin.left"
);
idx
[
1
]
+=
GetParameterInt
(
"margin.top"
);
sz
[
0
]
-=
GetParameterInt
(
"margin.left"
)
+
GetParameterInt
(
"margin.right"
);
sz
[
1
]
-=
GetParameterInt
(
"margin.top"
)
+
GetParameterInt
(
"margin.down"
)
region
.
SetIndex
({
GetParameterInt
(
"margin.left"
),
GetParameterInt
(
"margin.top"
)});
region
=
input
->
GetLargestPossibleRegion
();
FloatVectorImageType
::
IndexType
idx
=
region
.
GetIndex
();
FloatVectorImageType
::
SizeType
sz
=
region
.
GetSize
();
region
.
SetIndex
(
idx
);
region
.
SetSize
(
sz
);
break
;
}
case
2
:
// threshold
{
region
=
input
->
GetLargestPossibleRegion
();
FloatVectorImageType
::
IndexType
idx
=
region
.
GetIndex
();
...
...
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