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
5ac087fe
Commit
5ac087fe
authored
12 years ago
by
Julien Malik
Browse files
Options
Downloads
Patches
Plain Diff
BUG: workaround for issue #573
parent
6328046a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/UtilitiesAdapters/OssimAdapters/otbImageKeywordlist.cxx
+42
-1
42 additions, 1 deletion
Code/UtilitiesAdapters/OssimAdapters/otbImageKeywordlist.cxx
with
42 additions
and
1 deletion
Code/UtilitiesAdapters/OssimAdapters/otbImageKeywordlist.cxx
+
42
−
1
View file @
5ac087fe
...
...
@@ -28,6 +28,7 @@
#include
"ossim/ossimTileMapModel.h"
#include
"ossim/projection/ossimProjectionFactoryRegistry.h"
#include
"otbSensorModelAdapter.h"
namespace
otb
{
...
...
@@ -182,8 +183,48 @@ ReadGeometry(const std::string& filename)
if
(
!
handler
)
{
otbMsgDevMacro
(
<<
"OSSIM Open Image FAILED ! "
);
}
// In some corner cases, ossim is unable to create a ossimImageHandler
// instance for the provided file.
// This can happen for TIFF+geom files where the ossimTiffTileSource
// fails when trying to open the TIFF file (for example
// because ossim is compiled with a libtiff without BigTIFF support
// and when the actual TIFF file exceeds the Large File limit).
// In such cases, we don't actually need ossim to interpret the TIFF file,
// and just want a valid ossimKeywordlist corresponding to a sensor model.
// Here is implemented a shortcut used as a fallback scenario,
// where we bypass the ossimImageHandlerRegistry
// and directly create a ossimKeywordlist from the ".geom" file.
// We then verify it is a valid sensor model by using otb::SensorModelAdapter
// which uses ossimSensorModelFactory and ossimPluginProjectionFactory internally,
// thus by-passing the need for a valid ossimImageHandler.
// Try to find a ".geom" file next to 'filename'
ossimFilename
ossimGeomFile
=
ossimFilename
(
filename
).
setExtension
(
".geom"
);
if
(
ossimGeomFile
.
exists
()
&&
ossimGeomFile
.
isFile
())
{
// Interpret the geom file as a KWL
ossimKeywordlist
kwl
(
ossimGeomFile
);
// Check that the geom file results in a valid ossimKeywordlist
if
(
kwl
.
getErrorStatus
()
==
ossimErrorCodes
::
OSSIM_OK
)
{
// Be sure there is a corresponding instance of ossimSensorModel
// which understands this kwl
SensorModelAdapter
::
Pointer
sensorModel
=
SensorModelAdapter
::
New
();
ImageKeywordlist
otbkwl
;
otbkwl
.
SetKeywordlist
(
kwl
);
sensorModel
->
CreateProjection
(
otbkwl
);
if
(
sensorModel
->
IsValidSensorModel
())
{
geom_kwl
=
kwl
;
}
}
}
}
else
{
otbMsgDevMacro
(
<<
"OSSIM Open Image SUCCESS ! "
);
...
...
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