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 Osman
otb
Commits
2eaf3752
Commit
2eaf3752
authored
5 years ago
by
Cédric Traizet
Browse files
Options
Downloads
Patches
Plain Diff
DOC: add documentation to the ExtractROI application test
parent
a511dbcf
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
Modules/Applications/AppImageUtils/test/otbExtractROIAppTests.cxx
+25
-1
25 additions, 1 deletion
...Applications/AppImageUtils/test/otbExtractROIAppTests.cxx
with
25 additions
and
1 deletion
Modules/Applications/AppImageUtils/test/otbExtractROIAppTests.cxx
+
25
−
1
View file @
2eaf3752
...
...
@@ -30,7 +30,7 @@ using VectorImageType = otb::VectorImage<unsigned char>;
using
PixelType
=
VectorImageType
::
PixelType
;
using
ApplicationPointerType
=
otb
::
Wrapper
::
Application
::
Pointer
;
/* This function is creating and filling a vector image */
/* This function is creating and filling a
georeferenced
vector image */
VectorImageType
::
Pointer
create_vector_image
(
VectorImageType
::
SizeType
size
,
int
nb_comp
,
unsigned
char
value
,
const
OGRSpatialReference
&
projRef
,
VectorImageType
::
PointType
origin
,
VectorImageType
::
SpacingType
spacing
)
{
...
...
@@ -64,6 +64,7 @@ VectorImageType::Pointer create_vector_image(VectorImageType::SizeType size, int
return
image
;
}
// Compare the ROI computed by the application with a reference
bool
check_roi
(
ApplicationPointerType
app
,
int
ref_startx
,
int
ref_starty
,
int
ref_sizex
,
int
ref_sizey
)
{
auto
app_startx
=
app
->
GetParameterInt
(
"startx"
);
...
...
@@ -85,6 +86,7 @@ bool check_roi(ApplicationPointerType app, int ref_startx, int ref_starty, int r
return
true
;
}
// App configuration with the standard mode
void
extract_roi_standard
(
ApplicationPointerType
app
,
unsigned
int
startx
,
unsigned
int
starty
,
unsigned
int
sizex
,
unsigned
int
sizey
)
{
app
->
SetParameterString
(
"mode"
,
"standard"
);
...
...
@@ -100,6 +102,7 @@ void extract_roi_standard(ApplicationPointerType app, unsigned int startx, unsig
app
->
Execute
();
}
// App configuration with the extent mode
void
extract_roi_extent
(
ApplicationPointerType
app
,
std
::
string
unit
,
double
ulx
,
double
uly
,
double
lrx
,
double
lry
)
{
app
->
SetParameterString
(
"mode"
,
"extent"
);
...
...
@@ -117,6 +120,7 @@ void extract_roi_extent(ApplicationPointerType app, std::string unit, double ulx
app
->
Execute
();
}
// App configuration with the radius mode
void
extract_roi_radius
(
ApplicationPointerType
app
,
std
::
string
unitc
,
std
::
string
unitr
,
double
r
,
double
cx
,
double
cy
)
{
app
->
SetParameterString
(
"mode"
,
"radius"
);
...
...
@@ -134,6 +138,25 @@ void extract_roi_radius(ApplicationPointerType app, std::string unitc, std::stri
app
->
Execute
();
}
/** This function tests the ExtractROI application. It verifies that, for different sets of parameters,
* the ROI computed by the application (startx, starty,sizex and sizey) is correct. The tested mode are :
* - Standard mode with invalid size (output is the full image)
* - Extent mode with invalid size (output is the full image)
* - Radius mode with invalid size (output is the full image)
* - Standard mode
* - Extent mode with pixel units
* - Extent mode with lonlat unit
* - Extent mode with phy unit
* - radius mode with pixel center and radius
* - radius mode with phy center and radius
* - radius mode with lonlat center and pixel radius
* - fit mode with image input
* For all these tests the application executed, but nothing is written to disk, and the output image is not updated.
* This means that the multiChannelExtractROI filter is not updated.
* Finally, in a last test, the channel option is set and the output is updated.
* Note that this test does not test the fit mode with vector data, which is tested in another test.
*/
int
otbExtractROIAppTests
(
int
,
char
*
argv
[])
{
unsigned
int
imageSize
=
std
::
stoi
(
argv
[
2
]);
...
...
@@ -314,6 +337,7 @@ int otbExtractROIAppTests(int, char* argv[])
auto
output
=
app
->
GetParameterImageBase
(
"out"
);
output
->
Update
();
// Check that the output has the requested number of bands
if
(
output
->
GetNumberOfComponentsPerPixel
()
!=
2
)
{
std
::
cout
<<
"Wrong number of components after ExtractROI"
<<
std
::
endl
;
...
...
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