Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Main Repositories
otb
Commits
60c43da7
Commit
60c43da7
authored
Dec 18, 2009
by
Emmanuel Christophe
Browse files
TEST: add test for vector data conversion to image coordinates
parent
522e2849
Changes
3
Hide whitespace changes
Inline
Side-by-side
Testing/Code/Projections/CMakeLists.txt
View file @
60c43da7
...
...
@@ -457,6 +457,17 @@ ADD_TEST(prTvVectorDataProjectionFilterFromMapToGeo ${PROJECTIONS_TESTS3}
${
TEMP
}
/prTvVectorDataProjectionFilterFromMapToGeo.kml
)
ADD_TEST
(
prTvVectorDataProjectionFilterFromMapToImage
${
PROJECTIONS_TESTS3
}
--compare-ascii
${
NOTOL
}
${
BASELINE_FILES
}
/prTvVectorDataProjectionFilterFromMapToImage.kml
${
TEMP
}
/prTvVectorDataProjectionFilterFromMapToImage.kml
otbVectorDataProjectionFilterFromMapToImage
${
INPUTDATA
}
/ToulousePoints-examples.shp
${
INPUTDATA
}
/QB_Toulouse_Ortho_PAN.tif
${
TEMP
}
/prTvVectorDataProjectionFilterFromMapToImage.kml
)
ADD_TEST
(
prTuGeocentricTransformNew
${
PROJECTIONS_TESTS3
}
otbGeocentricTransformNew
)
...
...
@@ -509,6 +520,7 @@ otbVectorDataProjectionFilterNew.cxx
otbVectorDataProjectionFilter.cxx
otbVectorDataProjectionFilterFromMapToSensor.cxx
otbVectorDataProjectionFilterFromMapToGeo.cxx
otbVectorDataProjectionFilterFromMapToImage.cxx
otbGeocentricTransformNew.cxx
otbGeocentricTransform.cxx
otbVectorDataExtractROIandProjection.cxx
...
...
Testing/Code/Projections/otbProjectionsTests3.cxx
View file @
60c43da7
...
...
@@ -37,6 +37,7 @@ void RegisterTests()
REGISTER_TEST
(
otbVectorDataProjectionFilter
);
REGISTER_TEST
(
otbVectorDataProjectionFilterFromMapToSensor
);
REGISTER_TEST
(
otbVectorDataProjectionFilterFromMapToGeo
);
REGISTER_TEST
(
otbVectorDataProjectionFilterFromMapToImage
);
REGISTER_TEST
(
otbGeocentricTransformNew
);
REGISTER_TEST
(
otbGeocentricTransform
);
REGISTER_TEST
(
otbVectorDataExtractROIandProjection
);
...
...
Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToImage.cxx
0 → 100644
View file @
60c43da7
/*=========================================================================
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 "itkExceptionObject.h"
#include "otbVectorDataProjectionFilter.h"
#include "otbVectorData.h"
#include "otbVectorDataFileReader.h"
#include "otbVectorDataFileWriter.h"
#include "otbImage.h"
#include "otbImageFileReader.h"
int
otbVectorDataProjectionFilterFromMapToImage
(
int
argc
,
char
*
argv
[])
{
if
(
argc
<
4
)
{
std
::
cout
<<
argv
[
0
]
<<
" <input vector filename> <input image filename>"
<<
" <output vector filename> "
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
typedef
otb
::
VectorData
<
double
>
InputVectorDataType
;
typedef
otb
::
VectorData
<
double
>
OutputVectorDataType
;
typedef
otb
::
VectorDataFileReader
<
InputVectorDataType
>
VectorDataFileReaderType
;
VectorDataFileReaderType
::
Pointer
reader
=
VectorDataFileReaderType
::
New
();
reader
->
SetFileName
(
argv
[
1
]);
reader
->
UpdateOutputInformation
();
typedef
otb
::
Image
<
unsigned
short
int
,
2
>
ImageType
;
typedef
otb
::
ImageFileReader
<
ImageType
>
ImageReaderType
;
ImageReaderType
::
Pointer
imageReader
=
ImageReaderType
::
New
();
imageReader
->
SetFileName
(
argv
[
2
]);
imageReader
->
UpdateOutputInformation
();
typedef
otb
::
VectorDataProjectionFilter
<
InputVectorDataType
,
OutputVectorDataType
>
VectorDataFilterType
;
VectorDataFilterType
::
Pointer
vectorDataProjection
=
VectorDataFilterType
::
New
();
vectorDataProjection
->
SetInput
(
reader
->
GetOutput
());
vectorDataProjection
->
SetOutputProjectionRef
(
imageReader
->
GetOutput
()
->
GetProjectionRef
());
vectorDataProjection
->
SetOutputOrigin
(
imageReader
->
GetOutput
()
->
GetOrigin
());
vectorDataProjection
->
SetOutputSpacing
(
imageReader
->
GetOutput
()
->
GetSpacing
());
typedef
otb
::
VectorDataFileWriter
<
OutputVectorDataType
>
VectorDataFileWriterType
;
VectorDataFileWriterType
::
Pointer
writer
=
VectorDataFileWriterType
::
New
();
writer
->
SetFileName
(
argv
[
3
]);
writer
->
SetInput
(
vectorDataProjection
->
GetOutput
());
writer
->
Update
();
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