Skip to content
Commits on Source (7)
......@@ -7,4 +7,4 @@ doc/html
cmake_install*
*.swp
CMakeCache.txt
.gradle
......@@ -218,30 +218,36 @@ int main(int argc, char** argv)
mode = ASCII;
}
if ( argumentParser.read("-h") || argumentParser.read("--help") ||
(argumentParser.argc() != 2) )
if ( argumentParser.read("-h") || argumentParser.read("--help"))
{
std::cout << "\nBinary to ascii usage: btoa [options] <binary_file>\n"
<< "Options:\n"
std::cout << "\nDisplays a binary file as ASCII/hexadecimal. If no input file is provided, then\n"
<< "input is taken from stdin. Non-ascii characters are printed as dot in ascii output.\n"
<< "Default mode prints offsets, hex and ascii data.\n\n"
<< "Usage: btoa [options] [<binary_file>]\n\n"
<< "Options:\n\n"
<< " -e Indicates text characters are ebcdic and should be"
<< " converted to ascii.\n"
<< "-h or --help usage\n"
<< " -h, --help Shows this usage\n"
<< " -a Ascii mode, prints 64 characters wide with no offset or hex data.\n"
<< " -w Wide mode, prints offset and 64 characters wide with no hex data.\n"
<< "Notes:\n"
<< " 1) Non-ascii characters are printed as dot in ascii output.\n"
<< " 2) Default mode prints offsets, hex and ascii data."
<< std::endl;
return 0;
}
FILE* fptr = fopen(argv[argumentParser.argc()-1], "rb");
FILE* fptr = 0;
if (argumentParser.argc() > 1)
{
fptr = fopen(argv[argumentParser.argc() - 1], "rb");
if (fptr == 0)
{
std::cout << "\nError opening file " << argv[argumentParser.argc() - 1]
<< std::endl << std::endl;
return -1;
}
}
else
fptr = stdin;
if ( mode == WIDE )
{
......
......@@ -90,10 +90,10 @@ void plotHistogram(const ossimFilename& histoFile, const ossimString& plotWith,
ossimRefPtr<ossimHistogram> histogram = h->getHistogram(band);
int numBins = histogram->GetRes();
const float* x = histogram->GetVals();
const float* y = histogram->GetCounts();
const ossim_int64* y = histogram->GetCounts();
for (int i=0; i<numBins; ++i)
{
fprintf(gnuplotPipe, "%f %f \n", x[i], y[i]);
fprintf(gnuplotPipe, "%f %i \n", x[i], y[i]);
}
fprintf(gnuplotPipe, "e");
fclose(gnuplotPipe);
......
......@@ -201,6 +201,10 @@ IF(BUILD_OSSIM_ISA AND EXISTS ${OSSIM_DEV_HOME}/ossim-isa)
add_subdirectory(${OSSIM_DEV_HOME}/ossim-isa ${CMAKE_CURRENT_BINARY_DIR}/ossim-isa)
ENDIF()
IF(BUILD_OSSIM_FPGA AND EXISTS ${OSSIM_DEV_HOME}/ossim-fpga)
add_subdirectory(${OSSIM_DEV_HOME}/ossim-fpga ${CMAKE_CURRENT_BINARY_DIR}/ossim-fpga)
ENDIF()
############################## Doxygen installation for current ossim core module ###########################################
FIND_PACKAGE(Doxygen)
......@@ -380,4 +384,5 @@ MESSAGE( STATUS "BUILD_RUNTIME_DIR = ${BUILD_RUNTIME_DIR}" )
MESSAGE( STATUS "BUILD_DSMG = ${BUILD_DSMG}" )
MESSAGE( STATUS "BUILD_MSP_PLUGIN = ${BUILD_MSP_PLUGIN}" )
MESSAGE( STATUS "BUILD_CSM_PLUGIN = ${BUILD_CSM_PLUGIN}" )
MESSAGE( STATUS "BUILD_OSSIM_FPGA = ${BUILD_OSSIM_FPGA}" )
MESSAGE( STATUS "Use OSSIM_BUILD_ADDITIONAL_DIRECTORIES to add other cmake builds." )
......@@ -125,6 +125,9 @@ fi
if [ -z $BUILD_OSSIM_ISA ] ; then
export BUILD_OSSIM_ISA=OFF
fi
if [ -z $BUILD_OSSIM_FPGA ] ; then
export BUILD_OSSIM_FPGA=OFF
fi
# Plugins:
if [ -z $BUILD_ATP_PLUGIN ]; then
......@@ -243,6 +246,7 @@ cmake -G "$CMAKE_G_ARG" "$INSERT_FORTIFY_TOOLCHAIN" \
-DBUILD_CSM_PLUGIN=$BUILD_CSM_PLUGIN \
-DBUILD_DSMG=$BUILD_DSMG \
-DBUILD_OSSIM_ISA=$BUILD_OSSIM_ISA \
-DBUILD_OSSIM_FPGA=$BUILD_OSSIM_FPGA \
-DBUILD_FFTW3_PLUGIN=$BUILD_FFTW3_PLUGIN \
-DBUILD_GEOPDF_PLUGIN=$BUILD_GEOPDF_PLUGIN \
-DBUILD_GDAL_PLUGIN=$BUILD_GDAL_PLUGIN \
......
ossim (2.6.2-2) UNRELEASED; urgency=medium
ossim (2.7.1-1~exp1) experimental; urgency=medium
* Team upload.
* New upstream release.
* Remove package name from lintian overrides.
* Refresh patches.
* Add lintian override for file-references-package-build-path.
-- Bas Couwenberg <sebastic@debian.org> Fri, 15 Mar 2019 15:34:44 +0100
-- Bas Couwenberg <sebastic@debian.org> Tue, 02 Apr 2019 07:31:49 +0200
ossim (2.6.2-1) unstable; urgency=medium
......
......@@ -5,3 +5,6 @@ no-symbols-control-file usr/lib/libossim.so.*
spelling-error-in-binary usr/lib/libossim.so.* PROCES PROCESS
spelling-error-in-binary usr/lib/libossim.so.* nam name
# Source uses __FILE__ macro
file-references-package-build-path *
......@@ -13,6 +13,7 @@ Description: Fix spelling errors.
* seperated -> separated
* avaliable -> available
Author: Bas Couwenberg <sebastic@debian.org>
Forwarded: https://github.com/ossimlabs/ossim/pull/216
--- a/src/base/ossimDatumFactory.inc
+++ b/src/base/ossimDatumFactory.inc
......@@ -60,7 +61,7 @@ Author: Bas Couwenberg <sebastic@debian.org>
}
--- a/src/imaging/ossimImageSourceSequencer.cpp
+++ b/src/imaging/ossimImageSourceSequencer.cpp
@@ -381,7 +381,7 @@ ossimRefPtr<ossimImageData> ossimImageSo
@@ -388,7 +388,7 @@ ossimRefPtr<ossimImageData> ossimImageSo
{
if(traceDebug())
{
......
......@@ -37,6 +37,7 @@ class ossimIpt;
class ossimIrect;
class ossimDpt;
class ossimGpt;
class ossimImageSource;
namespace NEWMAT
{
class Matrix;
......@@ -405,6 +406,9 @@ namespace ossim
OSSIM_DLL double defaultNull(ossimScalarType scalarType);
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType);
/** @brief @return true if scalar type is signed, false if not. */
OSSIM_DLL bool isInteger(ossimScalarType scalarType);
/** @brief @return true if scalar type is signed, false if not. */
OSSIM_DLL bool isSigned(ossimScalarType scalarType);
......@@ -683,6 +687,35 @@ namespace ossim
*/
OSSIM_DLL ossim_uint32 computeLevels(const ossimIrect& rect);
/**
* @brief Convenience method to get histogram bin infomation.
*
* Typically band 0 is used as input from the image source and it's assumed
* all bands have the same min, max, null values. In most cases the number
* of bins is (maxValue-minValue)+1. Exceptions being:
*
* OSSIM_SINT16:
* Min is adjusted for DTED and SRTM to be -32766 instead of -32767.
* This is because of DTED which has a null of -32767 and SRTM has
* a null of -32768.
* OSSIM_SINT32, OSSIM_UINT32, and all float data:
* Number of bins is defaulted to: 32768
*
* @param imageSource
* @param band Band to use from imageSource.
* @param numberOfBins Initialized by this.
* @param minValue Initialized by this.
* @param maxValue Initialized by this.
* @param nullValue Initialized by this.
* @return true on success, false on error.
*/
bool getBinInformation( const ossimImageSource* imageSource,
ossim_uint32 band,
ossim_uint32& numberOfBins,
ossim_float32& minValue,
ossim_float32& maxValue,
ossim_float32& nullValue );
} // End: namespace ossim
......
......@@ -279,40 +279,43 @@ enum ossimScalarType
{
OSSIM_SCALAR_UNKNOWN = 0,
OSSIM_UINT8 = 1, /**< 8 bit unsigned integer */
OSSIM_SINT8 = 2, /**< 8 bit signed integer */
OSSIM_UINT16 = 3, /**< 16 bit unsigned integer */
OSSIM_SINT16 = 4, /**< 16 bit signed integer */
OSSIM_UINT32 = 5, /**< 32 bit unsigned integer */
OSSIM_SINT32 = 6, /**< 32 bit signed integer */
OSSIM_UINT64 = 7, /**< 64 bit unsigned integer */
OSSIM_SINT64 = 8, /**< 64 bit signed integer */
OSSIM_FLOAT32 = 9, /**< 32 bit floating point */
OSSIM_FLOAT64 = 10, /**< 64 bit floating point */
OSSIM_CINT16 = 11, /**< 16 bit complex integer */
OSSIM_CINT32 = 12, /**< 32 bit complex integer */
OSSIM_CFLOAT32 = 13, /**< 32 bit complex floating point */
OSSIM_CFLOAT64 = 14, /**< 64 bit complex floating point */
OSSIM_NORMALIZED_FLOAT = 15, /**< 32 bit normalized floating point */
OSSIM_NORMALIZED_DOUBLE = 16, /**< 64 bit normalized floating point */
OSSIM_UINT11 = 17, /**< 16 bit unsigned integer (11 bits used) */
OSSIM_UINT12 = 18, /**< 16 bit unsigned integer (12 bits used) */
OSSIM_UINT13 = 19, /**< 16 bit unsigned integer (13 bits used) */
OSSIM_UINT14 = 20, /**< 16 bit unsigned integer (14 bits used) */
OSSIM_UINT15 = 21, /**< 16 bit unsigned integer (15 bits used) */
OSSIM_UINT9 = 2, /**< 16 bit unsigned integer (9 bits used) */
OSSIM_UINT10 = 3, /**< 16 bit unsigned integer (10 bits used) */
OSSIM_UINT11 = 4, /**< 16 bit unsigned integer (11 bits used) */
OSSIM_UINT12 = 5, /**< 16 bit unsigned integer (12 bits used) */
OSSIM_UINT13 = 6, /**< 16 bit unsigned integer (13 bits used) */
OSSIM_UINT14 = 7, /**< 16 bit unsigned integer (14 bits used) */
OSSIM_UINT15 = 8, /**< 16 bit unsigned integer (15 bits used) */
OSSIM_UINT16 = 9, /**< 16 bit unsigned integer */
OSSIM_UINT32 = 10, /**< 32 bit unsigned integer */
OSSIM_UINT64 = 11, /**< 64 bit unsigned integer */
OSSIM_SINT8 = 12, /**< 8 bit signed integer */
OSSIM_SINT16 = 13, /**< 16 bit signed integer */
OSSIM_SINT32 = 14, /**< 32 bit signed integer */
OSSIM_SINT64 = 15, /**< 64 bit signed integer */
OSSIM_FLOAT32 = 16, /**< 32 bit floating point */
OSSIM_FLOAT64 = 17, /**< 64 bit floating point */
OSSIM_CINT16 = 18, /**< 16 bit complex integer */
OSSIM_CINT32 = 19, /**< 32 bit complex integer */
OSSIM_CFLOAT32 = 20, /**< 32 bit complex floating point */
OSSIM_CFLOAT64 = 21, /**< 64 bit complex floating point */
OSSIM_NORMALIZED_FLOAT = 22, /**< 32 bit normalized floating point */
OSSIM_NORMALIZED_DOUBLE = 23, /**< 64 bit normalized floating point */
//---
// Below for backward compatibility only. Please use above enums in
// conjunction with null, min, max settings to determine bit depth.
//---
OSSIM_USHORT11 = 17, /**< 16 bit unsigned integer (11 bits used) */
OSSIM_USHORT12 = 18, /**< 16 bit unsigned integer (12 bits used) */
OSSIM_USHORT13 = 19, /**< 16 bit unsigned integer (13 bits used) */
OSSIM_USHORT14 = 20, /**< 16 bit unsigned integer (14 bits used) */
OSSIM_USHORT15 = 21, /**< 16 bit unsigned integer (15 bits used) */
OSSIM_UCHAR = 1, /**< 8 bit unsigned iteger */
OSSIM_USHORT16 = 3, /**< 16 bit unsigned iteger */
OSSIM_SSHORT16 = 4, /**< 16 bit signed integer */
OSSIM_FLOAT = 9, /**< 32 bit floating point */
OSSIM_DOUBLE = 10, /**< 64 bit floating point */
OSSIM_UCHAR = 1, /**< 8 bit unsigned integer */
OSSIM_USHORT11 = 4, /**< 16 bit unsigned integer (11 bits used) */
OSSIM_USHORT12 = 5, /**< 16 bit unsigned integer (12 bits used) */
OSSIM_USHORT13 = 6, /**< 16 bit unsigned integer (13 bits used) */
OSSIM_USHORT14 = 7, /**< 16 bit unsigned integer (14 bits used) */
OSSIM_USHORT15 = 8, /**< 16 bit unsigned integer (15 bits used) */
OSSIM_USHORT16 = 9, /**< 16 bit unsigned integer */
OSSIM_SSHORT16 = 13, /**< 16 bit signed integer */
OSSIM_FLOAT = 16, /**< 32 bit floating point */
OSSIM_DOUBLE = 17 /**< 64 bit floating point */
};
/*
......@@ -487,46 +490,35 @@ enum ossimCompareType
#endif
//---
// Integer nan kept for ossimIpt.
// This should be the most negative int: -2147483648
// Integer nan kept for ossimIpt and templated ossim::Pt
// This should be the most negative int.
// 32 bit: -2147483648
// 64 bit: -9223372036854775808
//---
#define OSSIM_INT_NAN ((ossim_sint32)0x80000000)
#define OSSIM_INT32_NAN ((ossim_sint32)0x80000000)
#define OSSIM_INT64_NAN ((ossim_sint64)0x8000000000000000)
// UCHAR for backwards compatibility. */
#define OSSIM_DEFAULT_NULL_PIX_UCHAR ((ossim_uint8)0)
#define OSSIM_DEFAULT_MIN_PIX_UCHAR ((ossim_uint8)1)
#define OSSIM_DEFAULT_MAX_PIX_UCHAR ((ossim_uint8)255)
#define OSSIM_DEFAULT_NULL_PIX_UINT8 ((ossim_uint8)0)
#define OSSIM_DEFAULT_MIN_PIX_UINT8 ((ossim_uint8)1)
#define OSSIM_DEFAULT_MAX_PIX_UINT8 ((ossim_uint8)255)
#define OSSIM_DEFAULT_NULL_PIX_SINT8 ((ossim_sint8)0x80)
#define OSSIM_DEFAULT_MIN_PIX_SINT8 ((ossim_sint8)0x81)
#define OSSIM_DEFAULT_MAX_PIX_SINT8 ((ossim_sint8)0x7F)
#define OSSIM_DEFAULT_NULL_PIX_SINT16 ((ossim_sint16)0x8000)
#define OSSIM_DEFAULT_MIN_PIX_SINT16 ((ossim_sint16)0x8001)
#define OSSIM_DEFAULT_MAX_PIX_SINT16 ((ossim_sint16)0x7FFF)
#define OSSIM_DEFAULT_NULL_PIX_UINT16 ((ossim_uint16)0)
#define OSSIM_DEFAULT_MIN_PIX_UINT16 ((ossim_uint16)1)
#define OSSIM_DEFAULT_MAX_PIX_UINT16 ((ossim_uint16)0xFFFF)
#define OSSIM_DEFAULT_NULL_PIX_SINT32 ((ossim_sint32)0x80000000)
#define OSSIM_DEFAULT_MIN_PIX_SINT32 ((ossim_sint32)0x80000001)
#define OSSIM_DEFAULT_MAX_PIX_SINT32 ((ossim_sint32)0x7FFFFFFF)
#define OSSIM_DEFAULT_NULL_PIX_UINT32 ((ossim_uint32)0)
#define OSSIM_DEFAULT_MIN_PIX_UINT32 ((ossim_uint32)1)
#define OSSIM_DEFAULT_MAX_PIX_UINT32 ((ossim_uint32)0xFFFFFFFF)
#define OSSIM_DEFAULT_NULL_PIX_UINT8 ((ossim_uint8)0)
#define OSSIM_DEFAULT_MIN_PIX_UINT8 ((ossim_uint8)1)
#define OSSIM_DEFAULT_MAX_PIX_UINT8 ((ossim_uint8)255)
#define OSSIM_DEFAULT_NULL_PIX_SINT64 ((ossim_sint32)0x8000000000000000)
#define OSSIM_DEFAULT_MIN_PIX_SINT64 ((ossim_sint32)0x8000000000000001)
#define OSSIM_DEFAULT_MAX_PIX_SINT64 ((ossim_sint32)0x7FFFFFFFFFFFFFFF)
#define OSSIM_DEFAULT_NULL_PIX_UINT9 ((ossim_uint16)0)
#define OSSIM_DEFAULT_MIN_PIX_UINT9 ((ossim_uint16)1)
#define OSSIM_DEFAULT_MAX_PIX_UINT9 ((ossim_uint16)0x01FF)
#define OSSIM_DEFAULT_NULL_PIX_UINT64 ((ossim_uint32)0)
#define OSSIM_DEFAULT_MIN_PIX_UINT64 ((ossim_uint32)1)
#define OSSIM_DEFAULT_MAX_PIX_UINT64 ((ossim_uint32)0xFFFFFFFFFFFFFFFF)
#define OSSIM_DEFAULT_NULL_PIX_UINT10 ((ossim_uint16)0)
#define OSSIM_DEFAULT_MIN_PIX_UINT10 ((ossim_uint16)1)
#define OSSIM_DEFAULT_MAX_PIX_UINT10 ((ossim_uint16)0x03FF)
#define OSSIM_DEFAULT_NULL_PIX_UINT11 ((ossim_uint16)0)
#define OSSIM_DEFAULT_MIN_PIX_UINT11 ((ossim_uint16)1)
......@@ -548,6 +540,30 @@ enum ossimCompareType
#define OSSIM_DEFAULT_MIN_PIX_UINT15 ((ossim_uint16)1)
#define OSSIM_DEFAULT_MAX_PIX_UINT15 ((ossim_uint16)0x7FFF)
#define OSSIM_DEFAULT_NULL_PIX_SINT16 ((ossim_sint16)0x8000)
#define OSSIM_DEFAULT_MIN_PIX_SINT16 ((ossim_sint16)0x8001)
#define OSSIM_DEFAULT_MAX_PIX_SINT16 ((ossim_sint16)0x7FFF)
#define OSSIM_DEFAULT_NULL_PIX_UINT16 ((ossim_uint16)0)
#define OSSIM_DEFAULT_MIN_PIX_UINT16 ((ossim_uint16)1)
#define OSSIM_DEFAULT_MAX_PIX_UINT16 ((ossim_uint16)0xFFFF)
#define OSSIM_DEFAULT_NULL_PIX_SINT32 ((ossim_sint32)0x80000000)
#define OSSIM_DEFAULT_MIN_PIX_SINT32 ((ossim_sint32)0x80000001)
#define OSSIM_DEFAULT_MAX_PIX_SINT32 ((ossim_sint32)0x7FFFFFFF)
#define OSSIM_DEFAULT_NULL_PIX_UINT32 ((ossim_uint32)0)
#define OSSIM_DEFAULT_MIN_PIX_UINT32 ((ossim_uint32)1)
#define OSSIM_DEFAULT_MAX_PIX_UINT32 ((ossim_uint32)0xFFFFFFFF)
#define OSSIM_DEFAULT_NULL_PIX_SINT64 ((ossim_sint64)0x8000000000000000)
#define OSSIM_DEFAULT_MIN_PIX_SINT64 ((ossim_sint64)0x8000000000000001)
#define OSSIM_DEFAULT_MAX_PIX_SINT64 ((ossim_sint64)0x7FFFFFFFFFFFFFFF)
#define OSSIM_DEFAULT_NULL_PIX_UINT64 ((ossim_uint64)0)
#define OSSIM_DEFAULT_MIN_PIX_UINT64 ((ossim_uint64)1)
#define OSSIM_DEFAULT_MAX_PIX_UINT64 ((ossim_uint64)0xFFFFFFFFFFFFFFFF)
#define OSSIM_DEFAULT_NULL_PIX_FLOAT ((ossim_float32)-1.0/FLT_EPSILON)
#define OSSIM_DEFAULT_MIN_PIX_FLOAT ((ossim_float32)((-1.0/FLT_EPSILON) + 1))
#define OSSIM_DEFAULT_MAX_PIX_FLOAT ((ossim_float32)((1.0/FLT_EPSILON)))
......
//*******************************************************************
//---
//
// License: See top level LICENSE.txt file.
// License: MIT
//
// See top level LICENSE.txt file for more.
//
// Author: Ken Melero
// Orginally developed by:
......@@ -14,12 +16,13 @@
// segments of some value axis, along with a corresponding array of
// frequency m_counts for each of these buckets.
//
//********************************************************************
// $Id: ossimHistogram.h 19799 2011-06-30 18:41:26Z gpotts $
//---
// $Id$
//
#ifndef ossimHistogram_HEADER
#define ossimHistogram_HEADER
#define ossimHistogram_HEADER 1
#include <ossim/base/ossimConstants.h>
#include <ossim/base/ossimObject.h>
#include <ossim/base/ossimString.h>
#include <ossim/base/ossimFilename.h>
......@@ -38,7 +41,7 @@ class OSSIMDLLEXPORT ossimHistogram : public ossimObject
float * m_vals; // histogram x array
// (value = midpoint of each bucket)
float * m_counts; // histogram y array ie. count[i] is
ossim_int64* m_counts; // histogram y array ie. count[i] is
// the number of pixels with value within range
// of bucket i
......@@ -48,8 +51,21 @@ class OSSIMDLLEXPORT ossimHistogram : public ossimObject
float m_vmin, m_vmax; // Maximum and minimum values on plot
mutable float m_mean; // Mean value of the distribution
mutable float m_standardDev; //
protected:
//---
// For counting nulls only.
// Nulls counted separately, i.e. not stored in a m_counts bin, as they are
// not used in any computations.
//---
ossim_float64 m_nullValue;
ossim_uint64 m_nullCount;
//---
// This was added to determine if pixel values are integers.
// If so save the state in this form for each bin: "(pixelValue,count)"
// else: "(binIndex,count)"
//---
ossimScalarType m_scalarType;
class ossimProprietaryHeaderInformation
{
......@@ -83,8 +99,8 @@ class OSSIMDLLEXPORT ossimHistogram : public ossimObject
};
// Constructors
ossimHistogram();
ossimHistogram(int xres, float min, float max);
ossimHistogram(float*, float*, int);
ossimHistogram(int xres, float min, float max, float nullValue, ossimScalarType scalar);
// ossimHistogram(float*, float*, int);
ossimHistogram(const ossimHistogram& his); // Copy constructor
ossimHistogram(const ossimHistogram*, float width); // Resampling constructor
......@@ -102,6 +118,8 @@ class OSSIMDLLEXPORT ossimHistogram : public ossimObject
//Suppress non-peak values.
ossimHistogram* NonMaximumSupress(int radius = 1, bool cyclic = false);
void create(int xres, float val1, float val2);
void create(int bins, float minValue, float maxValue,
ossim_float64 nullValue, ossimScalarType scalar);
// Attribute accessors
void UpCount(float newval, float occurences=1);
......@@ -131,13 +149,13 @@ class OSSIMDLLEXPORT ossimHistogram : public ossimObject
return m_vals;
}
float * GetCounts()
ossim_int64 * GetCounts()
{
m_statsConsistent = 0; // m_counts might change.
return m_counts;
}
const float * GetCounts()const
const ossim_int64 * GetCounts()const
{
//m_statsConsistent = 0; // m_counts might change.
return m_counts;
......@@ -151,13 +169,13 @@ class OSSIMDLLEXPORT ossimHistogram : public ossimObject
float * GetMinValAddr()
{ return m_vals+GetIndex(GetMinVal()); }
float * GetMinCountAddr()
ossim_int64 * GetMinCountAddr()
{ return m_counts+GetIndex(GetMinVal()); }
const float * GetMinValAddr()const
{ return m_vals+GetIndex(GetMinVal()); }
const float * GetMinCountAddr()const
const ossim_int64 * GetMinCountAddr()const
{ return m_counts+GetIndex(GetMinVal()); }
float ComputeArea(float low, float high)const;// bounded area
......@@ -203,6 +221,21 @@ class OSSIMDLLEXPORT ossimHistogram : public ossimObject
const char* prefix=0);
virtual bool saveState(ossimRefPtr<ossimXmlNode> xmlNode)const;
virtual bool loadState(const ossimRefPtr<ossimXmlNode> xmlNode);
ossimScalarType getScalarType() const;
void setScalarType( ossimScalarType scalar );
const ossim_float64& getNullValue() const;
void setNullValue(const ossim_float64& nullValue);
const ossim_uint64& getNullCount() const;
void upNullCount( const ossim_uint64& count );
// Inlined for pixel loops.
void upNullCount()
{
++m_nullCount;
}
TYPE_DATA
};
......
//*******************************************************************
//
// License: See top level LICENSE.txt file.
// License: MIT
//
// See top level LICENSE.txt file.
//
// Author: Garrett Potts (gpotts@imagelinks.com)
//
......@@ -11,6 +13,7 @@
#ifndef ossimMultiBandHistogram_HEADER
#define ossimMultiBandHistogram_HEADER
#include <vector>
#include <ossim/base/ossimConstants.h>
#include <ossim/base/ossimFilename.h>
#include <ossim/base/ossimHistogram.h>
#include <ossim/base/ossimRefPtr.h>
......@@ -28,14 +31,18 @@ public:
ossimMultiBandHistogram(ossim_int32 numberOfBands,
ossim_int32 numberOfBuckets,
float minValue,
float maxValue);
float maxValue,
float nullValue,
ossimScalarType scalar);
void create(const ossimImageSource* input);
void create(ossim_int32 numberOfBands,
ossim_int32 numberOfBuckets,
float minValue,
float maxValue);
float maxValue,
float nullValue,
ossimScalarType scalar);
ossim_uint32 getNumberOfBands() const;
......
//*******************************************************************
//---
//
// License: See top level LICENSE.txt file.
// License: MIT
//
// Author: David Burken
//
......@@ -27,8 +27,8 @@
// all bands. This really only makes sense if all bands are the same
// but is provided for convenience.
//
//*************************************************************************
// $Id: ossimHistogramRemapper.h 22746 2014-04-23 16:16:28Z gpotts $
//---
// $Id$
#ifndef ossimHistogramRemapper_HEADER
#define ossimHistogramRemapper_HEADER 1
......@@ -57,7 +57,7 @@ public:
virtual ossimString getLongName() const;
virtual ossimString getShortName() const;
virtual ossimRefPtr<ossimImageData> getTile(const ossimIrect& tile_rect,
virtual ossimRefPtr<ossimImageData> getTile(const ossimIrect& tileRect,
ossim_uint32 resLevel=0);
virtual void initialize();
......@@ -69,29 +69,22 @@ public:
void reset();
/**
* Sets remap mode to mode. If rebuildTableFlag is true, the table will
* be built at this time; else just the dirty flag is set.
*
* @brief Sets remap mode to mode.
* @param mode The stretch mode.
*
* @param rebuildTableFlag If the true the table will be rebuilt; else,
* just the dirty flag will be set.
*/
void setStretchMode(StretchMode mode, bool rebuildTableFlag=false);
void setStretchMode(StretchMode mode);
// For backwards compatibility only...
void setStretchMode(StretchMode mode, bool rebuildTableFlag);
void setStretchModeAsString(const ossimString& mode,
bool rebuildTableFlag);
/**
* Stretch mode values can be linear_one_piece, linear_1std_from_mean,
* @brief Stretch mode values can be linear_one_piece, linear_1std_from_mean,
* linear_2std_from_mean, linear_3std_from_mean, linear_auto_min_max,
* If rebuildTableFlag is true, the table will
* be built at this time; else just the dirty flag is set.
*
* @param mode The stretch mode.
*
* @param rebuildTableFlag If the true the table will be rebuilt; else,
* just the dirty flag will be set.
*/
void setStretchModeAsString(const ossimString& mode,
bool rebuildTableFlag=false);
void setStretchModeAsString(const ossimString& mode);
/**
* Returns the current enumerated node.
......@@ -219,21 +212,6 @@ public:
void setHighClipPoint(const ossim_float64& clip,
ossim_uint32 zero_based_band);
/**
* Sets the mid clip point.
*
* Notes on clip points:
* - If input chip source is mutiband this will set all band to same
* percentage of clip.
*/
void setMidPoint(const ossim_float64& value);
/**
* Sets the mid clip point for band.
*/
void setMidPoint(const ossim_float64& value,
ossim_uint32 zero_based_band);
/**
* Sets the min output value.
*
......@@ -344,27 +322,6 @@ public:
*/
ossim_float64 getHighClipPoint() const;
/**
* Returns the mid point for band
*
* Will return OSSIM_DBL_NAN if:
* - Band is out of range.
* - Connection is not complete.
* - Histogram has not been set.
*/
ossim_float64 getMidPoint(ossim_uint32 zero_based_band) const;
/**
* Returns the mid clip point which is the average of all bands.
*
* Will return OSSIM_DBL_NAN if:
* - Band is out of range.
* - Connection is not complete.
* - Histogram has not been set.
*/
ossim_float64 getMidPoint() const;
/**
* Returns the minimum output value for band.
*
......@@ -494,18 +451,18 @@ private:
void buildTable();
void buildLinearTable();
/**
* @brief All of these build methods, set the clip points, then call
* the buildLinearTable method.
*/
void buildLinearTableStdFromMean();
void buildAutoLinearMinMaxTable();
void buildAutoLinearPercentileTable();
template <class T> void buildLinearTable(T dummy);
template <class T> void buildAutoLinearMinMaxTableTemplate(T dummy);
template <class T> void buildAutoLinearPercentileTableTemplate(T dummy);
/**
* Sets clip points using mean and standard deviations then calls
* buildLinearTable method.
*/
void buildLinearTableStdFromMean();
/**
* Uses getNumberOfInputBands() to determine BANDS then calls
* initializeClips(BANDS)
......@@ -559,17 +516,11 @@ private:
*/
void makeClean();
template <class T> void applyLinearStretch(
T dummy,
ossimRefPtr<ossimImageData>& inputTile);
StretchMode theStretchMode;
bool theDirtyFlag;
mutable ossimRefPtr<ossimMultiResLevelHistogram> theHistogram;
vector<ossim_float64> theNormalizedLowClipPoint;
vector<ossim_float64> theNormalizedHighClipPoint;
vector<ossim_float64> theMidPoint;
vector<ossim_float64> theMinOutputValue;
vector<ossim_float64> theMaxOutputValue;
......
......@@ -9,13 +9,10 @@
// Description: Container class for a tile of image data.
//
//*******************************************************************
// $Id: ossimImageData.h 23371 2015-06-12 13:08:34Z gpotts $
// $Id$
#ifndef ossimImageData_HEADER
#define ossimImageData_HEADER 1
#include <vector>
#include <iosfwd> /* for ostream */
#include <ossim/base/ossimCommon.h>
#include <ossim/base/ossimRectilinearDataObject.h>
#include <ossim/base/ossimIrect.h>
......@@ -23,6 +20,10 @@
#include <ossim/base/ossimRefPtr.h>
#include <ossim/base/ossimMultiResLevelHistogram.h>
#include <vector>
#include <iosfwd> /* for ostream */
class ossimMultiBandHistogram;
class OSSIMDLLEXPORT ossimImageData : public ossimRectilinearDataObject
......@@ -371,7 +372,16 @@ public:
ossim_float64 meanValue,
ossim_uint32 bandNumber = 0) const;
virtual void populateHistogram(ossimRefPtr<ossimMultiBandHistogram> histo);
/**
* @brief Populates the histogram with data from this tile.
* @param histo Populated by this.
* @param clip_rect Should be the rectangle of valid data so as to not
* count pixels outside of image area on edge tiles. This will be clipped
* to the tile rectangle so callers can simply pass the full image rectangle
* in.
*/
virtual void populateHistogram(ossimRefPtr<ossimMultiBandHistogram> histo,
const ossimIrect& clip_rect);
virtual void setHistogram(ossimRefPtr<ossimMultiResLevelHistogram> histo);
ossimRefPtr<ossimMultiResLevelHistogram> getHistogram();
......@@ -644,12 +654,6 @@ public:
ossim_float32* buf);
virtual bool isWithin(ossim_int32 x, ossim_int32 y);
/** Sets band of specified pixel to color */
virtual void setValue(ossim_int32 x, ossim_int32 y,
ossim_float64 color, ossim_uint32 band);
/** Sets all bands of specified pixel to color */
virtual void setValue(ossim_int32 x, ossim_int32 y, ossim_float64 color);
virtual void loadBand(const void* src,
......@@ -696,6 +700,23 @@ public:
virtual void loadTileFrom1Band(const void* src,
const ossimIrect& src_rect);
/**
* @brief Loads a tile from a tile.
* This assumes last band of src is an alpha channel.
*
* Written for compressed data where alpha channel may have been compressed
* lossy, e.g. 0s flipped to 1s.
*
* Alpha is applied in the following manner:
* if alpha pixel is less than half of bit depth the input pixel is assumed
* null; else, valid. If alpha is valid and input is null, output pixel is
* set to min pixel value.
*/
void loadTileFromBsqAlpha(const void* src,
const ossimIrect& src_rect,
const ossimIrect& clip_rect);
/**
* Specialized to load a tile from a short (16 bit scalar type) buffer.
* Performs byte swapping if swap_bytes is set to true.
......@@ -922,14 +943,16 @@ public:
bool getIndexedFlag() const;
/**
* Returns the percentage (0-100) of data buffer containing non-null (valid) entries.
* Undefined until validate() is called.
* @brief Returns the percentage (0-100) of data buffer containing non-null
* (valid) entries. Undefined until validate() is called.
*/
ossim_float64 percentFull() const { return m_percentFull; }
ossim_float64 percentFull() const;
virtual bool isEqualTo(const ossimDataObject& rhs,
bool deepTest=false)const;
/**
* @brief External means to set percent full.
* @param percent full.
*/
void setPercentFull( const ossim_float64& percentFull );
virtual bool saveState(ossimKeywordlist& kwl, const char* prefix=0)const;
virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=0);
......@@ -1138,6 +1161,11 @@ protected:
const ossimIrect& src_rect,
const ossimIrect& clip_rect);
template <class T> void loadTileFromBsqAlphaTemplate(T, // dummy template variable
const void* src,
const ossimIrect& src_rect,
const ossimIrect& clip_rect);
template <class T> void unloadTileToBipTemplate(T, // dummy template variable
void* dest,
const ossimIrect& dest_rect,
......@@ -1203,6 +1231,8 @@ protected:
*/
virtual void initializeNullDefault();
virtual bool isEqualTo(const ossimDataObject& rhs,
bool deepTest=false)const;
bool hasSameDimensionsAs(ossimImageData* data)const
{
......
......@@ -78,9 +78,10 @@ public:
protected:
virtual ~ossimImageHistogramSource();
void getBinInformation(ossim_uint32& numberOfBins,
ossim_float64& minValue,
ossim_float64& maxValue,
bool getBinInformation(ossim_uint32& numberOfBins,
ossim_float32& minValue,
ossim_float32& maxValue,
ossim_float32& nullValue,
ossim_uint32 band)const;
virtual void computeNormalModeHistogram();
virtual void computeFastModeHistogram();
......
......@@ -24,6 +24,7 @@
#include <ossim/base/ossimString.h>
#include <ossim/base/ossimTrace.h>
#include <ossim/base/Thread.h>
#include <ossim/imaging/ossimImageSource.h>
#include <ossim/matrix/newmat.h>
#include <ctime>
#include <sstream>
......@@ -367,6 +368,30 @@ ossim_uint32 ossim::scalarSizeInBytes(ossimScalarType scalarType)
return 1;
}
bool ossim::isInteger(ossimScalarType scalarType)
{
bool result = true;
switch(scalarType)
{
case OSSIM_FLOAT32:
case OSSIM_FLOAT64:
case OSSIM_CFLOAT32:
case OSSIM_CFLOAT64:
case OSSIM_NORMALIZED_FLOAT:
case OSSIM_NORMALIZED_DOUBLE:
case OSSIM_SCALAR_UNKNOWN:
{
result = false;
break;
}
default:
{
break;
}
}
return result;
}
bool ossim::isSigned(ossimScalarType scalarType)
{
bool result = false;
......@@ -1282,3 +1307,137 @@ ossim_uint32 ossim::computeLevels(const ossimIrect& rect)
return result;
}
bool ossim::getBinInformation( const ossimImageSource* imageSource,
ossim_uint32 band,
ossim_uint32& numberOfBins,
ossim_float32& minValue,
ossim_float32& maxValue,
ossim_float32& nullValue )
{
bool result = false;
if ( imageSource )
{
if ( band < imageSource->getNumberOfOutputBands() )
{
result = true;
numberOfBins = 0;
minValue = (ossim_float32)imageSource->getMinPixelValue(band);
maxValue = (ossim_float32)imageSource->getMaxPixelValue(band);
nullValue = (ossim_float32)imageSource->getNullPixelValue(band);
switch( imageSource->getOutputScalarType() )
{
case OSSIM_UINT8:
{
minValue = OSSIM_DEFAULT_MIN_PIX_UINT8;
maxValue = OSSIM_DEFAULT_MAX_PIX_UINT8;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT8;
break;
}
case OSSIM_UINT9:
{
minValue = OSSIM_DEFAULT_MIN_PIX_UINT9;
maxValue = OSSIM_DEFAULT_MAX_PIX_UINT9;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT9;
break;
}
case OSSIM_UINT10:
{
minValue = OSSIM_DEFAULT_MIN_PIX_UINT10;
maxValue = OSSIM_DEFAULT_MAX_PIX_UINT10;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT10;
break;
}
case OSSIM_UINT11:
{
minValue = OSSIM_DEFAULT_MIN_PIX_UINT11;
maxValue = OSSIM_DEFAULT_MAX_PIX_UINT11;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT11;
break;
}
case OSSIM_UINT12:
{
minValue = OSSIM_DEFAULT_MIN_PIX_UINT12;
maxValue = OSSIM_DEFAULT_MAX_PIX_UINT12;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT12;
break;
}
case OSSIM_UINT13:
{
minValue = OSSIM_DEFAULT_MIN_PIX_UINT13;
maxValue = OSSIM_DEFAULT_MAX_PIX_UINT13;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT13;
break;
}
case OSSIM_UINT14:
{
minValue = OSSIM_DEFAULT_MIN_PIX_UINT14;
maxValue = OSSIM_DEFAULT_MAX_PIX_UINT14;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT14;
break;
}
case OSSIM_UINT15:
{
minValue = OSSIM_DEFAULT_MIN_PIX_UINT15;
maxValue = OSSIM_DEFAULT_MAX_PIX_UINT15;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT15;
break;
}
case OSSIM_UINT16:
{
minValue = OSSIM_DEFAULT_MIN_PIX_UINT16;
maxValue = OSSIM_DEFAULT_MAX_PIX_UINT16;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT16;
break;
}
case OSSIM_SINT16:
{
//---
// Special case to handle DTED which has a null of -32767 and SRTM
// which has null of -32768. Set the min to -32766 which is OK for
// both types. Basically we don't want to count the null values as
// a valid pixel. drb - 04 Feb. 2016
//
// NOTE: OSSIM_DEFAULT_MIN_PIX_SINT16 = -32767
//---
minValue = OSSIM_DEFAULT_MIN_PIX_SINT16 + 1;
maxValue = OSSIM_DEFAULT_MAX_PIX_SINT16;
numberOfBins = (maxValue-minValue) + 1;
break;
}
case OSSIM_SINT32:
case OSSIM_UINT32:
{
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT16+1;
break;
}
case OSSIM_FLOAT32:
case OSSIM_FLOAT64:
{
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT16+1;
break;
}
case OSSIM_NORMALIZED_FLOAT:
case OSSIM_NORMALIZED_DOUBLE:
{
minValue = 0;
maxValue = 1.0;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT16+1;
break;
}
default:
{
if(traceDebug())
{
ossimNotify(ossimNotifyLevel_WARN)
<< "Unsupported scalar type in ossim::getBinInformation()" << endl;
}
result = false;
break;
}
}
}
}
return result;
}
This diff is collapsed.
......@@ -38,11 +38,13 @@ ossimMultiBandHistogram::ossimMultiBandHistogram(const ossimMultiBandHistogram&
ossimMultiBandHistogram::ossimMultiBandHistogram(ossim_int32 numberOfBands,
ossim_int32 numberOfBuckets,
float minValue,
float maxValue)
float maxValue,
float nullValue,
ossimScalarType scalar)
{
if(numberOfBands > 0)
{
create(numberOfBands, numberOfBuckets, minValue, maxValue);
create(numberOfBands, numberOfBuckets, minValue, maxValue, nullValue, scalar);
}
}
......@@ -50,108 +52,27 @@ void ossimMultiBandHistogram::create(const ossimImageSource* input)
{
if (input)
{
ossim_uint32 bands = input->getNumberOfOutputBands();;
ossim_uint32 numberOfBins = 0;
ossim_float64 minValue = 0.0;
ossim_float64 maxValue = 0.0;
ossim_float32 minValue = 0.0;
ossim_float32 maxValue = 0.0;
ossim_float32 nullValue = 0.0;
switch(input->getOutputScalarType())
if ( ossim::getBinInformation( input, 0, numberOfBins,
minValue, maxValue, nullValue ) )
{
case OSSIM_UINT8:
{
minValue = 0;
maxValue = OSSIM_DEFAULT_MAX_PIX_UCHAR;
numberOfBins = 256;
break;
}
case OSSIM_USHORT11:
{
minValue = 0;
maxValue = OSSIM_DEFAULT_MAX_PIX_UINT11;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT11 + 1;
break;
}
case OSSIM_USHORT12:
{
minValue = 0;
maxValue = OSSIM_DEFAULT_MAX_PIX_UINT12;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT12 + 1;
break;
}
case OSSIM_USHORT13:
{
minValue = 0;
maxValue = OSSIM_DEFAULT_MAX_PIX_UINT13;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT13 + 1;
break;
}
case OSSIM_USHORT14:
{
minValue = 0;
maxValue = OSSIM_DEFAULT_MAX_PIX_UINT14;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT14 + 1;
break;
}
case OSSIM_USHORT15:
{
minValue = 0;
maxValue = OSSIM_DEFAULT_MAX_PIX_UINT15;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT15 + 1;
break;
create( input->getNumberOfOutputBands(),
numberOfBins, minValue, maxValue, nullValue,
input->getOutputScalarType() );
}
case OSSIM_UINT16:
case OSSIM_UINT32:
{
minValue = 0;
maxValue = OSSIM_DEFAULT_MAX_PIX_UINT16;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT16 + 1;
break;
}
case OSSIM_SINT16:
case OSSIM_SINT32:
case OSSIM_FLOAT32:
case OSSIM_FLOAT64:
{
//---
// Special case to handle DTED which has a null of -32767 and SRTM
// which has null of -32768. Set the min to -32766 which is OK for
// both types. Basically we don't want to count the null values as
// a valid pixel. drb - 04 Feb. 2016
//
// NOTE: OSSIM_DEFAULT_MIN_PIX_SINT16 = -32767
//---
minValue = OSSIM_DEFAULT_MIN_PIX_SINT16+1;
maxValue = OSSIM_DEFAULT_MAX_PIX_SINT16;
numberOfBins = (OSSIM_DEFAULT_MAX_PIX_SINT16-OSSIM_DEFAULT_MIN_PIX_SINT16);
break;
}
case OSSIM_NORMALIZED_FLOAT:
case OSSIM_NORMALIZED_DOUBLE:
{
minValue = 0;
maxValue = 1.0;
numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT16+1;
break;
}
default:
{
ossimNotify(ossimNotifyLevel_WARN)
<< "Unsupported scalar type in ossimMultiBandHistogram::create()"
<< std::endl;
return;
}
} // switch(input->getOutputScalarType())
create(bands, numberOfBins, minValue, maxValue);
} // if (input)
}
void ossimMultiBandHistogram::create(ossim_int32 numberOfBands,
ossim_int32 numberOfBuckets,
float minValue,
float maxValue)
float maxValue,
float nullValue,
ossimScalarType scalar)
{
// Make sure we clear our internal lists before we start.
deleteHistograms();
......@@ -164,7 +85,9 @@ void ossimMultiBandHistogram::create(ossim_int32 numberOfBands,
{
theHistogramList.push_back( new ossimHistogram(numberOfBuckets,
minValue,
maxValue));
maxValue,
nullValue,
scalar) );
}
}
}
......
......@@ -405,7 +405,7 @@ void ossimHistogramEqualization::initializeLuts()
theInverseLut.push_back(new double[numberOfIndices]);
// let's grab the counts array
const float* histoCounts = h->GetCounts();
const ossim_int64* histoCounts = h->GetCounts();
// double maxIntensity = h2->GetMaxVal();
double maxIntensity = h2->GetRangeMax();
......
This diff is collapsed.