[Git][debian-gis-team/ossim][master] 5 commits: New upstream version 2.9.0
Bas Couwenberg
gitlab at salsa.debian.org
Mon Aug 12 15:27:06 BST 2019
Bas Couwenberg pushed to branch master at Debian GIS Project / ossim
Commits:
37826c36 by Bas Couwenberg at 2019-08-12T13:59:17Z
New upstream version 2.9.0
- - - - -
1c11e85b by Bas Couwenberg at 2019-08-12T13:59:48Z
Update upstream source from tag 'upstream/2.9.0'
Update to upstream version '2.9.0'
with Debian dir 59c6fee09277882b88b54e66e3c22ac5716fff63
- - - - -
4e5fc580 by Bas Couwenberg at 2019-08-12T14:00:41Z
New upstream release.
- - - - -
91b86a4c by Bas Couwenberg at 2019-08-12T14:02:47Z
Add upstream patch to fix segfault in ossimTiffProjectionFactory. (closes: #932134)
- - - - -
0f3ecdd7 by Bas Couwenberg at 2019-08-12T14:03:26Z
Set distribution to unstable.
- - - - -
22 changed files:
- Jenkinsfile
- README.md
- debian/changelog
- + debian/patches/0001-Fixed-missing-return.patch
- debian/patches/series
- + include/ossim/base/ossim2dTo2dCompositeTransform.h
- include/ossim/point_cloud/ossimPointCloudImageHandler.h
- include/ossim/projection/ossimQuickbirdRpcModel.h
- include/ossim/util/ossimPointCloudTool.h
- + include/ossim/util/ossimRemapTool.h
- + src/base/ossim2dTo2dCompositeTransform.cpp
- src/base/ossim2dTo2dTransformFactory.cpp
- src/point_cloud/ossimPointCloudImageHandler.cpp
- src/projection/ossimQuickbirdRpcModel.cpp
- src/util/ossimPointCloudTool.cpp
- + src/util/ossimRemapTool.cpp
- src/util/ossimTool.cpp
- src/util/ossimToolFactory.cpp
- src/vec/ossimVpfLibraryAttributeTableValidator.cpp
- src/vpfutil/vpfread.c
- test/src/util/CMakeLists.txt
- + test/src/util/ossim-remap-tool-test.cpp
Changes:
=====================================
Jenkinsfile
=====================================
@@ -144,8 +144,17 @@ node ("${BUILD_NODE}"){
sh """
export PATH=${ PATH }:/opt/HPE_Security/Fortify_SCA_and_Apps_17.20/bin
sourceanalyzer -64 -b ossimlabs -scan -f fortifyResults-ossim.fpr
- fortifyclient -url ${ HP_FORTIFY_URL } -authtoken ${ HP_FORTIFY_TOKEN } uploadFPR -file fortifyResults-ossim.fpr -project ossim -version 1.0
"""
+ archiveArtifacts "fortifyResults-ossim.fpr"
+ withCredentials([[$class: 'UsernamePasswordMultiBinding',
+ credentialsId: 'fortifyCredentials',
+ usernameVariable: 'HP_FORTIFY_USERNAME',
+ passwordVariable: 'HP_FORTIFY_PASSWORD']]) {
+ sh """
+ export PATH=${ PATH }:/opt/HPE_Security/Fortify_SCA_and_Apps_17.20/bin
+ fortifyclient -url ${ HP_FORTIFY_URL } -user "${ HP_FORTIFY_USERNAME }" -password "${ HP_FORTIFY_PASSWORD }" uploadFPR -file fortifyResults-ossim.fpr -project ossim -version 1.0
+ """
+ }
}
}
}
=====================================
README.md
=====================================
@@ -53,6 +53,8 @@ The following 3rd-party SDKs are needed in order to build the core ossim library
OpenThreads-devel
libjpeg-devel
libgeos-devel (on later Debian / Ubuntu versions, libgeos++-dev)
+
+(Mac users: use [MacPorts](https://github.com/macports/macports-base) to install dependencies)
Plugins will require additional 3rd-party packages.
=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+ossim (2.9.0-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream release.
+ * Add upstream patch to fix segfault in ossimTiffProjectionFactory.
+ (closes: #932134)
+
+ -- Bas Couwenberg <sebastic at debian.org> Mon, 12 Aug 2019 16:03:10 +0200
+
ossim (2.8.2-2) unstable; urgency=medium
* Team upload.
=====================================
debian/patches/0001-Fixed-missing-return.patch
=====================================
@@ -0,0 +1,15 @@
+Description: Fixed missing return
+Author: oscarkramer <oscar.kramer at radiantsolutions.com>
+Origin: https://github.com/ossimlabs/ossim/commit/3505f182e9cd7c836be29f93a23c3c9b1842fc24
+Bug-Debian: https://bugs.debian.org/932134
+
+--- a/src/support_data/ossimGeoTiff.cpp
++++ b/src/support_data/ossimGeoTiff.cpp
+@@ -2415,6 +2415,7 @@ bool ossimGeoTiff::initTiePointsFromImag
+ theTiePoint.push_back(theModelTransformation[3]);
+ theTiePoint.push_back(theModelTransformation[7]);
+ theTiePoint.push_back(0.0);
++ return true;
+ }
+
+
=====================================
debian/patches/series
=====================================
@@ -1 +1,2 @@
spelling-errors.patch
+0001-Fixed-missing-return.patch
=====================================
include/ossim/base/ossim2dTo2dCompositeTransform.h
=====================================
@@ -0,0 +1,100 @@
+//*******************************************************************
+//
+// License: MIT
+//
+// See LICENSE.txt file in the top level directory for more details.
+//
+// Description: Contains class definition for ossim2dTo2dCompositeTransform.
+//
+//*******************************************************************
+// $Id$
+#ifndef ossim2dTo2dCompositeTransform_HEADER
+#define ossim2dTo2dCompositeTransform_HEADER
+#include <ossim/base/ossim2dTo2dTransform.h>
+#include <ossim/base/ossimRefPtr.h>
+#include <vector>
+
+/**
+ * This is the identity transform and just passes the input to the output.
+ */
+class OSSIM_DLL ossim2dTo2dCompositeTransform : public ossim2dTo2dTransform
+{
+public:
+ typedef std::vector<ossimRefPtr<ossim2dTo2dTransform> > CompositeTransformList;
+
+ ossim2dTo2dCompositeTransform(const CompositeTransformList& compositeTransformList = CompositeTransformList());
+ ossim2dTo2dCompositeTransform(const ossim2dTo2dCompositeTransform& rhs);
+ virtual ~ossim2dTo2dCompositeTransform();
+ virtual ossimObject* dup()const;
+
+
+ void add(ossimRefPtr<ossim2dTo2dTransform> transform);
+ void clear();
+
+ const CompositeTransformList& getCompositeTransformList()const;
+
+ /**
+ * Will iterate through the list of transforms from index 0 ... n -1 calling
+ * the forward transform. The output of the previous is used as the input to the next
+ * transform.
+ */
+ virtual void forward(const ossimDpt& input,
+ ossimDpt& output) const;
+
+
+ /**
+ * will call the forward method with 2 arguments
+ */
+ virtual void forward(ossimDpt& /* modify_this */) const;
+
+ /**
+ * Will iterate through the transformation list in reverse order from
+ * n-1 ... 0 calling the inverse for each one. The output is passed in as input
+ * to the next transform.
+ */
+ virtual void inverse(const ossimDpt& input,
+ ossimDpt& output) const;
+
+ /**
+ * will call the inverse method with 2 arguments
+ */
+ virtual void inverse(ossimDpt& /* modify_this */) const;
+
+ /**
+ * Pass equality to the parent
+ */
+ virtual const ossim2dTo2dCompositeTransform& operator=(
+ const ossim2dTo2dCompositeTransform& rhs)
+ {
+ ossim2dTo2dTransform::operator =(rhs);
+
+ return *this;
+ }
+
+ /**
+ * Saves the state of the composite by iterating through all transformas and saving
+ * them to the keyword list with it's own prefix.
+ *
+ * values will be:
+ * <prefix>.object0
+ * <prefix>.object1
+ * <prefix>.object<n-1>
+ *
+ */
+ virtual bool saveState(ossimKeywordlist& kwl, const char* prefix=0)const;
+
+ /**
+ * Will laod the state of the object. Note, it will clear the list and then add
+ * all prefix found from the save state.
+ */
+ virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=0);
+
+protected:
+ /**
+ * Holds the list of transforms.
+ */
+ CompositeTransformList m_compositeTransforms;
+
+ TYPE_DATA
+};
+#endif
=====================================
include/ossim/point_cloud/ossimPointCloudImageHandler.h
=====================================
@@ -49,20 +49,20 @@ public:
* method or use the ossimImageHandler::open that takes a file name and an
* entry index.
*/
- virtual bool open();
+ virtual bool open() override;
/**
* @brief is open method.
* Satisfies ossimImageHandler::isOpen pure virtual.
* @return true if open, false if not.
*/
- virtual bool isOpen() const { return m_pch.valid(); }
+ virtual bool isOpen() const override { return m_pch.valid(); }
/**
* @brief Close method.
*/
- virtual void close();
+ virtual void close() override;
/**
* Returns a pointer to a tile given an origin representing the upper left
@@ -250,8 +250,6 @@ protected:
std::mutex m_mutex;
Components m_activeComponent;
std::vector<ossimString> m_componentNames;
-
- TYPE_DATA
};
#endif /* ossimPointCloudRenderer_HEADER */
=====================================
include/ossim/projection/ossimQuickbirdRpcModel.h
=====================================
@@ -34,7 +34,7 @@ class ossimQbTileFilesHandler;
*****************************************************************************/
class ossimQuickbirdRpcModel : public ossimRpcModel
{
- public:
+public:
ossimQuickbirdRpcModel();
ossimQuickbirdRpcModel(const ossimQuickbirdRpcModel &rhs);
@@ -64,9 +64,13 @@ class ossimQuickbirdRpcModel : public ossimRpcModel
return theSupportData.get();
}
+ /** Initializes this with contents of RPC file. IMPORTANT: This is not enough to fully initialize
+ * the model. The image size and reference (mid) point need to be set before calling this method
+ * so that the GSD is properly computed. A guesstimate of image size is made based
+ * on line/samp offset params, but this will probably be wrong. Returns TRUE if successful. */
bool parseRpcData(const ossimFilename &file);
- protected:
+protected:
bool parseNitfFile(const ossimFilename &file);
bool parseTiffFile(const ossimFilename &file);
bool parseMetaData(const ossimFilename &file);
@@ -84,7 +88,7 @@ class ossimQuickbirdRpcModel : public ossimRpcModel
ossimRefPtr<ossimQuickbirdMetaData> theSupportData;
std::shared_ptr<ossimQuickbirdRpcHeader> m_qbRpcHeader;
- TYPE_DATA
+TYPE_DATA
};
#endif
=====================================
include/ossim/util/ossimPointCloudTool.h
=====================================
@@ -36,6 +36,9 @@ public:
void saveJSON(Json::Value& json) const override;
virtual bool execute() override;
+ /** Used by ossimUtilityFactory */
+ static const char* DESCRIPTION;
+
protected:
bool initialize();
void setGSD(const double& meters_per_pixel);
=====================================
include/ossim/util/ossimRemapTool.h
=====================================
@@ -0,0 +1,59 @@
+//**************************************************************************************************
+//
+// OSSIM Open Source Geospatial Data Processing Library
+// See top level LICENSE.txt file for license information
+//
+//**************************************************************************************************
+
+#ifndef ossimRemapTool_HEADER
+#define ossimRemapTool_HEADER
+
+#include <ossim/base/ossimFilename.h>
+#include <ossim/base/ossimKeywordlist.h>
+#include <ossim/util/ossimChipProcTool.h>
+#include <ossim/base/ossimRefPtr.h>
+#include <ossim/imaging/ossimSingleImageChain.h>
+
+/*!
+ * ossimTool class for performing histo ans scalar-based remapping.
+ */
+class OSSIMDLLEXPORT ossimRemapTool : public ossimChipProcTool
+{
+public:
+ ossimRemapTool();
+
+ /** This constructor packages up all the remap functionality into one "call". There is no need to
+ * call execute() if this constructor is invoked. The remapped file will be accompanied by an
+ * OSSIM geom file that echoes the original input image geometry.
+ * @param inputFile The image file to be remapped.
+ * @param entry_index For multi-entry input files, specifies the entry to be remapped
+ * @param skipHistoStretch Set to true to bypass histogram stretch
+ * @param outputFile If left blank, the output will be "<inputFile>-remap.<ext>"
+ * @throws ossimException on error. Use ossimException::what() to get error description.
+ */
+ ossimRemapTool(const ossimFilename& inputFile,
+ int entryIndex=0,
+ bool doHistoStretch=true,
+ ossimFilename outputFile="");
+
+ ~ossimRemapTool();
+
+ virtual bool initialize(ossimArgumentParser& ap);
+
+ virtual ossimString getClassName() const { return "ossimRemapTool"; }
+
+ virtual bool execute();
+
+ /** Used by ossimUtilityFactory */
+ static const char* DESCRIPTION;
+
+protected:
+ virtual void setUsage(ossimArgumentParser& ap);
+ virtual void initProcessingChain();
+
+ bool m_doHistoStretch;
+ ossimFilename m_inputFilename;
+ uint32_t m_entry;
+};
+
+#endif
=====================================
src/base/ossim2dTo2dCompositeTransform.cpp
=====================================
@@ -0,0 +1,132 @@
+#include <ossim/base/ossim2dTo2dCompositeTransform.h>
+#include <ossim/base/ossimKeywordlist.h>
+#include <ossim/base/ossim2dTo2dTransformRegistry.h>
+
+RTTI_DEF1_INST(ossim2dTo2dCompositeTransform, "ossim2dTo2dCompositeTransform", ossim2dTo2dTransform);
+
+ossim2dTo2dCompositeTransform::ossim2dTo2dCompositeTransform(const CompositeTransformList& compositeTransformList )
+: m_compositeTransforms(compositeTransformList)
+{
+
+}
+
+ossim2dTo2dCompositeTransform::ossim2dTo2dCompositeTransform(const ossim2dTo2dCompositeTransform& rhs)
+:m_compositeTransforms(rhs.m_compositeTransforms)
+{
+
+}
+
+ossim2dTo2dCompositeTransform::~ossim2dTo2dCompositeTransform()
+{
+ clear();
+}
+
+ossimObject* ossim2dTo2dCompositeTransform::dup()const
+{
+ return new ossim2dTo2dCompositeTransform(*this);
+}
+
+
+void ossim2dTo2dCompositeTransform::add(ossimRefPtr<ossim2dTo2dTransform> transform)
+{
+ if(transform)
+ {
+ m_compositeTransforms.push_back(transform);
+ }
+}
+
+void ossim2dTo2dCompositeTransform::clear()
+{
+ m_compositeTransforms.clear();
+}
+
+const ossim2dTo2dCompositeTransform::CompositeTransformList& ossim2dTo2dCompositeTransform::getCompositeTransformList()const
+{
+ return m_compositeTransforms;
+}
+
+void ossim2dTo2dCompositeTransform::forward(const ossimDpt& input,
+ ossimDpt& output) const
+{
+ ossimDpt tempInput = input;
+ output = input;
+
+ for(auto transform:m_compositeTransforms)
+ {
+ transform->forward(tempInput, output);
+ tempInput=output;
+ }
+}
+
+/**
+ *
+ */
+void ossim2dTo2dCompositeTransform::forward(ossimDpt& modify_this) const
+{
+ forward(ossimDpt(modify_this), modify_this);
+}
+
+/**
+ * inverse transform just passes the point to the output.
+ */
+void ossim2dTo2dCompositeTransform::inverse(const ossimDpt& input,
+ ossimDpt& output) const
+{
+ ossimDpt tempInput = input;
+ output = input;
+
+ for(CompositeTransformList::const_reverse_iterator iter = m_compositeTransforms.rbegin();
+ iter != m_compositeTransforms.rend();
+ ++iter
+ )
+ {
+ (*iter)->inverse(tempInput, output);
+ tempInput = output;
+ }
+}
+
+/**
+ * inverse transform nothing is modified on the input point.
+ */
+void ossim2dTo2dCompositeTransform::inverse(ossimDpt& modify_this) const
+{
+ inverse(ossimDpt(modify_this), modify_this);
+}
+
+bool ossim2dTo2dCompositeTransform::saveState(ossimKeywordlist& kwl, const char* prefix)const
+{
+ bool result = ossim2dTo2dTransform::saveState(kwl, prefix);
+ ossim_uint64 idx = 0;
+
+ for(; idx < m_compositeTransforms.size();++idx)
+ {
+ ossimString newPrefix(prefix);
+
+ newPrefix += ossimString("object") +
+ ossimString::toString(idx) +
+ ossimString(".");
+ result &= m_compositeTransforms[idx]->saveState(kwl, newPrefix.c_str());
+ }
+
+ return result;
+}
+
+bool ossim2dTo2dCompositeTransform::loadState(const ossimKeywordlist& kwl, const char* prefix)
+{
+ bool result = ossim2dTo2dTransform::loadState(kwl, prefix);
+
+ std::vector<ossimString> prefixValues;
+ clear();
+ kwl.getSubstringKeyList(prefixValues, ossimString("^(")+ossimString(prefix)+"object[0-9]+.)");
+
+ for(auto newPrefix:prefixValues)
+ {
+ ossimRefPtr<ossim2dTo2dTransform> trans = ossim2dTo2dTransformRegistry::instance()->createTransform(kwl, newPrefix.c_str());
+ if(trans)
+ {
+ add(trans);
+ }
+ }
+
+ return result;
+}
=====================================
src/base/ossim2dTo2dTransformFactory.cpp
=====================================
@@ -12,6 +12,7 @@
#include <ossim/base/ossim2dBilinearTransform.h>
#include <ossim/base/ossim2dTo2dShiftTransform.h>
#include <ossim/base/ossim2dTo2dIdentityTransform.h>
+#include <ossim/base/ossim2dTo2dCompositeTransform.h>
#include <ossim/base/ossimKeywordNames.h>
#include <ossim/base/ossimKeywordlist.h>
#include <ossim/base/ossimRefPtr.h>
@@ -41,6 +42,10 @@ ossim2dTo2dTransform* ossim2dTo2dTransformFactory::createTransform(const ossimSt
{
result = new ossim2dTo2dIdentityTransform();
}
+ else if(name == STATIC_TYPE_NAME(ossim2dTo2dCompositeTransform))
+ {
+ result = new ossim2dTo2dCompositeTransform();
+ }
return result;
}
@@ -63,4 +68,6 @@ void ossim2dTo2dTransformFactory::getTypeNameList(std::vector<ossimString>& type
typeList.push_back(STATIC_TYPE_NAME(ossim2dBilinearTransform));
typeList.push_back(STATIC_TYPE_NAME(ossim2dTo2dShiftTransform));
typeList.push_back(STATIC_TYPE_NAME(ossim2dTo2dIdentityTransform));
+ typeList.push_back(STATIC_TYPE_NAME(ossim2dTo2dCompositeTransform));
+
}
=====================================
src/point_cloud/ossimPointCloudImageHandler.cpp
=====================================
@@ -27,8 +27,6 @@
#include <ossim/imaging/ossimImageDataFactory.h>
#include <ossim/projection/ossimEpsgProjectionFactory.h>
-RTTI_DEF1(ossimPointCloudImageHandler, "ossimPointCloudImageHandler", ossimImageHandler);
-
static ossimTrace traceDebug("ossimPointCloudImageHandler:debug");
static const char* GSD_FACTOR_KW = "gsd_factor";
static const char* COMPONENT_KW = "component";
=====================================
src/projection/ossimQuickbirdRpcModel.cpp
=====================================
@@ -297,6 +297,9 @@ bool ossimQuickbirdRpcModel::parseRpcData(const ossimFilename &base_name)
{
ossimFilename rpcFile(base_name);
+ // Make the gsd nan so it gets computed.
+ theGSD.makeNan();
+
// There are three possibilities for RPC data files: either each image file has its own RPC data
// file, or a single RPC file is provided for a multi-tile scene.
while (1)
@@ -348,6 +351,15 @@ bool ossimQuickbirdRpcModel::parseRpcData(const ossimFilename &base_name)
theRandError = m_qbRpcHeader->theErrRand;
theImageID = rpcFile.fileNoExtension();
+ if (theImageSize.length() == 0)
+ {
+ theImageSize.x = 2 * (int) theSampOffset;
+ theImageSize.y = 2 * (int) theLineOffset;
+ theRefImgPt = ossimDpt(theSampOffset, theLineOffset);
+ }
+
+ finishConstruction();
+
return true;
}
=====================================
src/util/ossimPointCloudTool.cpp
=====================================
@@ -24,6 +24,9 @@
using namespace std;
+const char* ossimPointCloudTool::DESCRIPTION =
+ "Utility class for generating point-cloud-derived image products.";
+
ossimPointCloudTool::ossimPointCloudTool()
: m_operation (LOWEST_DEM),
m_gsd (0)
=====================================
src/util/ossimRemapTool.cpp
=====================================
@@ -0,0 +1,210 @@
+//**************************************************************************************************
+//
+// OSSIM Open Source Geospatial Data Processing Library
+// See top level LICENSE.txt file for license information
+//
+// Author: oscar.kramer at maxar.com
+//
+//**************************************************************************************************
+
+#include <ossim/util/ossimRemapTool.h>
+#include <ossim/init/ossimInit.h>
+#include <ossim/base/ossimApplicationUsage.h>
+#include <ossim/base/ossimApplicationUsage.h>
+#include <ossim/base/ossimNotify.h>
+#include <ossim/base/ossimKeywordNames.h>
+#include <ossim/base/ossimException.h>
+#include <ossim/imaging/ossimBandMergeSource.h>
+#include <ossim/imaging/ossimHistogramRemapper.h>
+#include <ossim/base/ossimMultiResLevelHistogram.h>
+#include <ossim/base/ossimMultiBandHistogram.h>
+#include <ossim/imaging/ossimImageHistogramSource.h>
+#include <iostream>
+#include <ossim/imaging/ossimHistogramWriter.h>
+#include <ossim/base/ossimStdOutProgress.h>
+#include <ossim/imaging/ossimImageHandlerRegistry.h>
+
+using namespace std;
+
+const char* ossimRemapTool::DESCRIPTION =
+ "Performs remap to 8-bit including optional histogram stretch and saves the corresponding external geometry file.";
+
+ossimRemapTool::ossimRemapTool()
+ : m_doHistoStretch(true),
+ m_entry(0)
+{
+ theStdOutProgress.setFlushStreamFlag(true);
+}
+
+ossimRemapTool::ossimRemapTool(const ossimFilename& inputFile,
+ int entryIndex,
+ bool doHistoStretch,
+ ossimFilename outputFile)
+ : m_inputFilename (inputFile),
+ m_entry (entryIndex),
+ m_doHistoStretch(doHistoStretch)
+{
+ m_productFilename = outputFile;
+ theStdOutProgress.setFlushStreamFlag(true);
+
+ initProcessingChain();
+
+ if (!execute())
+ throw ossimException("Error encountered writing remap image.");
+}
+
+ossimRemapTool::~ossimRemapTool()
+{
+}
+
+void ossimRemapTool::setUsage(ossimArgumentParser& ap)
+{
+ // Add options.
+ ossimApplicationUsage* au = ap.getApplicationUsage();
+ ossimString usageString = ap.getApplicationName();
+ usageString += " remap [options] <input-image> [<remap-out-image>]";
+ au->setCommandLineUsage(usageString);
+
+ // Set the command line options:
+ au->setDescription(DESCRIPTION);
+
+ // Base class has its own:
+ ossimTool::setUsage(ap);
+
+ au->addCommandLineOption("-e, --entry", "<entry> For multi image handlers which entry do you wish to extract. For list of entries use: \"ossim-info -i <your_image>\" ");
+ au->addCommandLineOption("-n, --no-histo", "Optionally bypass histogram-stretch. ");
+}
+
+bool ossimRemapTool::initialize(ossimArgumentParser& ap)
+{
+ if (!ossimTool::initialize(ap))
+ return false;
+ if (m_helpRequested)
+ return true;
+
+ ossimString ts1;
+ ossimArgumentParser::ossimParameter sp1 (ts1);
+
+ if ( ap.read("-e", sp1) || ap.read("--entry", sp1) )
+ m_entry = ts1.toUInt32();
+
+ if ( ap.read("--no-histo") || ap.read("-n"))
+ m_doHistoStretch = false;
+
+ // Determine input filename:
+ if ( ap.argc() > 1 )
+ m_inputFilename = ap[1];
+
+ if (!m_inputFilename.isReadable())
+ {
+ ossimNotify(ossimNotifyLevel_FATAL)<<"ossimRemapTool::initialize() Input filename <"
+ <<m_inputFilename<<"> was not specified or is not "
+ <<"readable. Try again.\n"<<endl;
+ return false;
+ }
+
+ // Establish output filename:
+ if ( ap.argc() > 2 )
+ {
+ m_productFilename = ap[2];
+ cout<<m_inputFilename<<endl;
+ }
+ try
+ {
+ initProcessingChain();
+ }
+ catch (ossimException& xe)
+ {
+ ossimNotify(ossimNotifyLevel_FATAL)<<xe.what()<<endl;
+ return false;
+ }
+
+ return true;
+}
+
+void ossimRemapTool::initProcessingChain()
+{
+ ostringstream errMsg ("ossimRemapTool::initProcessingChain() ERROR: ");
+
+ ossimRefPtr<ossimImageHandler> handler =
+ ossimImageHandlerRegistry::instance()->open(m_inputFilename);
+ if (!handler)
+ {
+ errMsg<<"Could not open input image file at <"<<m_inputFilename<<">.";
+ throw ossimException(errMsg.str());
+ }
+ if (m_entry)
+ handler->setCurrentEntry(m_entry);
+ m_procChain->add(handler.get());
+ m_geom = handler->getImageGeometry();
+
+ // Add histogram remapper if requested:
+ if (m_doHistoStretch)
+ {
+ ossimRefPtr<ossimMultiResLevelHistogram> histogram = handler->getImageHistogram();
+ if (!histogram)
+ {
+ // Need to create a histogram:
+ ossimRefPtr<ossimImageHistogramSource> histoSource = new ossimImageHistogramSource;
+ ossimRefPtr<ossimHistogramWriter> writer = new ossimHistogramWriter;
+ histoSource->connectMyInputTo(0, handler.get());
+ histoSource->enableSource();
+ writer->connectMyInputTo(0, histoSource.get());
+ ossimFilename histoFile;
+ histoFile = handler->getFilenameWithThisExtension(ossimString("his"));
+ writer->setFilename(histoFile);
+ writer->addListener(&theStdOutProgress);
+ writer->execute();
+ histogram = handler->getImageHistogram();
+ if (!histogram)
+ {
+ errMsg<<"Could not create histogram from <"<<histoFile<<">.";
+ throw ossimException(errMsg.str());
+ }
+ }
+
+ // Ready the histogram object in the processing chain:
+ ossimRefPtr<ossimHistogramRemapper> histogramRemapper = new ossimHistogramRemapper();
+ histogramRemapper->setEnableFlag(true);
+ histogramRemapper->setStretchMode( ossimHistogramRemapper::LINEAR_AUTO_MIN_MAX );
+ histogramRemapper->setHistogram(histogram);
+ m_procChain->add(histogramRemapper.get());
+ }
+
+ // Add scalar remapper:
+ ossimRefPtr<ossimScalarRemapper> scalarRemapper = new ossimScalarRemapper();
+ scalarRemapper->setOutputScalarType(OSSIM_UINT8);
+ m_procChain->add(scalarRemapper.get());
+
+ m_procChain->initialize();
+}
+
+bool ossimRemapTool::execute()
+{
+ if (m_productFilename.empty())
+ {
+ m_productFilename = m_inputFilename.fileNoExtension() + "-remap";
+ m_productFilename.setExtension(m_inputFilename.ext());
+ }
+
+ m_geom->getBoundingRect(m_aoiViewRect);
+
+ // Parent class has service to create writer:
+ m_writer = newWriter();
+ m_writer->connectMyInputTo(0, m_procChain.get());
+
+ // Add a listener to get percent complete.
+ m_writer->addListener(&theStdOutProgress);
+
+ // Write the file and external geometry:
+ if(!m_writer->execute())
+ return false;
+
+ if (!m_writer->writeExternalGeometryFile())
+ return false;
+
+ ossimNotify(ossimNotifyLevel_INFO)<<"Wrote product image to <"<<m_productFilename<<">"<<endl;
+
+ return true;
+}
+
=====================================
src/util/ossimTool.cpp
=====================================
@@ -58,10 +58,10 @@ void ossimTool::setUsage(ossimArgumentParser& ap)
bool ossimTool::initialize(ossimArgumentParser& ap)
{
m_helpRequested = false;
+ setUsage(ap);
if (ap.read("-h") || ap.read("--help") )
{
// Write usage.
- setUsage(ap);
ap.getApplicationUsage()->write(ossimNotify(ossimNotifyLevel_INFO));
m_helpRequested = true;
return true;
=====================================
src/util/ossimToolFactory.cpp
=====================================
@@ -18,6 +18,7 @@
#include <ossim/util/ossimViewshedTool.h>
#include <ossim/util/ossimSubImageTool.h>
#include <ossim/util/ossimPointCloudTool.h>
+#include <ossim/util/ossimRemapTool.h>
#if OSSIM_HAS_HDF5
#include <ossim/hdf5/ossimHdf5Tool.h>
#endif
@@ -78,6 +79,9 @@ ossimTool* ossimToolFactory::createTool(const std::string& argName) const
if ((utilName == "pointcloud") || (argName == "ossimPointCloudTool"))
return new ossimPointCloudTool;
+ if ((utilName == "remap") || (argName == "ossimRemapTool"))
+ return new ossimRemapTool;
+
#if OSSIM_HAS_HDF5
if ((utilName == "hdf5") || (argName == "ossimHdf5Tool"))
return new ossimHdf5Tool;
@@ -98,6 +102,8 @@ void ossimToolFactory::getCapabilities(std::map<std::string, std::string>& capab
capabilities.insert(pair<string, string>("vertices", ossimVerticesFinderTool::DESCRIPTION));
capabilities.insert(pair<string, string>("bandmerge", ossimBandMergeTool::DESCRIPTION));
capabilities.insert(pair<string, string>("subimage", ossimSubImageTool::DESCRIPTION));
+ capabilities.insert(pair<string, string>("pointcloud", ossimPointCloudTool::DESCRIPTION));
+ capabilities.insert(pair<string, string>("remap", ossimRemapTool::DESCRIPTION));
#if OSSIM_HAS_HDF5
capabilities.insert(pair<string, string>("hdf5", ossimHdf5Tool::DESCRIPTION));
#endif
@@ -122,6 +128,8 @@ void ossimToolFactory::getTypeNameList(vector<ossimString>& typeList) const
typeList.push_back("ossimVerticesFinderUtil");
typeList.push_back("ossimBandMergeUtil");
typeList.push_back("ossimSubImageTool");
+ typeList.push_back("ossimPointCloudTool");
+ typeList.push_back("ossimRemapTool");
#if OSSIM_HAS_HDF5
typeList.push_back("ossimHdf5Tool");
#endif
=====================================
src/vec/ossimVpfLibraryAttributeTableValidator.cpp
=====================================
@@ -3,12 +3,6 @@
bool ossimVpfLibraryAttributeTableValidator::isValid(ossimVpfTable& aTable)const
{
- // make sure the table is not null
- if(&aTable == NULL)
- {
- return false;
- }
-
// and make sure that the table is not closed
if(aTable.isClosed())
{
=====================================
src/vpfutil/vpfread.c
=====================================
@@ -124,7 +124,7 @@ static char * get_line (FILE *fp)
return (char *) NULL ;
}
}
- if ( ( CurrentChar == (ossim_int32) LINE_CONTINUE ) ) {
+ if ( CurrentChar == (ossim_int32) LINE_CONTINUE ) {
CurrentChar = fgetc(fp ) ; /* read character after backslash */
/* A newline will be ignored and thus skipped over */
if ( CurrentChar == (ossim_int32) SPACE ) /* Assume line continue error */
=====================================
test/src/util/CMakeLists.txt
=====================================
@@ -4,4 +4,5 @@ OSSIM_SETUP_APPLICATION(ossim-chipper-test INSTALL COMMAND_LINE COMPONENT_NAME o
OSSIM_SETUP_APPLICATION(ossim-info-test INSTALL COMMAND_LINE COMPONENT_NAME ossim SOURCE_FILES ossim-info-test.cpp)
OSSIM_SETUP_APPLICATION(ossim-viewshed-test INSTALL COMMAND_LINE COMPONENT_NAME ossim SOURCE_FILES ossim-viewshed-test.cpp)
OSSIM_SETUP_APPLICATION(ossim-tools-test INSTALL COMMAND_LINE COMPONENT_NAME ossim SOURCE_FILES ossim-tools-test.cpp)
+OSSIM_SETUP_APPLICATION(ossim-remap-tool-test INSTALL COMMAND_LINE COMPONENT_NAME ossim SOURCE_FILES ossim-remap-tool-test.cpp)
=====================================
test/src/util/ossim-remap-tool-test.cpp
=====================================
@@ -0,0 +1,88 @@
+//**************************************************************************************************
+//
+// OSSIM Open Source Geospatial Data Processing Library
+// See top level LICENSE.txt file for license information
+//
+// Author: oscar.kramer at maxar.com
+//
+//**************************************************************************************************
+
+#include <ossim/base/ossimArgumentParser.h>
+#include <ossim/base/ossimException.h>
+#include <ossim/util/ossimRemapTool.h>
+#include <ossim/init/ossimInit.h>
+#include <getopt.h>
+#include <iostream>
+
+void usage(char* argv0, int exitCode, std::string errMsg="")
+{
+ if (!errMsg.empty())
+ std::cout<<"\n"<<errMsg<<std::endl;
+ std::cout<<
+ "\nPerforms remap to 8-bit including optional histogram stretch and saves the corresponding"
+ "\nexternal geometry file. If output filename is omitted, the output will be <input-image>-remap.ext"
+ "\n"
+ "\nUsage: "<<argv0<<" [options] <input-image.ext> [<output-image>] "
+ "\n"
+ "\nOptions:"
+ "\n -e <N> Entry index for multi-entry input files."
+ "\n -h Dump this help."
+ "\n -n Skip histogram stretch."
+ "\n"<<std::endl;
+ exit(exitCode);
+}
+
+
+int main(int argc, char *argv[])
+{
+ ossimArgumentParser ap(&argc, argv);
+ ossimInit::instance()->initialize(ap);
+ ostringstream msg;
+ int entryIndex=0, c=0;
+ bool doHistoStretch=true;
+
+ // Parse command line:
+ while ((c = getopt(argc, argv, "e:hn")) != -1)
+ {
+ switch (c)
+ {
+ case 'e':
+ entryIndex = atoi(optarg);
+ break;
+ case 'h':
+ usage(argv[0], 0);
+ break;
+ case 'n':
+ doHistoStretch = false;
+ break;
+ case '?':
+ msg << "Unknown option '" << (char) optopt << "' specified.";
+ usage(argv[0], 1, msg.str());
+ break;
+ default:
+ abort();
+ }
+ }
+
+ int numArgs = argc - optind;
+ if (numArgs < 1)
+ usage(argv[0], 1, "Input filename required.");
+
+ ossimFilename inputFilename (argv[optind++]);
+ ossimFilename outputFilename;
+ if (numArgs > 1)
+ outputFilename = argv[optind];
+
+ try
+ {
+ // Constructor does everything or throws exception:
+ ossimRemapTool ort (inputFilename, entryIndex, doHistoStretch, outputFilename);
+ }
+ catch (const ossimException& e)
+ {
+ std::cerr << e.what() << std::endl;
+ return 1;
+ }
+
+ return 0;
+}
View it on GitLab: https://salsa.debian.org/debian-gis-team/ossim/compare/9b70796c4cb3883cf83dd5261f9b37da9a57db2e...0f3ecdd71a2771d85506708bf0b48b816366649a
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/ossim/compare/9b70796c4cb3883cf83dd5261f9b37da9a57db2e...0f3ecdd71a2771d85506708bf0b48b816366649a
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20190812/003faa1f/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list