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
25848c63
Commit
25848c63
authored
Jul 21, 2011
by
Julien Malik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TEST: missing ConcatenateScalarValue test
parent
d0e2ef69
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
0 deletions
+119
-0
Testing/Code/BasicFilters/CMakeLists.txt
Testing/Code/BasicFilters/CMakeLists.txt
+9
-0
Testing/Code/BasicFilters/otbBasicFiltersTests13.cxx
Testing/Code/BasicFilters/otbBasicFiltersTests13.cxx
+2
-0
Testing/Code/BasicFilters/otbConcatenateScalarValueImageFilterTest.cxx
...BasicFilters/otbConcatenateScalarValueImageFilterTest.cxx
+108
-0
No files found.
Testing/Code/BasicFilters/CMakeLists.txt
View file @
25848c63
...
...
@@ -1946,6 +1946,14 @@ ADD_TEST(bfTvMatrixImageFilterTest_3 ${BASICFILTERS_TESTS13}
3
)
ADD_TEST
(
bfTuConcatenateScalarValueImageFilterNew
${
BASICFILTERS_TESTS13
}
otbConcatenateScalarValueImageFilterNew
)
ADD_TEST
(
bfTvConcatenateScalarValueImageFilterTest
${
BASICFILTERS_TESTS13
}
otbConcatenateScalarValueImageFilterTest
)
# ---------------------------- otbMaskMuParserFilter ----------------------------
ADD_TEST
(
bfTuMaskMuParserFilterNew
${
BASICFILTERS_TESTS13
}
...
...
@@ -2765,6 +2773,7 @@ otbMNFImageFilter.cxx
otbNAPCAImageFilter.cxx
otbFastICAImageFilter.cxx
otbVectorImageToMatrixImageFilter.cxx
otbConcatenateScalarValueImageFilterTest.cxx
)
SET
(
BasicFilters_SRCS14
...
...
Testing/Code/BasicFilters/otbBasicFiltersTests13.cxx
View file @
25848c63
...
...
@@ -64,4 +64,6 @@ void RegisterTests()
REGISTER_TEST
(
otbVectorImageToMatrixTest
);
REGISTER_TEST
(
otbProjectiveProjectionNew
);
REGISTER_TEST
(
otbProjectiveProjectionTestHighSNR
);
REGISTER_TEST
(
otbConcatenateScalarValueImageFilterNew
);
REGISTER_TEST
(
otbConcatenateScalarValueImageFilterTest
);
}
Testing/Code/BasicFilters/otbConcatenateScalarValueImageFilterTest.cxx
0 → 100644
View file @
25848c63
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "otbConcatenateScalarValueImageFilter.h"
#include "otbImageFileReader.h"
#include "otbVectorImage.h"
#include "otbImageFileWriter.h"
#include <complex>
typedef
double
PixelType
;
typedef
otb
::
VectorImage
<
PixelType
>
ImageType
;
typedef
otb
::
ConcatenateScalarValueImageFilter
<
ImageType
,
ImageType
>
FilterType
;
int
otbConcatenateScalarValueImageFilterNew
(
int
argc
,
char
*
argv
[])
{
FilterType
::
Pointer
filter
=
FilterType
::
New
();
std
::
cout
<<
filter
<<
std
::
endl
;
return
EXIT_SUCCESS
;
}
int
otbConcatenateScalarValueImageFilterTest
(
int
argc
,
char
*
argv
[])
{
ImageType
::
Pointer
image
=
ImageType
::
New
();
const
PixelType
ScalarValue
=
42
;
const
unsigned
int
Size
=
10
;
const
unsigned
int
NbComponentIn
=
4
;
ImageType
::
RegionType
region
;
region
.
SetIndex
(
0
,
0
);
region
.
SetIndex
(
1
,
0
);
region
.
SetSize
(
0
,
Size
);
region
.
SetSize
(
1
,
Size
);
image
->
SetRegions
(
region
);
image
->
SetNumberOfComponentsPerPixel
(
NbComponentIn
);
image
->
Allocate
();
itk
::
ImageRegionIteratorWithIndex
<
ImageType
>
it
(
image
,
image
->
GetLargestPossibleRegion
());
for
(
it
.
GoToBegin
();
!
it
.
IsAtEnd
();
++
it
)
{
ImageType
::
IndexType
idx
=
it
.
GetIndex
();
ImageType
::
PixelType
value
;
value
.
SetSize
(
NbComponentIn
);
for
(
unsigned
int
k
=
0
;
k
<
NbComponentIn
;
++
k
)
{
value
[
k
]
=
idx
[
0
]
+
idx
[
1
]
*
Size
+
k
;
}
it
.
Set
(
value
);
}
FilterType
::
Pointer
filter
=
FilterType
::
New
();
filter
->
SetInput
(
image
);
filter
->
SetScalarValue
(
ScalarValue
);
ImageType
::
Pointer
outimage
=
filter
->
GetOutput
();
filter
->
UpdateOutputInformation
();
if
(
outimage
->
GetNumberOfComponentsPerPixel
()
!=
NbComponentIn
+
1
)
{
std
::
cerr
<<
"Number of components should be "
<<
NbComponentIn
+
1
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
filter
->
Update
();
itk
::
ImageRegionIteratorWithIndex
<
ImageType
>
outIt
(
outimage
,
outimage
->
GetLargestPossibleRegion
());
for
(
outIt
.
GoToBegin
();
!
outIt
.
IsAtEnd
();
++
outIt
)
{
ImageType
::
IndexType
idx
=
outIt
.
GetIndex
();
ImageType
::
PixelType
value
=
outIt
.
Get
();
for
(
unsigned
int
k
=
0
;
k
<
NbComponentIn
;
++
k
)
{
if
(
value
[
k
]
!=
idx
[
0
]
+
idx
[
1
]
*
Size
+
k
)
{
std
::
cerr
<<
"Error at index "
<<
idx
<<
" channel "
<<
k
<<
" : expected "
<<
idx
[
0
]
+
idx
[
1
]
*
Size
+
k
<<
" got "
<<
value
[
k
]
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
}
if
(
value
[
NbComponentIn
]
!=
ScalarValue
)
{
std
::
cerr
<<
"Error at index "
<<
idx
<<
" channel "
<<
NbComponentIn
<<
" : expected "
<<
ScalarValue
<<
" got "
<<
value
[
NbComponentIn
]
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
}
return
EXIT_SUCCESS
;
}
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