OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Classes | Typedefs | Enumerations | Functions
ossim Namespace Reference

This code was derived from https://gist.github.com/mshockwave. More...

Classes

class  AwsStreamFactory
 
class  Barrier
 Barrier is a class used to block threads so we can synchronize and entry point. More...
 
class  Block
 This is a very simple block interface. More...
 
class  BlockBufInfo
 This is a utility class used by the BlockStreamBuffer. More...
 
class  BlockIStream
 Allows one to adapt any input stream to be block aligned for any read it will internally read overlapping blocks filling the request. More...
 
class  BlockStreamBuffer
 This is the BlockStreamBuffer class and derives from stream buf. More...
 
class  CurlHeaderCache
 
class  CurlHeaderCacheNode
 
class  CurlIStream
 
class  CurlStreamBuffer
 
class  CurlStreamDefaults
 
class  CurlStreamFactory
 
class  FactoryListBase
 
class  GroundControlPoint
 Class for representing a ground control point. More...
 
class  Image
 Class representing an Image as used by ossim-msp services. More...
 
class  ImageHandlerStateFactory
 
class  ImageHandlerStateRegistry
 This is the state registry for all image handler states that will be supported. More...
 
class  IntFloatBitCoercion
 Class lets us see bit patterns of floats. More...
 
class  JsonConfig
 Base class for maintaining parameters affecting the runtime configuration of OSSIM executables. More...
 
class  JsonInterface
 Pure virtual interface for classes implementing JSON-based load/save state. More...
 
class  JsonParam
 Represents a single configuration parameter. More...
 
class  PhotoBlock
 Class for representing MSP PhotoBlock. More...
 
class  Quaternion
 A quaternion class. More...
 
class  RWLock
 Code was derived from https://gist.github.com/mshockwave. More...
 
class  S3HeaderCache
 
class  S3HeaderCacheNode
 
class  S3IStream
 
class  S3StreamBuffer
 
class  S3StreamDefaults
 
class  ScopeReadLock
 
class  ScopeWriteLock
 
class  State
 This is the base for all state objects. More...
 
class  StateFactoryBase
 
class  StreamFactory
 
class  StreamFactoryBase
 
class  StreamFactoryRegistry
 This is a generic stream registry. More...
 
class  Thread
 Thread is an abstract class. More...
 
class  TiePoint
 Class for representing a single tiepoint on two or more images. More...
 

Typedefs

typedef std::basic_istream< char > istream
 Base class for char input streams. More...
 
typedef std::basic_ostream< char > ostream
 Base class for char output streams. More...
 
typedef std::basic_iostream< char > iostream
 Base class for char mixed input and output streams. More...
 
typedef std::basic_stringbuf< char > stringbuf
 Class for char memory buffers. More...
 
typedef std::basic_istringstream< char > istringstream
 Class for char input memory streams. More...
 
typedef std::basic_ostringstream< char > ostringstream
 Class for char output memory streams. More...
 
typedef std::basic_stringstream< char > stringstream
 Class for char mixed input and output memory streams. More...
 
typedef std::basic_filebuf< char > filebuf
 Class for char file buffers. More...
 
typedef std::basic_ifstream< char > ifstream
 Class for char input file streams. More...
 
typedef std::basic_ofstream< char > ofstream
 Class for char output file streams. More...
 
typedef std::basic_fstream< char > fstream
 Class for char mixed input and output file streams. More...
 
typedef std::vector< std::shared_ptr< GroundControlPoint > > GcpList
 
typedef std::vector< std::shared_ptr< Image > > ImageList
 
typedef std::vector< std::shared_ptr< TiePoint > > TiePointList
 

Enumerations

enum  {
  OPIXEL_IS_AREA = 1, OPIXEL_IS_POINT = 2, OTIFFTAG_SUBFILETYPE = 254, OTIFFTAG_IMAGEWIDTH = 256,
  OTIFFTAG_IMAGELENGTH = 257, OTIFFTAG_BITSPERSAMPLE = 258, OTIFFTAG_COMPRESSION = 259, OTIFFTAG_PHOTOMETRIC = 262,
  OTIFFTAG_FILLORDER = 266, OTIFFTAG_IMAGEDESCRIPTION = 270, OTIFFTAG_MAKE = 271, OTIFFTAG_MODEL = 272,
  OTIFFTAG_STRIPOFFSETS = 273, OTIFFTAG_ORIENTATION = 274, OTIFFTAG_SAMPLESPERPIXEL = 277, OTIFFTAG_ROWSPERSTRIP = 278,
  OTIFFTAG_STRIPBYTECOUNTS = 279, OTIFFTAG_MINSAMPLEVALUE = 280, OTIFFTAG_MAXSAMPLEVALUE = 281, OTIFFTAG_XRESOLUTION = 282,
  OTIFFTAG_YRESOLUTION = 283, OTIFFTAG_PLANARCONFIG = 284, OTIFFTAG_PLANARCONFIG_CONTIG = 1, OTIFFTAG_PLANARCONFIG_SEPARATE = 2,
  OTIFFTAG_RESOLUTIONUNIT = 296, OTIFFTAG_PAGENUMBER = 297, OTIFFTAG_SOFTWARE = 305, OTIFFTAG_DATETIME = 306,
  OTIFFTAG_ARTIST = 315, OTIFFTAG_PREDICTOR = 317, OTIFFTAG_SUBIFD = 330, OTIFFTAG_TILEWIDTH = 322,
  OTIFFTAG_TILELENGTH = 323, OTIFFTAG_TILEOFFSETS = 324, OTIFFTAG_TILEBYTECOUNTS = 325, OTIFFTAG_EXTRASAMPLES = 338,
  OTIFFTAG_SAMPLEFORMAT = 339, OTIFFTAG_SMINSAMPLEVALUE = 340, OTIFFTAG_SMAXSAMPLEVALUE = 341, OTIFFTAG_XMLPACKET = 700,
  OSAMPLEFORMAT_UINT = 1, OSAMPLEFORMAT_INT = 2, OSAMPLEFORMAT_IEEEFP = 3, OSAMPLEFORMAT_VOID = 4,
  OSAMPLEFORMAT_COMPLEXINT = 5, OSAMPLEFORMAT_COMPLEXIEEEFP = 6, OGT_MODEL_TYPE_GEO_KEY = 1024, OGT_RASTER_TYPE_GEO_KEY = 1025,
  OGT_CITATION_GEO_KEY = 1026, OGEOGRAPHIC_TYPE_GEO_KEY = 2048, OGEOG_CITATION_GEO_KEY = 2049, OGEOG_GEODETIC_DATUM_GEO_KEY = 2050,
  OGEOG_PRIME_MERIDIAN_GEOKEY = 2051, OGEOG_LINEAR_UNITS_GEO_KEY = 2052, OGEOG_ANGULAR_UNITS_GEO_KEY = 2054, OGEOG_ANGULAR_UNIT_SIZE_GEO_KEY = 2055,
  OGEOG_ELLIPSOID_GEO_KEY = 2056, OGEOG_SEMI_MAJOR_AXIS = 2057, OGEOG_SEMI_MINOR_AXIS = 2058, OGEOG_INV_FLATTENING_GEO_KEY = 2059,
  OGEOG_PRIME_MERIDIAN_LONG_GEO_KEY = 2061, OPROJECTED_CS_TYPE_GEO_KEY = 3072, OPCS_CITATION_GEO_KEY = 3073, OPROJECTION_GEO_KEY = 3074,
  OPROJ_COORD_TRANS_GEO_KEY = 3075, OPROJ_LINEAR_UNITS_GEO_KEY = 3076, OPROJ_LINEAR_UNIT_SIZE_GEO_KEY = 3077, OPROJ_STD_PARALLEL1_GEO_KEY = 3078,
  OPROJ_STD_PARALLEL2_GEO_KEY = 3079, OPROJ_NAT_ORIGIN_LONG_GEO_KEY = 3080, OPROJ_NAT_ORIGIN_LAT_GEO_KEY = 3081, OPROJ_FALSE_EASTING_GEO_KEY = 3082,
  OPROJ_FALSE_NORTHING_GEO_KEY = 3083, OPROJ_FALSE_ORIGIN_LONG_GEO_KEY = 3084, OPROJ_FALSE_ORIGIN_LAT_GEO_KEY = 3085, OPROJ_FALSE_ORIGIN_EASTING_GEO_KEY = 3086,
  OPROJ_FALSE_ORIGIN_NORTHING_GEO_KEY = 3087, OPROJ_CENTER_LONG_GEO_KEY = 3088, OPROJ_CENTER_LAT_GEO_KEY = 3089, OPROJ_SCALE_AT_NAT_ORIGIN_GEO_KEY = 3092,
  OPROJ_SCALE_AT_CENTER_GEO_KEY = 3093, OVERTICAL_Cs_TYPE_GEO_KEY = 4096, OVERTICAL_CITATION_GEO_KEY = 4097, OVERTICAL_DATUM_GEO_KEY = 4098,
  OVERTICAL_UNITS_GEO_KEY = 4099, OLINEAR_METER = 9001, OLINEAR_FOOT = 9002, OLINEAR_FOOT_US_SURVEY = 9003,
  OANGULAR_DEGREE = 9102, OANGULAR_ARC_MINUTE = 9103, OANGULAR_ARC_SECOND = 9104, OANGULAR_GRAD = 9105,
  OANGULAR_GON = 9106, OANGULAR_DMS = 9107, OANGULAR_DMS_HEMISPHERE = 9108, OPCS_BRITISH_NATIONAL_GRID = 27700,
  OUSER_DEFINED = 32767, OTIFFTAG_COPYRIGHT = 33432, OMODEL_PIXEL_SCALE_TAG = 33550, OMODEL_TIE_POINT_TAG = 33922,
  OMODEL_TRANSFORM_TAG = 34264, OTIFFTAG_PHOTOSHOP = 34377, OGEO_KEY_DIRECTORY_TAG = 34735, OGEO_DOUBLE_PARAMS_TAG = 34736,
  OGEO_ASCII_PARAMS_TAG = 34737, OGDAL_METADATA_TAG = 42112, OGDAL_NODATA = 42113, ORPC_COEFFICIENT_TAG = 50844
}
 Anonymous enumerations. More...
 
enum  CompressType { COMPRESSION_NONE = 1 }
 
enum  PhotoInterpretation {
  OPHOTO_MINISWHITE = 0, OPHOTO_MINISBLACK = 1, OPHOTO_RGB = 2, OPHOTO_PALETTE = 3,
  OPHOTO_MASK = 4, OPHOTO_SEPARATED = 5, OPHOTO_YCBCR = 6, OPHOTO_CIELAB = 7
}
 
enum  ModelType { UNKNOWN = 0, OMODEL_TYPE_PROJECTED = 1, OMODEL_TYPE_GEOGRAPHIC = 2, OMODEL_TYPE_GEOCENTRIC = 3 }
 
enum  {
  OTIFF_NOTYPE = 0, OTIFF_BYTE = 1, OTIFF_ASCII = 2, OTIFF_SHORT = 3,
  OTIFF_LONG = 4, OTIFF_RATIONAL = 5, OTIFF_SBYTE = 6, OTIFF_UNDEFINED = 7,
  OTIFF_SSHORT = 8, OTIFF_SLONG = 9, OTIFF_SRATIONAL = 10, OTIFF_FLOAT = 11,
  OTIFF_DOUBLE = 12, OTIFF_IFD = 13, OTIFF_LONG8 = 16, OTIFF_SLONG8 = 17,
  OTIFF_IFD8 = 18
}
 

Functions

OSSIM_DLL std::istream & skipws (std::istream &in)
 
OSSIM_DLL bool isWhiteSpace (int c)
 
template<class T >
bool almostEqual (T x, T y, T tolerance=FLT_EPSILON)
 
template<class T >
bool inInterval (T x, T a, T b)
 
template<class T >
bool inOpenInterval (T x, T a, T b)
 
bool isnan (const float &v)
 isnan Test for floating point Not A Number (NAN) value. More...
 
bool isnan (const double &v)
 
 OSSIM_DLL_DATA (const IntFloatBitCoercion) nanValue
 Declaration of nan part of nan() declared here for inline ossim::nan(). More...
 
double nan ()
 Method to return ieee floating point double precision NAN. More...
 
template<class T >
abs (const T &value)
 
template<class S , class T >
lerp (S x, T begin, T end)
 
template<class T >
inverseLerp (T x, T begin, T end)
 
template<class S , class T >
quaderp (S x, T begin, T middle, T end)
 
template<class T >
clamp (T x, T a, T b)
 
template<class T >
wrap (T x, T a, T b)
 
template<class T >
min (T a, T b)
 
template<>
ossim_float32 min< ossim_float32 > (ossim_float32 a, ossim_float32 b)
 
template<>
ossim_float64 min< ossim_float64 > (ossim_float64 a, ossim_float64 b)
 
template<class T >
max (T a, T b)
 
template<>
ossim_float32 max< ossim_float32 > (ossim_float32 a, ossim_float32 b)
 
template<>
ossim_float64 max< ossim_float64 > (ossim_float64 a, ossim_float64 b)
 
double radiansToDegrees (double x)
 
double degreesToRadians (double x)
 
double cosd (double x)
 
double sind (double x)
 
double tand (double x)
 
double acosd (double x)
 
double asind (double x)
 
double atand (double x)
 
double atan2d (double y, double x)
 
template<class IntType >
IntType gcd (IntType n, IntType m)
 
template<>
int gcd< int > (int n, int m)
 
template<class IntType >
IntType lcm (IntType n, IntType m)
 
template<class T >
square (T x)
 
template<class T >
sgn (T x)
 
template<>
ossim_float32 sgn< ossim_float32 > (ossim_float32 x)
 
template<>
ossim_float64 sgn (ossim_float64 x)
 
template<class R , class F >
round (F x)
 
double ft2mtrs (double feet)
 
double usft2mtrs (double feet)
 
double mtrs2ft (double meters)
 
double mtrs2usft (double meters)
 
template<class T >
std::pair< T, T > quadraticRoots (T a, T b, T c)
 
template<class T >
void memClear (T &var, int z=0)
 
template<class T >
void memClear (T *var)
 
OSSIM_DLL ossimByteOrder byteOrder ()
 
OSSIM_DLL double defaultMin (ossimScalarType scalarType)
 
OSSIM_DLL double defaultMax (ossimScalarType scalarType)
 
OSSIM_DLL double defaultNull (ossimScalarType scalarType)
 
OSSIM_DLL ossim_uint32 scalarSizeInBytes (ossimScalarType scalarType)
 
OSSIM_DLL bool isSigned (ossimScalarType scalarType)
 
OSSIM_DLL ossim_uint32 getActualBitsPerPixel (ossimScalarType scalarType)
 Get actual bits per pixel for a given scalar type. More...
 
OSSIM_DLL ossim_uint32 getBitsPerPixel (ossimScalarType scalarType)
 Get bits per pixel for a given scalar type. More...
 
OSSIM_DLL void defaultTileSize (ossimIpt &tileSize)
 
OSSIM_DLL std::string convertHtmlSpecialCharactersToNormalCharacter (const std::string &src)
 
OSSIM_DLL bool matrixToHpr (ossim_float64 hpr[3], const NEWMAT::Matrix &rotation)
 Heading pitch roll extraction from a matrix. More...
 
OSSIM_DLL bool matrixToHpr (ossim_float64 hpr[3], const NEWMAT::Matrix &lsrMatrix, const NEWMAT::Matrix &rotationalMatrix)
 Heading pitch roll extraction from a matrix. More...
 
OSSIM_DLL void lexQuotedTokens (const std::string &str, ossim_uint32 start, const char *whitespace, const char *quotes, std::vector< std::string > &tokens, bool &unbalancedQuotes)
 
OSSIM_DLL void toStringList (ossimString &resultStringOfPoints, const std::vector< ossimDpt > &pointList, char separator=' ')
 Will take a vector of ossimDpt and convert to a string list separated by spaces For example: (45,34) (12,34) More...
 
OSSIM_DLL void toStringList (ossimString &resultStringOfPoints, const std::vector< ossimIpt > &pointList, char separator=' ')
 
OSSIM_DLL void toStringList (ossimString &resultStringOfPoints, const std::vector< ossimGpt > &pointList, char seaprator=' ')
 
OSSIM_DLL void toVector (std::vector< ossimDpt > &result, const ossimString &stringOfPoints)
 Will take a string list separated by spaces and convert to a vector of ossimDpts. More...
 
OSSIM_DLL void toVector (std::vector< ossimIpt > &result, const ossimString &stringOfPoints)
 
OSSIM_DLL void toVector (std::vector< ossimGpt > &result, const ossimString &stringOfPoints)
 
template<class T >
void toSimpleStringList (ossimString &result, const std::vector< T > &valuesList)
 This will output a vector of values inst a string. More...
 
template<>
OSSIM_DLL void toSimpleStringList (ossimString &result, const std::vector< ossim_uint8 > &valuesList)
 This will output a vector of values inst a string. More...
 
template<>
OSSIM_DLL void toSimpleStringList (ossimString &result, const std::vector< ossim_float64 > &valuesList)
 
template<>
OSSIM_DLL void toSimpleStringList (ossimString &result, const std::vector< ossim_float32 > &valuesList)
 
template<>
OSSIM_DLL void toSimpleStringList (ossimString &result, const std::vector< ossimString > &valuesList)
 
OSSIM_DLL bool extractSimpleValues (std::vector< ossimString > &values, const ossimString &stringOfPoints)
 Generic function to extract a list of values into a vector of string where the string of points is of the form: More...
 
template<class T >
bool toSimpleVector (std::vector< T > &result, const ossimString &stringOfPoints)
 
OSSIM_DLL bool toSimpleVector (std::vector< ossim_uint32 > &result, const ossimString &stringOfPoints)
 Takes input format of the form: (value1,value2,...,valueN) More...
 
OSSIM_DLL bool toSimpleVector (std::vector< ossim_int32 > &result, const ossimString &stringOfPoints)
 Takes input format of the form: (value1,value2,...,valueN) More...
 
OSSIM_DLL bool toSimpleVector (std::vector< ossim_uint16 > &result, const ossimString &stringOfPoints)
 Takes input format of the form: (value1,value2,...,valueN) More...
 
OSSIM_DLL bool toSimpleVector (std::vector< ossim_int16 > &result, const ossimString &stringOfPoints)
 Takes input format of the form: (value1,value2,...,valueN) More...
 
OSSIM_DLL bool toSimpleVector (std::vector< ossim_uint8 > &result, const ossimString &stringOfPoints)
 Takes input format of the form: (value1,value2,...,valueN) More...
 
OSSIM_DLL bool toSimpleVector (std::vector< ossim_int8 > &result, const ossimString &stringOfPoints)
 Takes input format of the form: (value1,value2,...,valueN) More...
 
OSSIM_DLL bool toSimpleVector (std::vector< ossimString > &result, const ossimString &stringOfStrings)
 Takes input format of the form: (value1,value2,...,valueN) More...
 
OSSIM_DLL ossim_uint32 getNumberOfThreads ()
 Get the number threads to use from ossimPreferences or ossim::Thread. More...
 
OSSIM_DLL void getFormattedTime (const std::string &format, bool gmtFlag, std::string &result)
 Gets the current time. More...
 
OSSIM_DLL ossim_int64 getTime ()
 Gets the current time. More...
 
OSSIM_DLL ossim_uint32 computeLevels (const ossimIrect &rect)
 Computes the number of decimation levels to get to the overview stop dimension. More...
 
ostreamoperator<< (std::ostream &out, const JsonParam &obj)
 
std::ostream & operator<< (std::ostream &out, const JsonConfig &obj)
 
void getDims (const ossimIrect &rect, kdu_core::kdu_dims &dims)
 Convenience method to convert ossimIrect to kdu_dims. More...
 
void getRect (const kdu_core::kdu_dims &dims, ossimIrect &rect)
 Convenience method to convert kdu_core::kdu_dims to ossimIrect. More...
 
bool clipRegionToImage (kdu_core::kdu_codestream &codestream, kdu_core::kdu_dims &region, int discard_levels, kdu_core::kdu_dims &clipRegion)
 Sets clipRegion from region, and image dimensions for level. More...
 
bool getCodestreamDimensions (kdu_core::kdu_codestream &codestream, std::vector< ossimIrect > &imageDims, std::vector< ossimIrect > &tileDims)
 Gets image and tile dimensions from codestream for each resolution level (rlevel). More...
 
bool copyRegionToTile (kdu_supp::kdu_channel_mapping *channelMapping, kdu_core::kdu_codestream &codestream, int discard_levels, kdu_core::kdu_thread_env *threadEnv, kdu_core::kdu_thread_queue *threadQueue, ossimImageData *destTile)
 Copies region from codestream to tile at a given rlevel. More...
 
bool copyRegionToTile (kdu_core::kdu_codestream &codestream, int discard_levels, kdu_core::kdu_thread_env *threadEnv, kdu_core::kdu_thread_queue *threadQueue, ossimImageData *destTile)
 Copies region from codestream to tile at a given rlevel. More...
 
void unNormalizeTile (ossimImageData *result)
 Un-normalizes float tile from kdu_region_decompressor::process method. More...
 
std::ostream & print (std::ostream &out, kdu_core::kdu_codestream &cs)
 Convenience print method for kdu_codestream. More...
 
std::ostream & print (std::ostream &out, const kdu_core::kdu_dims &dims)
 Convenience print method for kdu_dims. More...
 
std::ostream & print (std::ostream &out, const kdu_core::kdu_coords &coords)
 Convenience print method for kdu_coords. More...
 
void color_sycc_to_rgb (opj_image *img)
 
void color_apply_icc_profile (opj_image *image)
 
void opj_error_callback (const char *msg, void *)
 Callback method for errors. More...
 
void opj_warning_callback (const char *msg, void *)
 Callback method for warnings. More...
 
void opj_info_callback (const char *msg, void *)
 Callback method for info. More...
 
bool opj_decode (std::ifstream *in, const ossimIrect &rect, ossim_uint32 resLevel, ossim_int32 format, std::streamoff fileOffset, ossimImageData *tile)
 
bool copyOpjImage (opj_image *image, ossimImageData *tile)
 
template<class T >
bool copyOpjSrgbImage (T dummy, opj_image *image, ossimImageData *tile)
 
ossim_int32 getCodecFormat (std::istream *str)
 Gets codec format from magic number. More...
 
std::ostream & print (std::ostream &out, const opj_codestream_info &info)
 Prints codestream info from openjpeg struct opj_codestream_info. More...
 
std::ostream & print (std::ostream &out, const opj_cparameters &param)
 Prints compression parameters from openjpeg struct opj_cparameters. More...
 
std::ostream & print (std::ostream &out, const opj_dparameters &param)
 Prints decode parameters from openjpeg struct opj_dparameters. More...
 
std::ostream & print (std::ostream &out, const opj_image &image)
 Prints opj_image structure. More...
 
std::ostream & print (std::ostream &out, const opj_image_comp &comp)
 Prints opj_image_comp structure. More...
 
std::string getProgressionOrderString (ossim_int32 prog_order)
 

Detailed Description

This code was derived from https://gist.github.com/mshockwave.

Typedef Documentation

◆ filebuf

typedef std::basic_filebuf<char> ossim::filebuf

Class for char file buffers.

Definition at line 41 of file ossimIosFwd.h.

◆ fstream

typedef std::basic_fstream<char> ossim::fstream

Class for char mixed input and output file streams.

Definition at line 50 of file ossimIosFwd.h.

◆ GcpList

typedef std::vector< std::shared_ptr<GroundControlPoint> > ossim::GcpList

Definition at line 80 of file GroundControlPoint.h.

◆ ifstream

typedef std::basic_ifstream<char> ossim::ifstream

Class for char input file streams.

Definition at line 44 of file ossimIosFwd.h.

◆ ImageList

typedef std::vector< std::shared_ptr<Image> > ossim::ImageList

Definition at line 81 of file Image.h.

◆ iostream

typedef std::basic_iostream<char> ossim::iostream

Base class for char mixed input and output streams.

Definition at line 26 of file ossimIosFwd.h.

◆ istream

typedef std::basic_istream<char> ossim::istream

Base class for char input streams.

Definition at line 20 of file ossimIosFwd.h.

◆ istringstream

typedef std::basic_istringstream<char> ossim::istringstream

Class for char input memory streams.

Definition at line 32 of file ossimIosFwd.h.

◆ ofstream

typedef std::basic_ofstream<char> ossim::ofstream

Class for char output file streams.

Definition at line 47 of file ossimIosFwd.h.

◆ ostream

typedef std::basic_ostream<char> ossim::ostream

Base class for char output streams.

Definition at line 23 of file ossimIosFwd.h.

◆ ostringstream

typedef std::basic_ostringstream<char> ossim::ostringstream

Class for char output memory streams.

Definition at line 35 of file ossimIosFwd.h.

◆ stringbuf

typedef std::basic_stringbuf<char> ossim::stringbuf

Class for char memory buffers.

Definition at line 29 of file ossimIosFwd.h.

◆ stringstream

typedef std::basic_stringstream<char> ossim::stringstream

Class for char mixed input and output memory streams.

Definition at line 38 of file ossimIosFwd.h.

◆ TiePointList

typedef std::vector< std::shared_ptr< TiePoint > > ossim::TiePointList

Definition at line 21 of file TiePoint.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Anonymous enumerations.

Note prefixed with 'O' to avoid conflict with libtiff.

Enumerator
OPIXEL_IS_AREA 
OPIXEL_IS_POINT 
OTIFFTAG_SUBFILETYPE 
OTIFFTAG_IMAGEWIDTH 
OTIFFTAG_IMAGELENGTH 
OTIFFTAG_BITSPERSAMPLE 
OTIFFTAG_COMPRESSION 
OTIFFTAG_PHOTOMETRIC 
OTIFFTAG_FILLORDER 
OTIFFTAG_IMAGEDESCRIPTION 
OTIFFTAG_MAKE 
OTIFFTAG_MODEL 
OTIFFTAG_STRIPOFFSETS 
OTIFFTAG_ORIENTATION 
OTIFFTAG_SAMPLESPERPIXEL 
OTIFFTAG_ROWSPERSTRIP 
OTIFFTAG_STRIPBYTECOUNTS 
OTIFFTAG_MINSAMPLEVALUE 
OTIFFTAG_MAXSAMPLEVALUE 
OTIFFTAG_XRESOLUTION 
OTIFFTAG_YRESOLUTION 
OTIFFTAG_PLANARCONFIG 
OTIFFTAG_PLANARCONFIG_CONTIG 
OTIFFTAG_PLANARCONFIG_SEPARATE 
OTIFFTAG_RESOLUTIONUNIT 
OTIFFTAG_PAGENUMBER 
OTIFFTAG_SOFTWARE 
OTIFFTAG_DATETIME 
OTIFFTAG_ARTIST 
OTIFFTAG_PREDICTOR 
OTIFFTAG_SUBIFD 
OTIFFTAG_TILEWIDTH 
OTIFFTAG_TILELENGTH 
OTIFFTAG_TILEOFFSETS 
OTIFFTAG_TILEBYTECOUNTS 
OTIFFTAG_EXTRASAMPLES 
OTIFFTAG_SAMPLEFORMAT 
OTIFFTAG_SMINSAMPLEVALUE 
OTIFFTAG_SMAXSAMPLEVALUE 
OTIFFTAG_XMLPACKET 
OSAMPLEFORMAT_UINT 
OSAMPLEFORMAT_INT 
OSAMPLEFORMAT_IEEEFP 
OSAMPLEFORMAT_VOID 
OSAMPLEFORMAT_COMPLEXINT 
OSAMPLEFORMAT_COMPLEXIEEEFP 
OGT_MODEL_TYPE_GEO_KEY 
OGT_RASTER_TYPE_GEO_KEY 
OGT_CITATION_GEO_KEY 
OGEOGRAPHIC_TYPE_GEO_KEY 
OGEOG_CITATION_GEO_KEY 
OGEOG_GEODETIC_DATUM_GEO_KEY 
OGEOG_PRIME_MERIDIAN_GEOKEY 
OGEOG_LINEAR_UNITS_GEO_KEY 
OGEOG_ANGULAR_UNITS_GEO_KEY 
OGEOG_ANGULAR_UNIT_SIZE_GEO_KEY 
OGEOG_ELLIPSOID_GEO_KEY 
OGEOG_SEMI_MAJOR_AXIS 
OGEOG_SEMI_MINOR_AXIS 
OGEOG_INV_FLATTENING_GEO_KEY 
OGEOG_PRIME_MERIDIAN_LONG_GEO_KEY 
OPROJECTED_CS_TYPE_GEO_KEY 
OPCS_CITATION_GEO_KEY 
OPROJECTION_GEO_KEY 
OPROJ_COORD_TRANS_GEO_KEY 
OPROJ_LINEAR_UNITS_GEO_KEY 
OPROJ_LINEAR_UNIT_SIZE_GEO_KEY 
OPROJ_STD_PARALLEL1_GEO_KEY 
OPROJ_STD_PARALLEL2_GEO_KEY 
OPROJ_NAT_ORIGIN_LONG_GEO_KEY 
OPROJ_NAT_ORIGIN_LAT_GEO_KEY 
OPROJ_FALSE_EASTING_GEO_KEY 
OPROJ_FALSE_NORTHING_GEO_KEY 
OPROJ_FALSE_ORIGIN_LONG_GEO_KEY 
OPROJ_FALSE_ORIGIN_LAT_GEO_KEY 
OPROJ_FALSE_ORIGIN_EASTING_GEO_KEY 
OPROJ_FALSE_ORIGIN_NORTHING_GEO_KEY 
OPROJ_CENTER_LONG_GEO_KEY 
OPROJ_CENTER_LAT_GEO_KEY 
OPROJ_SCALE_AT_NAT_ORIGIN_GEO_KEY 
OPROJ_SCALE_AT_CENTER_GEO_KEY 
OVERTICAL_Cs_TYPE_GEO_KEY 
OVERTICAL_CITATION_GEO_KEY 
OVERTICAL_DATUM_GEO_KEY 
OVERTICAL_UNITS_GEO_KEY 
OLINEAR_METER 
OLINEAR_FOOT 
OLINEAR_FOOT_US_SURVEY 
OANGULAR_DEGREE 
OANGULAR_ARC_MINUTE 
OANGULAR_ARC_SECOND 
OANGULAR_GRAD 
OANGULAR_GON 
OANGULAR_DMS 
OANGULAR_DMS_HEMISPHERE 
OPCS_BRITISH_NATIONAL_GRID 
OUSER_DEFINED 
OTIFFTAG_COPYRIGHT 
OMODEL_PIXEL_SCALE_TAG 
OMODEL_TIE_POINT_TAG 
OMODEL_TRANSFORM_TAG 
OTIFFTAG_PHOTOSHOP 
OGEO_KEY_DIRECTORY_TAG 
OGEO_DOUBLE_PARAMS_TAG 
OGEO_ASCII_PARAMS_TAG 
OGDAL_METADATA_TAG 
OGDAL_NODATA 
ORPC_COEFFICIENT_TAG 

Definition at line 20 of file ossimTiffConstants.h.

21  {
22  OPIXEL_IS_AREA = 1,
23  OPIXEL_IS_POINT = 2,
25  OTIFFTAG_IMAGEWIDTH = 256,
30  OTIFFTAG_FILLORDER = 266,
32  OTIFFTAG_MAKE = 271,
33  OTIFFTAG_MODEL = 272,
43 
47 
49  OTIFFTAG_PAGENUMBER = 297,
50  OTIFFTAG_SOFTWARE = 305,
51 
52  // FORMAT is YYYY:MM:DD HH:MM:SS
53  OTIFFTAG_DATETIME = 306,
54 
55  OTIFFTAG_ARTIST = 315,
56  OTIFFTAG_PREDICTOR = 317,
57  OTIFFTAG_SUBIFD = 330,
58  OTIFFTAG_TILEWIDTH = 322,
59  OTIFFTAG_TILELENGTH = 323,
66  OTIFFTAG_XMLPACKET = 700,
73 
76  OGT_CITATION_GEO_KEY = 1026,
85  OGEOG_SEMI_MAJOR_AXIS = 2057,
86  OGEOG_SEMI_MINOR_AXIS = 2058,
90  OPCS_CITATION_GEO_KEY = 3073,
91  OPROJECTION_GEO_KEY = 3074,
113  OLINEAR_METER = 9001,
114  OLINEAR_FOOT = 9002,
115  OLINEAR_FOOT_US_SURVEY = 9003,
116  OANGULAR_DEGREE = 9102,
117  OANGULAR_ARC_MINUTE = 9103,
118  OANGULAR_ARC_SECOND = 9104,
119  OANGULAR_GRAD = 9105,
120  OANGULAR_GON = 9106,
121  OANGULAR_DMS = 9107,
124  OUSER_DEFINED = 32767,
125  OTIFFTAG_COPYRIGHT = 33432,
126  OMODEL_PIXEL_SCALE_TAG = 33550,
127  OMODEL_TIE_POINT_TAG = 33922,
128  OMODEL_TRANSFORM_TAG = 34264,
129  OTIFFTAG_PHOTOSHOP = 34377,
130  OGEO_KEY_DIRECTORY_TAG = 34735,
131  OGEO_DOUBLE_PARAMS_TAG = 34736,
132  OGEO_ASCII_PARAMS_TAG = 34737,
133  OGDAL_METADATA_TAG = 42112,
134  OGDAL_NODATA = 42113,
135  ORPC_COEFFICIENT_TAG = 50844
136  };

◆ anonymous enum

anonymous enum
Enumerator
OTIFF_NOTYPE 
OTIFF_BYTE 
OTIFF_ASCII 
OTIFF_SHORT 
OTIFF_LONG 
OTIFF_RATIONAL 
OTIFF_SBYTE 
OTIFF_UNDEFINED 
OTIFF_SSHORT 
OTIFF_SLONG 
OTIFF_SRATIONAL 
OTIFF_FLOAT 
OTIFF_DOUBLE 
OTIFF_IFD 
OTIFF_LONG8 
OTIFF_SLONG8 
OTIFF_IFD8 

Definition at line 163 of file ossimTiffConstants.h.

164  {
165  OTIFF_NOTYPE = 0, /* placeholder */
166  OTIFF_BYTE = 1, /* 8-bit unsigned integer */
167  OTIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */
168  OTIFF_SHORT = 3, /* 16-bit unsigned integer */
169  OTIFF_LONG = 4, /* 32-bit unsigned integer */
170  OTIFF_RATIONAL = 5, /* 64-bit unsigned fraction */
171  OTIFF_SBYTE = 6, /* !8-bit signed integer */
172  OTIFF_UNDEFINED = 7, /* !8-bit untyped data */
173  OTIFF_SSHORT = 8, /* !16-bit signed integer */
174  OTIFF_SLONG = 9, /* !32-bit signed integer */
175  OTIFF_SRATIONAL = 10, /* !64-bit signed fraction */
176  OTIFF_FLOAT = 11, /* !32-bit IEEE floating point */
177  OTIFF_DOUBLE = 12, /* !64-bit IEEE floating point */
178  OTIFF_IFD = 13, /* %32-bit unsigned integer (offset) */
179  OTIFF_LONG8 = 16, /* BigTIFF 64-bit unsigned integer */
180  OTIFF_SLONG8 = 17, /* BigTIFF 64-bit signed integer */
181  OTIFF_IFD8 = 18 /* BigTIFF 64-bit unsigned integer (offset) */
182  };

◆ CompressType

Enumerator
COMPRESSION_NONE 

Definition at line 138 of file ossimTiffConstants.h.

◆ ModelType

Enumerator
UNKNOWN 
OMODEL_TYPE_PROJECTED 
OMODEL_TYPE_GEOGRAPHIC 
OMODEL_TYPE_GEOCENTRIC 

Definition at line 155 of file ossimTiffConstants.h.

156  {
157  UNKNOWN = 0,
158  OMODEL_TYPE_PROJECTED = 1, // Projection Coordinate System
159  OMODEL_TYPE_GEOGRAPHIC = 2, // Geographic latitude-longitude System
161  };

◆ PhotoInterpretation

Enumerator
OPHOTO_MINISWHITE 
OPHOTO_MINISBLACK 
OPHOTO_RGB 
OPHOTO_PALETTE 
OPHOTO_MASK 
OPHOTO_SEPARATED 
OPHOTO_YCBCR 
OPHOTO_CIELAB 

Definition at line 143 of file ossimTiffConstants.h.

144  {
145  OPHOTO_MINISWHITE = 0, // min value is white
146  OPHOTO_MINISBLACK = 1, // min value is black
147  OPHOTO_RGB = 2, // RGB color model
148  OPHOTO_PALETTE = 3, // color map indexed
149  OPHOTO_MASK = 4, // $holdout mask
150  OPHOTO_SEPARATED = 5, // !color separations
151  OPHOTO_YCBCR = 6, // !CCIR 601
152  OPHOTO_CIELAB = 7 // !1976 CIE L*a*b*
153  };

Function Documentation

◆ abs()

template<class T >
T ossim::abs ( const T &  value)
inline

Definition at line 138 of file ossimCommon.h.

Referenced by ossimThinPlateSpline::deletePoint().

139  {
140  if(value < 0)
141  {
142  return -value;
143  }
144  return value;
145  }

◆ acosd()

double ossim::acosd ( double  x)
inline

◆ almostEqual()

template<class T >
bool ossim::almostEqual ( x,
y,
tolerance = FLT_EPSILON 
)
inline

Definition at line 53 of file ossimCommon.h.

References x, and y.

Referenced by ossimRpfUtil::checkLongitude(), ossimImageCacheBase::checkLongitude(), ossimRpfCacheTileSource::checkLongitude(), ossimSrtmHandler::getHeightAboveMSLMemoryTemplate(), ossimHdf5ImageDataset::getTileBuf(), ossim_hdf5::getValidBoundingRect(), ossimSonomaSensor::ossimPlane::intersect(), ossimThreeParamDatum::isEqualTo(), ossimSevenParamDatum::isEqualTo(), ossimDatum::isEqualTo(), ossimDpt::isEqualTo(), ossimImageViewAffineTransform::isEqualTo(), ossimEllipsoid::isEqualTo(), ossimMatrix4x4::isEqualTo(), ossimGpt::isEqualTo(), ossimPpjFrameSensor::lineSampleHeightToWorld(), ossimPolynomProjection::lineSampleHeightToWorld(), ossimCadrgProjection::operator==(), ossimDpt::operator==(), ossimSpaceObliqueMercatorProjection::operator==(), ossimMollweidProjection::operator==(), ossimBonneProjection::operator==(), ossimVanDerGrintenProjection::operator==(), ossimSinusoidalProjection::operator==(), ossimTransCylEquAreaProjection::operator==(), ossimTransMercatorProjection::operator==(), ossimMercatorProjection::operator==(), ossimObliqueMercatorProjection::operator==(), ossimAlbersProjection::operator==(), ossimLambertConformalConicProjection::operator==(), ossimGpt::operator==(), ossimHdf5ImageDataset::scanForValidImageRect(), ossimMercatorProjection::Set_Mercator_Parameters(), ossimKakaduJpipHandler::setProperty(), ossimThreeParamDatum::shiftFromWgs84(), ossimThreeParamDatum::shiftToWgs84(), ossimDrect::stretchToTileBoundary(), ossimDuration::toIso8601DurationString(), ossimImageGeometry::upIsUpAngle(), ossimPolynomProjection::worldToLineSample(), ossimH5GridModel::worldToLineSample(), and ossimSensorModel::worldToLineSample().

55  { return std::fabs(x - y) <= tolerance; }
ossim_uint32 x
ossim_uint32 y

◆ asind()

double ossim::asind ( double  x)
inline

Definition at line 265 of file ossimCommon.h.

References DEG_PER_RAD, and x.

Referenced by matrixToHpr().

265 { return DEG_PER_RAD*std::asin(x); }
ossim_uint32 x
#define DEG_PER_RAD

◆ atan2d()

double ossim::atan2d ( double  y,
double  x 
)
inline

Definition at line 267 of file ossimCommon.h.

References DEG_PER_RAD, x, and y.

Referenced by ossimGpt::azimuthTo(), ossimRangeDomeTileSource::getTile(), matrixToHpr(), and ossimImageGeometry::upIsUpAngle().

267 { return DEG_PER_RAD*std::atan2(y,x); }
ossim_uint32 x
#define DEG_PER_RAD
ossim_uint32 y

◆ atand()

double ossim::atand ( double  x)
inline

Definition at line 266 of file ossimCommon.h.

References DEG_PER_RAD, and x.

Referenced by ossimViewshedTool::writeHorizonProfile().

266 { return DEG_PER_RAD*std::atan(x); }
ossim_uint32 x
#define DEG_PER_RAD

◆ byteOrder()

ossimByteOrder ossim::byteOrder ( )

Definition at line 54 of file ossimCommon.cpp.

References OSSIM_BIG_ENDIAN, and OSSIM_LITTLE_ENDIAN.

Referenced by ossimGeoidNgs::addFile(), ossimSrtmSupportData::computeMinMaxTemplate(), ossim_hdf5::crossesDateline(), ossimHdf5ImageDataset::determineScalarType(), ossimPngWriter::doSwap(), ossimHdf5Info::dumpArrayType(), ossimHdf5Info::dumpDataset(), ossimHdf5Info::dumpNumerical(), ossimHdf5Info::dumpNumericalTypeInfo(), ossimHdf5::floatTypeToString(), ossim_hdf5::getBilinearProjection(), ossimHdf5::getByteOrder(), ossim_hdf5::getByteOrder(), ossimEnviHeader::getByteOrder(), ossimGeneralRasterTileSource::getHdrInfo(), ossimMpiMasterOverviewSequencer::getNextTile(), ossim_hdf5::getValidBoundingRect(), ossimXmpInfo::getXmpApp1XmlBlock(), ossimGeoidNgsHeader::initialize(), ossimH5ImageDataset::initialize(), ossimGeneralRasterInfo::initializeFromHdr(), ossimGeneralRasterInfo::initializeFromXml(), ossimNitfTileSource::initializeSwapBytesFlag(), ossimPngReader::initReader(), ossimHdf5::intTypeToString(), ossimGeneralRasterWriter::loadState(), ossimGeoidNgs::open(), ossimGeoidManager::open(), ossimTiffInfo::open(), ossimSrtmHandler::open(), ossimDtedTileSource::ossimDtedTileSource(), ossimGeoidEgm96::ossimGeoidEgm96(), ossimGeoidNgsHeader::ossimGeoidNgsHeader(), ossimJ2kInfo::ossimJ2kInfo(), ossimDtedRecord::parse(), ossimRpfCompressionLookupOffsetRecord::parseStream(), ossimRpfColorConverterOffsetRecord::parseStream(), ossimRpfColorGrayscaleOffsetRecord::parseStream(), ossimRpfCompressionSectionSubheader::parseStream(), ossimRpfAttributeOffsetRecord::parseStream(), ossimRpfColorConverterTable::parseStream(), ossimRpfMaskSubheader::parseStream(), ossimRpfColorConverterSubsection::parseStream(), ossimRpfImageDisplayParameterSubheader::parseStream(), ossimRpfAttributeSectionSubheader::parseStream(), ossimRpfMaskSubsection::parseStream(), ossimRpfImageDescriptionSubheader::parseStream(), ossimJ2kSizRecord::parseStream(), ossimJ2kSotRecord::parseStream(), ossimRpfTocEntry::parseStream(), ossimRpfFrameFileIndexRecord::parseStream(), ossimRpfCoverageSection::parseStream(), ossimRpfCompressionSection::parseStream(), ossimRpfPathnameRecord::parseStream(), ossimRpfBoundaryRectRecord::parseStream(), ossimRpfBoundaryRectSectionSubheader::parseStream(), ossimRpfFrameFileIndexSectionSubheader::parseStream(), ossimJ2kTlmRecord::parseStream(), ossimRpfBoundaryRectTable::parseStream(), ossimJ2kCodRecord::parseStream(), ossimRpfFrameFileIndexSubsection::parseStream(), ossimRpfComponentLocationRecord::parseStream(), ossimRpfReplaceUpdateSectionSubheader::parseStream(), ossimRpfHeader::parseStream(), ossimRpfLocationSection::parseStream(), ossimHdf5Info::print(), ossim_hdf5::printArrayType(), ossim_hdf5::printAttribute(), ossim_hdf5::printFloatType(), ossim_hdf5::printIntType(), ossim_hdf5::printObject(), ossimLasPointRecord0::readStream(), ossimLasPointRecord1::readStream(), ossimLasPointRecord2::readStream(), ossimLasPointRecord3::readStream(), ossimLasPointRecord4::readStream(), ossimLasHdr::readStream(), ossimNitfTileSource::scanForJpegBlockOffsets(), ossimEnviHeader::setByteorder(), ossimH5GridModel::setGridNodes(), ossimGeneralRasterInfo::setImageDataByteOrder(), ossimMpiSlaveOverviewSequencer::slaveProcessTiles(), ossimplugins::EnvisatAsarRecord::SwitchEndian(), ossimplugins::ProcessedDataRecord::SwitchEndian(), ossimDtedRecord::validateCheckSum(), ossimERSFileWriter::writeFile(), ossimOpjCompressor::writeGeotiffBox(), ossimOpjCompressor::writeGmlBox(), ossimKakaduCompressor::writeGmlBox(), ossimJ2kSizRecord::writeStream(), ossimJ2kSotRecord::writeStream(), ossimLasPointRecord0::writeStream(), ossimLasPointRecord4::writeStream(), ossimLasPointRecord2::writeStream(), ossimLasPointRecord3::writeStream(), ossimLasPointRecord1::writeStream(), ossimJ2kTlmRecord::writeStream(), ossimRpfFrameFileIndexSectionSubheader::writeStream(), ossimLasHdr::writeStream(), ossimRpfComponentLocationRecord::writeStream(), ossimRpfReplaceUpdateSectionSubheader::writeStream(), ossimRpfHeader::writeStream(), ossimRpfLocationSection::writeStream(), and ossimWriter::writeTiffHdr().

55 {
56  union
57  {
58  short s;
59  char c[sizeof(short)];
60  } un;
61 
62  un.s = 0x0102;
63  if (un.c[0] == 2 && un.c[1] == 1)
64  {
65  return OSSIM_LITTLE_ENDIAN;
66  }
67  else
68  {
69  return OSSIM_BIG_ENDIAN;
70  }
71 }

◆ clamp()

template<class T >
T ossim::clamp ( x,
a,
b 
)
inline

Definition at line 168 of file ossimCommon.h.

References isnan(), ossimREQUIRE, and x.

Referenced by matrixToHpr(), ossimNormRgbVector::operator*(), ossimRgbVector::operator*(), ossimRgbVector::operator+(), ossimNormRgbVector::operator-(), and ossimRgbVector::operator-().

170  {
171  ossimREQUIRE(a <= b); // input must make sense, disallow nans
172 
173  if (ossim::isnan(x)) return x;
174  if (x < a) return a;
175  if (b < x) return b;
176  return x;
177  }
ossim_uint32 x
#define ossimREQUIRE(expr)
Definition: ossimCommon.h:19
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ clipRegionToImage()

bool ossim::clipRegionToImage ( kdu_core::kdu_codestream &  codestream,
kdu_core::kdu_dims &  region,
int  discard_levels,
kdu_core::kdu_dims &  clipRegion 
)

Sets clipRegion from region, and image dimensions for level.

This will clip region to the image dimensions for the given discard_levels. Returns false if no intersection.

Parameters
codestreamStream to pull from.
regionThe region wanted from codestream.
discard_levelsThe resolution level, 0 being full res.
clipRegionThe region to initialize.
Returns
true on success, false if no intersection or there were codestream or pointer issues.

Definition at line 49 of file ossimKakaduCommon.cpp.

Referenced by copyRegionToTile(), and ossimKakaduJpipHandler::getTileAtRes().

53 {
54  // Clip the region to the image dimensions.
55 
56  bool result = false;
57 
58  if ( codestream.exists() )
59  {
60  codestream.apply_input_restrictions(
61  0, 0, discard_levels, 0, NULL, kdu_core::KDU_WANT_OUTPUT_COMPONENTS);
62 
63  kdu_core::kdu_dims dims;
64  codestream.get_dims(0, dims);
65  if ( region.intersects(dims) )
66  {
67  clipRegion = region.intersection(dims);
68  result = true;
69  }
70  }
71 
72  return result;
73 }

◆ color_apply_icc_profile()

void ossim::color_apply_icc_profile ( opj_image *  image)

◆ color_sycc_to_rgb()

void ossim::color_sycc_to_rgb ( opj_image *  img)

Definition at line 241 of file ossimOpjColor.cpp.

242 {
243  if(img->numcomps < 3)
244  {
245  img->color_space = OPJ_CLRSPC_GRAY;
246  return;
247  }
248 
249  if((img->comps[0].dx == 1)
250  && (img->comps[1].dx == 2)
251  && (img->comps[2].dx == 2)
252  && (img->comps[0].dy == 1)
253  && (img->comps[1].dy == 2)
254  && (img->comps[2].dy == 2))/* horizontal and vertical sub-sample */
255  {
256  sycc420_to_rgb(img);
257  }
258  else
259  if((img->comps[0].dx == 1)
260  && (img->comps[1].dx == 2)
261  && (img->comps[2].dx == 2)
262  && (img->comps[0].dy == 1)
263  && (img->comps[1].dy == 1)
264  && (img->comps[2].dy == 1))/* horizontal sub-sample only */
265  {
266  sycc422_to_rgb(img);
267  }
268  else
269  if((img->comps[0].dx == 1)
270  && (img->comps[1].dx == 1)
271  && (img->comps[2].dx == 1)
272  && (img->comps[0].dy == 1)
273  && (img->comps[1].dy == 1)
274  && (img->comps[2].dy == 1))/* no sub-sample */
275  {
276  sycc444_to_rgb(img);
277  }
278  else
279  {
280  fprintf(stderr,"%s:%d:color_sycc_to_rgb\n\tCAN NOT CONVERT\n",
281  __FILE__,__LINE__);
282  return;
283  }
284  img->color_space = OPJ_CLRSPC_SRGB;
285 
286 }/* color_sycc_to_rgb() */

◆ computeLevels()

ossim_uint32 ossim::computeLevels ( const ossimIrect rect)

Computes the number of decimation levels to get to the overview stop dimension.

This uses ossim preferences "overview_stop_dimension" value if set else it uses the default tile size to compute the number of levels.

Parameters
rectThe rectangle of the first level.
Returns
The number of decimation levels needed.

Definition at line 1253 of file ossimCommon.cpp.

References defaultTileSize(), ossimIrect::height(), ossimPreferences::instance(), ossimKeywordNames::OVERVIEW_STOP_DIMENSION_KW, ossimString::toUInt32(), ossimIrect::width(), ossimIpt::x, and ossimIpt::y.

Referenced by ossimOpjCompressor::initLevels(), and ossimKakaduCompressor::setLevels().

1254 {
1255  ossim_uint32 result = 0;
1256  ossim_uint32 stopDimension = 0;
1257 
1258  // Get the stop dimension from ossim preferences.
1259  const char* lookup = ossimPreferences::instance()->
1261  if (lookup)
1262  {
1263  stopDimension = ossimString(lookup).toUInt32();
1264  }
1265 
1266  if (stopDimension == 0)
1267  {
1268  // Use the smallest default tile size.
1269  ossimIpt tileSize;
1270  ossim::defaultTileSize(tileSize);
1271  stopDimension = tileSize.x < tileSize.y ? tileSize.x : tileSize.y;
1272  }
1273 
1274  ossim_uint32 largestImageDimension =
1275  rect.width() > rect.height() ? rect.width() : rect.height();
1276 
1277  while(largestImageDimension > stopDimension)
1278  {
1279  largestImageDimension /= 2;
1280  ++result;
1281  }
1282 
1283  return result;
1284 }
ossim_uint32 height() const
Definition: ossimIrect.h:487
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
ossim_uint32 toUInt32() const
unsigned int ossim_uint32
ossim_uint32 width() const
Definition: ossimIrect.h:500
static ossimPreferences * instance()
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141
static const char * OVERVIEW_STOP_DIMENSION_KW

◆ convertHtmlSpecialCharactersToNormalCharacter()

std::string ossim::convertHtmlSpecialCharactersToNormalCharacter ( const std::string &  src)

Definition at line 574 of file ossimCommon.cpp.

References ossimString::find(), min(), ossimString::size(), size, and ossimString::substitute().

Referenced by ossimWmsGetMap::read().

575 {
576  ossimString result = src;
577  std::string::size_type pos = 0;
578  pos = result.find("&");
579 
580  while(pos != std::string::npos)
581  {
582  std::string::size_type size = result.size();
583  std::string test1(&result[pos], ossim::min(6, (int)(size-pos)));
584  std::string test2(&result[pos], ossim::min(5, (int)(size-pos)));
585  std::string test3(&result[pos], ossim::min(4, (int)(size-pos)));
586 
587  if(test1 == "&apos;")
588  {
589  result = result.substitute(test1, "'");
590  }
591  else if(test1 == "&quot;")
592  {
593  result = result.substitute(test1, "\"");
594  }
595  else if(test2 == "&amp;")
596  {
597  result = result.substitute(test2, "&");
598  }
599  else if(test3 == "&gt;")
600  {
601  result = result.substitute(test3, ">");
602  }
603  else if(test3 == "&lt;")
604  {
605  result = result.substitute(test3, "<");
606  }
607  pos = result.find("&", pos+1);
608  }
609 
610  return result;
611 }
ossimString substitute(const ossimString &searchKey, const ossimString &replacementValue, bool replaceAll=false) const
Substitutes searchKey string with replacementValue and returns a string.
yy_size_t size
std::string::size_type size() const
Definition: ossimString.h:405
T min(T a, T b)
Definition: ossimCommon.h:203
std::string::size_type find(const std::string &s, std::string::size_type pos=0) const
Searches for s as a substring of *this, beginning at character pos of *this.
Definition: ossimString.h:753

◆ copyOpjImage()

bool ossim::copyOpjImage ( opj_image *  image,
ossimImageData tile 
)

Definition at line 389 of file ossimOpjCommon.cpp.

References copyOpjSrgbImage(), ossimRectilinearDataObject::getScalarType(), OSSIM_UINT8, ossimNotify(), ossimNotifyLevel_WARN, and status.

390 {
391  bool status = false;
392 
393  if ( image && tile )
394  {
395  if ( image->color_space == OPJ_CLRSPC_SRGB )
396  {
397  const ossimScalarType SCALAR = tile->getScalarType();
398  if ( SCALAR == OSSIM_UINT8 )
399  {
400  status = ossim::copyOpjSrgbImage( ossim_uint8(0), image, tile );
401  }
402  else
403  {
405  << "ossim::copyOpjImage WARNING!\nUnhandle scalar: "
406  << SCALAR << "\n";
407  }
408  }
409  else
410  {
412  << "ossim::copyOpjImage WARNING!\nUnhandle color space: "
413  << image->color_space << "\n";
414  }
415  }
416 
417  return status;
418 }
bool copyOpjSrgbImage(T dummy, opj_image *image, ossimImageData *tile)
ossimScalarType
return status
virtual ossimScalarType getScalarType() const
8 bit unsigned integer
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ copyOpjSrgbImage()

template<class T >
bool ossim::copyOpjSrgbImage ( dummy,
opj_image *  image,
ossimImageData tile 
)

Definition at line 420 of file ossimOpjCommon.cpp.

References ossimImageData::getBuf(), ossimImageData::getHeight(), ossimImageData::getNumberOfBands(), ossimImageData::getWidth(), ossimNotify(), ossimNotifyLevel_WARN, and status.

Referenced by copyOpjImage().

423 {
424  bool status = false;
425 
426  const ossim_uint32 BANDS = tile->getNumberOfBands();
427 
428  if ( image->numcomps == BANDS )
429  {
430  for ( ossim_uint32 band = 0; band < BANDS; ++band )
431  {
432  T* buf = (T*)tile->getBuf(band);
433  const ossim_uint32 LINES = tile->getHeight();
434 
435  if ( image->comps[band].h == LINES )
436  {
437  ossim_uint32 offset = 0;
438  for ( ossim_uint32 line = 0; line < LINES; ++line )
439  {
440  const ossim_uint32 SAMPS = tile->getWidth();
441  if ( image->comps[band].w == SAMPS )
442  {
443  for ( ossim_uint32 samp = 0; samp < SAMPS; ++samp )
444  {
445  buf[offset] = (T)(image->comps[band].data[offset]);
446  ++offset;
447  }
448 
449  //---
450  // If we get here all the dimensions match and things sould
451  // be good.
452  //---
453  status = true;
454  }
455  else
456  {
458  << "ossim::copyOpjSrgbImage WARNING: sample mismatch!\n";
459  }
460  }
461  }
462  else
463  {
465  << "ossim::copyOpjSrgbImage WARNING: line mismatch!\n";
466  }
467  }
468  }
469  else
470  {
472  << "ossim::copyOpjSrgbImage WARNING: band mismatch!\n";
473  }
474 
475  return status;
476 
477 } // End: ossim::copyOpjSrgbImage( ... )
virtual ossim_uint32 getWidth() const
virtual ossim_uint32 getNumberOfBands() const
virtual ossim_uint32 getHeight() const
unsigned int ossim_uint32
return status
virtual const void * getBuf() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ copyRegionToTile() [1/2]

bool ossim::copyRegionToTile ( kdu_supp::kdu_channel_mapping *  channelMapping,
kdu_core::kdu_codestream &  codestream,
int  discard_levels,
kdu_core::kdu_thread_env *  threadEnv,
kdu_core::kdu_thread_queue *  threadQueue,
ossimImageData destTile 
)

Copies region from codestream to tile at a given rlevel.

This method takes a channelMapping and decompresses all bands at once. Specifically needed to convert YCC color space to RGB.

Parameters
Kakaduchannel mapping object.
codestreamStream to pull from.
regionThe region wanted from codestream.
discard_levelsThe resolution level, 0 being full res.
threadEnvPointer to kdu_thread_env.
threadQueuePointer to kdu_thread_queue.
destTileThe ossimImageData object to copy to.
Returns
true on success, false on error.

Definition at line 164 of file ossimKakaduCommon.cpp.

References clipRegionToImage(), ossimImageData::getBuf(), getDims(), ossimImageData::getImageRectangle(), ossimImageData::getNumberOfBands(), ossimRectilinearDataObject::getScalarType(), ossimImageData::getSize(), ossimImageData::getUcharBuf(), ossimImageData::makeBlank(), OSSIM_FLOAT32, OSSIM_SINT16, OSSIM_SINT32, OSSIM_UINT11, OSSIM_UINT12, OSSIM_UINT13, OSSIM_UINT14, OSSIM_UINT15, OSSIM_UINT16, OSSIM_UINT8, ossimNotify(), ossimNotifyLevel_DEBUG, ossimNotifyLevel_WARN, tileNumber, ossimString::toString(), ossimIrect::ul(), unNormalizeTile(), ossimImageData::validate(), ossimImageData::write(), ossimIpt::x, and ossimIpt::y.

Referenced by ossimKakaduNitfReader::getOverviewTile(), ossimKakaduJ2kReader::getOverviewTile(), ossimKakaduJp2Reader::getOverviewTile(), and ossimKakaduJpipHandler::getTileAtRes().

170 {
171  bool result = true;
172 
173  if ( channelMapping && destTile && codestream.exists())// && threadEnv && threadQueue )
174  {
175  try // Kakadu throws exceptions...
176  {
177  kdu_core::kdu_dims region;
178  getDims(destTile->getImageRectangle(), region);
179 
180  kdu_core::kdu_dims clipRegion;
181  if ( clipRegionToImage(codestream,
182  region,
183  discard_levels,
184  clipRegion) )
185  {
186  if (region != clipRegion)
187  {
188  // Not filling whole tile.
189  destTile->makeBlank();
190  }
191 
192  const ossim_uint32 BANDS = destTile->getNumberOfBands();
193  const ossimScalarType SCALAR = destTile->getScalarType();
194 
195  int max_layers = INT_MAX;
196  kdu_core::kdu_coords expand_numerator(1,1);
197  kdu_core::kdu_coords expand_denominator(1,1);
198  bool precise = true;
199  kdu_core::kdu_component_access_mode access_mode =
200  kdu_core::KDU_WANT_OUTPUT_COMPONENTS;
201  bool fastest = false;
202 
203  // Start the kdu_region_decompressor.
204  kdu_supp::kdu_region_decompressor krd;
205  if ( krd.start( codestream,
206  channelMapping,
207  -1,
208  discard_levels,
209  max_layers,
210  clipRegion,
211  expand_numerator,
212  expand_denominator,
213  precise,
214  access_mode,
215  fastest,
216  threadEnv,
217  threadQueue )
218  == false)
219  {
220  std::string e = "kdu_region_decompressor::start error!";
221  throw(ossimException(e));
222  }
223 
224  bool expand_monochrome = false;
225  int pixel_gap = 1;
226  kdu_core::kdu_coords buffer_origin;
227  buffer_origin.x = destTile->getImageRectangle().ul().x;
228  buffer_origin.y = destTile->getImageRectangle().ul().y;
229  int row_gap = region.size.x;
230  int suggested_increment = static_cast<int>(destTile->getSize());
231  int max_region_pixels = suggested_increment;
232  kdu_core::kdu_dims incomplete_region = clipRegion;
233  kdu_core::kdu_dims new_region;
234  bool measure_row_gap_in_pixels = true;
235 
236  // For signed int set precision bit to 0 for kakadu.
237  int precision_bits = (SCALAR != OSSIM_SINT16) ? codestream.get_bit_depth(0, true) : 0;
238 
239  switch (SCALAR)
240  {
241  case OSSIM_UINT8:
242  {
243  // Get pointers to the tile buffers.
244  std::vector<kdu_core::kdu_byte*> channel_bufs(BANDS);
245  for ( ossim_uint32 band = 0; band < BANDS; ++band )
246  {
247  channel_bufs[band] = destTile->getUcharBuf(band);
248  }
249 
250  while ( !incomplete_region.is_empty() )
251  {
252  if ( krd.process( &channel_bufs.front(),
253  expand_monochrome,
254  pixel_gap,
255  buffer_origin,
256  row_gap,
257  suggested_increment,
258  max_region_pixels,
259  incomplete_region,
260  new_region,
261  precision_bits,
262  measure_row_gap_in_pixels ) == false )
263  {
264  break;
265  }
266  }
267 
268  // Wait for things to finish.
269  if( threadEnv && threadQueue )
270  {
271  //---
272  // Wait for all queues descended from `root_queue' to identify themselves
273  // as "finished" via the `kdu_thread_queue::all_done' function.
274  //---
275  threadEnv->join(threadQueue, true);
276  }
277 
278  // Validate the tile.
279  destTile->validate();
280 
281  break;
282  }
283  case OSSIM_UINT11:
284  case OSSIM_UINT12:
285  case OSSIM_UINT13:
286  case OSSIM_UINT14:
287  case OSSIM_UINT15:
288  case OSSIM_UINT16:
289  case OSSIM_SINT16:
290  {
291  // Get pointers to the tile buffers.
292  std::vector<kdu_core::kdu_uint16*> channel_bufs(BANDS);
293  for ( ossim_uint32 band = 0; band < BANDS; ++band )
294  {
295  channel_bufs[band] = static_cast<kdu_core::kdu_uint16*>(
296  destTile->getBuf(band));
297  }
298 
299  while ( !incomplete_region.is_empty() )
300  {
301  //---
302  // Note: precision_bits set to 0 to indicate "signed" data
303  // for the region decompressor.
304  //---
305  if ( krd.process( &channel_bufs.front(),
306  expand_monochrome,
307  pixel_gap,
308  buffer_origin,
309  row_gap,
310  suggested_increment,
311  max_region_pixels,
312  incomplete_region,
313  new_region,
314  precision_bits,
315  measure_row_gap_in_pixels ) == false )
316  {
317  break;
318  }
319  }
320 
321  // Wait for things to finish.
322  if( threadEnv && threadQueue )
323  {
324  //---
325  // Wait for all queues descended from `root_queue' to identify themselves
326  // as "finished" via the `kdu_thread_queue::all_done' function.
327  //---
328  threadEnv->join(threadQueue, true);
329  }
330 
331  // Validate the tile.
332  destTile->validate();
333 
334  break;
335  }
336  case OSSIM_SINT32:
337  case OSSIM_FLOAT32:
338  {
339  //---
340  // NOTES:
341  // 1) Signed 32 bit integer data gets normalized when compressed
342  // so use the same code path as float data.
343  // 2) Cannot call "ossimImageData::getFloatBuf" as it will return a
344  // null pointer if the destination tile is OSSIM_SINT32 scalar type.
345  //---
346 
347  // Get pointers to the tile buffers.
348  std::vector<ossim_float32*> channel_bufs(BANDS);
349  for ( ossim_uint32 band = 0; band < BANDS; ++band )
350  {
351  channel_bufs[band] = static_cast<ossim_float32*>(destTile->getBuf(band));
352  }
353 
354  while ( !incomplete_region.is_empty() )
355  {
356  //---
357  // Note: precision_bits set to 0 to indicate "signed" data
358  // for the region decompressor.
359  //---
360  if ( krd.process( &channel_bufs.front(),
361  expand_monochrome,
362  pixel_gap,
363  buffer_origin,
364  row_gap,
365  suggested_increment,
366  max_region_pixels,
367  incomplete_region,
368  new_region,
369  true, // normalize
370  measure_row_gap_in_pixels ) )
371  {
372  break;
373  }
374  }
375 
376  if( threadEnv && threadQueue )
377  {
378  //---
379  // Wait for all queues descended from `root_queue' to identify themselves
380  // as "finished" via the `kdu_thread_queue::all_done' function.
381  //---
382  threadEnv->join(threadQueue, true);
383  }
384 
385  // Un-normalize.
386  ossim::unNormalizeTile(destTile);
387 
388  // Validate the tile.
389  destTile->validate();
390 
391  break;
392  }
393  default:
394  {
396  << __FILE__ << " " << __LINE__ << " Unhandle scalar: "
397  << destTile->getScalarType() << "\n";
398  result = false;
399  break;
400  }
401 
402  } // End of: switch (theScalarType)
403 
404  // Every call to kdu_region_decompressor::start has a finish.
405  if ( krd.finish() == false )
406  {
408  << __FILE__ << " " << __LINE__
409  << "kdu_region_decompressor::proces error!\n";
410  }
411  }
412  else // No region intersect with image.
413  {
414  destTile->makeBlank();
415  }
416 
417  } // Matches: try{ ...
418 
419  // Catch and rethrow exceptions.
420  catch( const ossimException& /* e */ )
421  {
422  throw;
423  }
424  catch ( kdu_core::kdu_exception exc )
425  {
426  // kdu_exception is an int typedef.
427  if ( threadEnv != 0 )
428  {
429  threadEnv->handle_exception(exc);
430  }
431  ostringstream e;
432  e << "Caught exception from kdu_region_decompressor: " << exc << "\n";
433  throw ossimException( e.str() );
434  }
435  catch ( std::bad_alloc& )
436  {
437  if ( threadEnv != 0 )
438  {
439  threadEnv->handle_exception(KDU_MEMORY_EXCEPTION);
440  }
441  std::string e =
442  "Caught exception from kdu_region_decompressor: std::bad_alloc";
443  throw ossimException( e );
444  }
445  catch( ... )
446  {
447  std::string e =
448  "Caught unhandled exception from kdu_region_decompressor";
449  throw ossimException( e );
450  }
451  }
452  else // no codestream
453  {
454  result = false;
455  }
456 
457 #if 0 /* Please leave for serious debug. (drb) */
458  if (destTile)
459  {
460  static int tileNumber = 0;
461  if (destTile)
462  {
463  ossimFilename f = "tile-dump";
465  f += ".ras";
466  if (destTile->write(f))
467  {
469  << "wrote: " << f << std::endl;
470  ++tileNumber;
471  }
472  }
473  }
474 #endif
475 
476  return result;
477 
478 } // End: ossim::copyRegionToTile
16 bit unsigned integer (12 bits used)
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
virtual ossim_uint32 getNumberOfBands() const
16 bit unsigned integer
ossim_uint32 tileNumber
virtual const ossim_uint8 * getUcharBuf() const
16 bit unsigned integer (14 bits used)
float ossim_float32
static ossimString toString(bool aValue)
Numeric to string methods.
16 bit signed integer
const ossimIpt & ul() const
Definition: ossimIrect.h:274
16 bit unsigned integer (13 bits used)
32 bit floating point
virtual bool write(const ossimFilename &f) const
Writes tile to stream.
virtual ossimDataObjectStatus validate() const
32 bit signed integer
unsigned int ossim_uint32
virtual ossimIrect getImageRectangle() const
void unNormalizeTile(ossimImageData *result)
Un-normalizes float tile from kdu_region_decompressor::process method.
ossimScalarType
bool clipRegionToImage(kdu_core::kdu_codestream &codestream, kdu_core::kdu_dims &region, int discard_levels, kdu_core::kdu_dims &clipRegion)
Sets clipRegion from region, and image dimensions for level.
virtual ossimScalarType getScalarType() const
virtual void makeBlank()
Initializes data to null pixel values.
16 bit unsigned integer (15 bits used)
void getDims(const ossimIrect &rect, kdu_core::kdu_dims &dims)
Convenience method to convert ossimIrect to kdu_dims.
virtual ossim_uint32 getSize() const
Returns the total number of pixels in a tile for all bands.
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
ossim_int32 x
Definition: ossimIpt.h:141
8 bit unsigned integer
16 bit unsigned integer (11 bits used)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ copyRegionToTile() [2/2]

bool ossim::copyRegionToTile ( kdu_core::kdu_codestream &  codestream,
int  discard_levels,
kdu_core::kdu_thread_env *  threadEnv,
kdu_core::kdu_thread_queue *  threadQueue,
ossimImageData destTile 
)

Copies region from codestream to tile at a given rlevel.

This method takes a codestream and decompresses each band separately. Specifically needed for n-band data where the kdu_channel_mapping will not work.

Parameters
codestreamStream to pull from.
regionThe region wanted from codestream.
discard_levelsThe resolution level, 0 being full res.
threadEnvPointer to kdu_thread_env.
threadQueuePointer to kdu_thread_queue.
destTileThe ossimImageData object to copy to.
Returns
true on success, false on error.

Definition at line 481 of file ossimKakaduCommon.cpp.

References clipRegionToImage(), ossimImageData::getBuf(), getDims(), ossimImageData::getImageRectangle(), ossimImageData::getNumberOfBands(), ossimRectilinearDataObject::getScalarType(), ossimImageData::getSize(), ossimImageData::getUcharBuf(), ossimImageData::makeBlank(), OSSIM_FLOAT32, OSSIM_SINT16, OSSIM_SINT32, OSSIM_UINT11, OSSIM_UINT12, OSSIM_UINT13, OSSIM_UINT14, OSSIM_UINT15, OSSIM_UINT16, OSSIM_UINT8, ossimNotify(), ossimNotifyLevel_DEBUG, ossimNotifyLevel_WARN, tileNumber, ossimString::toString(), ossimIrect::ul(), unNormalizeTile(), ossimImageData::validate(), ossimImageData::write(), ossimIpt::x, and ossimIpt::y.

486 {
487  bool result = true;
488 
489  if ( destTile && codestream.exists())// && threadEnv && threadQueue )
490  {
491  try // Kakadu throws exceptions...
492  {
493  kdu_core::kdu_dims region;
494  getDims(destTile->getImageRectangle(), region);
495 
496  kdu_core::kdu_dims clipRegion;
497  if ( clipRegionToImage(codestream,
498  region,
499  discard_levels,
500  clipRegion) )
501  {
502  if (region != clipRegion)
503  {
504  // Not filling whole tile.
505  destTile->makeBlank();
506  }
507 
508  const ossimScalarType SCALAR = destTile->getScalarType();
509  const ossim_uint32 BANDS = destTile->getNumberOfBands();
510 
511  kdu_supp::kdu_channel_mapping* mapping = 0;
512  int max_layers = INT_MAX;
513  kdu_core::kdu_coords expand_numerator(1,1);
514  kdu_core::kdu_coords expand_denominator(1,1);
515  bool precise = true;
516  kdu_core::kdu_component_access_mode access_mode =
517  kdu_core::KDU_WANT_OUTPUT_COMPONENTS;
518  bool fastest = false;
519 
520  //---
521  // band loop:
522  // Note: At some point we may want to be a band selector;
523  // in which case, we would loop through the band list.
524  // For now just go through all bands and let the ossimBandSelector
525  // weed them out.
526  //---
527  for (ossim_uint32 band = 0; band < BANDS; ++band)
528  {
529  int single_component = band;
530 
531  // Start the kdu_region_decompressor.
532  kdu_supp::kdu_region_decompressor krd;
533 
534  if ( krd.start( codestream,
535  mapping,
536  single_component,
537  discard_levels,
538  max_layers,
539  clipRegion,
540  expand_numerator,
541  expand_denominator,
542  precise,
543  access_mode,
544  fastest,
545  threadEnv,
546  threadQueue )
547  == false)
548  {
549  std::string e = "kdu_region_decompressor::start error!";
550  throw(ossimException(e));
551  }
552 
553  vector<int> channel_offsets(1);
554  channel_offsets[0] = 0;
555  int pixel_gap = 1;
556  kdu_core::kdu_coords buffer_origin;
557  buffer_origin.x = destTile->getImageRectangle().ul().x;
558  buffer_origin.y = destTile->getImageRectangle().ul().y;
559  int row_gap = region.size.x;
560  int suggested_increment = static_cast<int>(destTile->getSize());
561  int max_region_pixels = suggested_increment;
562  kdu_core::kdu_dims incomplete_region = clipRegion;
563  kdu_core::kdu_dims new_region;
564  bool measure_row_gap_in_pixels = true;
565 
566  // For signed int set precision bit to 0 for kakadu.
567  int precision_bits = (SCALAR != OSSIM_SINT16) ? codestream.get_bit_depth(0, true) : 0;
568 
569  switch (SCALAR)
570  {
571  case OSSIM_UINT8:
572  {
573  // Get pointer to the tile buffer.
574  kdu_core::kdu_byte* buffer = destTile->getUcharBuf(band);
575 
576  while ( !incomplete_region.is_empty() )
577  {
578  if ( krd.process( buffer,
579  &channel_offsets.front(),
580  pixel_gap,
581  buffer_origin,
582  row_gap,
583  suggested_increment,
584  max_region_pixels,
585  incomplete_region,
586  new_region,
587  precision_bits,
588  measure_row_gap_in_pixels ) )
589  {
590  break;
591  }
592  }
593 
594  if( threadEnv && threadQueue)
595  {
596  //---
597  // Wait for all queues descended from `root_queue' to identify themselves
598  // as "finished" via the `kdu_thread_queue::all_done' function.
599  //---
600  threadEnv->join(threadQueue, true);
601  }
602 
603  // Validate the tile.
604  destTile->validate();
605 
606  break;
607  }
608  case OSSIM_UINT11:
609  case OSSIM_UINT12:
610  case OSSIM_UINT13:
611  case OSSIM_UINT14:
612  case OSSIM_UINT15:
613  case OSSIM_UINT16:
614  case OSSIM_SINT16:
615  {
616  // Get pointer to the tile buffer.
617  kdu_core::kdu_uint16* buffer =
618  static_cast<kdu_core::kdu_uint16*>(destTile->getBuf(band));
619 
620  while ( !incomplete_region.is_empty() )
621  {
622  //---
623  // Note: precision_bits set to 0 to indicate "signed" data
624  // for the region decompressor.
625  //---
626  if ( krd.process( buffer,
627  &channel_offsets.front(),
628  pixel_gap,
629  buffer_origin,
630  row_gap,
631  suggested_increment,
632  max_region_pixels,
633  incomplete_region,
634  new_region,
635  precision_bits,
636  measure_row_gap_in_pixels ) == false )
637  {
638  break;
639  }
640  }
641 
642  //---
643  // Wait for all queues descended from `root_queue' to identify themselves
644  // as "finished" via the `kdu_thread_queue::all_done' function.
645  //---
646  if( threadEnv && threadQueue)
647  {
648  threadEnv->join(threadQueue, true);
649  }
650 
651  // Validate the tile.
652  destTile->validate();
653 
654  break;
655  }
656  case OSSIM_SINT32:
657  case OSSIM_FLOAT32:
658  {
659  //---
660  // NOTES:
661  // 1) Signed 32 bit integer data gets normalized when compressed
662  // so use the same code path as float data.
663  // 2) Cannot call "ossimImageData::getFloatBuf" as it will return a
664  // null pointer if the destination tile is OSSIM_SINT32 scalar type.
665  //---
666 
667  // Get pointer to the tile buffer.
668  ossim_float32* buffer = static_cast<ossim_float32*>(destTile->getBuf(band));
669 
670  while ( !incomplete_region.is_empty() )
671  {
672  //---
673  // Note: precision_bits set to 0 to indicate "signed" data
674  // for the region decompressor.
675  //---
676  if ( krd.process( buffer,
677  &channel_offsets.front(),
678  pixel_gap,
679  buffer_origin,
680  row_gap,
681  suggested_increment,
682  max_region_pixels,
683  incomplete_region,
684  new_region,
685  true, // normalize
686  measure_row_gap_in_pixels ) == false )
687  {
688  break;
689  }
690  }
691 
692  if( threadEnv && threadQueue)
693  {
694  //---
695  // Wait for all queues descended from `root_queue' to identify themselves
696  // as "finished" via the `kdu_thread_queue::all_done' function.
697  //---
698  threadEnv->join(threadQueue, true);
699  }
700 
701  // Un-normalize.
702  ossim::unNormalizeTile(destTile);
703 
704  // Validate the tile.
705  destTile->validate();
706 
707  break;
708  }
709 
710  default:
711  {
713  << __FILE__ << " " << __LINE__ << " Unhandle scalar: "
714  << destTile->getScalarType() << "\n";
715  result = false;
716  break;
717  }
718 
719  } // End of: switch (theScalarType)
720 
721  // Every call to kdu_region_decompressor::start has a finish.
722  if ( krd.finish() == false )
723  {
724  result = false;
726  << __FILE__ << " " << __LINE__
727  << " kdu_region_decompressor::proces error!" << std::endl;
728  }
729 
730 
731  } // End of band loop.
732  }
733  else // No region intersect with image.
734  {
735  destTile->makeBlank();
736  }
737 
738  } // Matches: try{ ...
739 
740  // Catch and rethrow exceptions.
741  catch( const ossimException& /* e */ )
742  {
743  throw;
744  }
745  catch ( kdu_core::kdu_exception exc )
746  {
747  // kdu_exception is an int typedef.
748  if ( threadEnv != 0 )
749  {
750  threadEnv->handle_exception(exc);
751  }
752  ostringstream e;
753  e << "Caught exception from kdu_region_decompressor: " << exc << "\n";
754  throw ossimException( e.str() );
755 
756  }
757  catch ( std::bad_alloc& )
758  {
759  if ( threadEnv != 0 )
760  {
761  threadEnv->handle_exception(KDU_MEMORY_EXCEPTION);
762  }
763  std::string e =
764  "Caught exception from kdu_region_decompressor: std::bad_alloc";
765  throw ossimException( e );
766  }
767  catch( ... )
768  {
769  std::string e =
770  "Caught unhandled exception from kdu_region_decompressor";
771  throw ossimException(e);
772  }
773  }
774  else // no codestream
775  {
776  result = false;
777  }
778 
779 #if 0 /* Please leave for serious debug. (drb) */
780  if (destTile)
781  {
782  static int tileNumber = 0;
783  if (destTile)
784  {
785  ossimFilename f = "tile-dump";
787  f += ".ras";
788  if (destTile->write(f))
789  {
791  << "wrote: " << f << std::endl;
792  ++tileNumber;
793  }
794  }
795  }
796 #endif
797 
798  return result;
799 
800 } // End: ossim::copyRegionToTile
16 bit unsigned integer (12 bits used)
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
virtual ossim_uint32 getNumberOfBands() const
16 bit unsigned integer
ossim_uint32 tileNumber
virtual const ossim_uint8 * getUcharBuf() const
16 bit unsigned integer (14 bits used)
float ossim_float32
static ossimString toString(bool aValue)
Numeric to string methods.
16 bit signed integer
const ossimIpt & ul() const
Definition: ossimIrect.h:274
16 bit unsigned integer (13 bits used)
32 bit floating point
virtual bool write(const ossimFilename &f) const
Writes tile to stream.
virtual ossimDataObjectStatus validate() const
32 bit signed integer
unsigned int ossim_uint32
virtual ossimIrect getImageRectangle() const
void unNormalizeTile(ossimImageData *result)
Un-normalizes float tile from kdu_region_decompressor::process method.
ossimScalarType
bool clipRegionToImage(kdu_core::kdu_codestream &codestream, kdu_core::kdu_dims &region, int discard_levels, kdu_core::kdu_dims &clipRegion)
Sets clipRegion from region, and image dimensions for level.
virtual ossimScalarType getScalarType() const
virtual void makeBlank()
Initializes data to null pixel values.
16 bit unsigned integer (15 bits used)
void getDims(const ossimIrect &rect, kdu_core::kdu_dims &dims)
Convenience method to convert ossimIrect to kdu_dims.
virtual ossim_uint32 getSize() const
Returns the total number of pixels in a tile for all bands.
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
ossim_int32 x
Definition: ossimIpt.h:141
8 bit unsigned integer
16 bit unsigned integer (11 bits used)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ cosd()

double ossim::cosd ( double  x)
inline

◆ defaultMax()

double ossim::defaultMax ( ossimScalarType  scalarType)

Definition at line 152 of file ossimCommon.cpp.

References OSSIM_DEFAULT_MAX_PIX_DOUBLE, OSSIM_DEFAULT_MAX_PIX_FLOAT, OSSIM_DEFAULT_MAX_PIX_NORM_DOUBLE, OSSIM_DEFAULT_MAX_PIX_NORM_FLOAT, OSSIM_DEFAULT_MAX_PIX_SINT16, OSSIM_DEFAULT_MAX_PIX_SINT32, OSSIM_DEFAULT_MAX_PIX_SINT8, OSSIM_DEFAULT_MAX_PIX_UINT11, OSSIM_DEFAULT_MAX_PIX_UINT12, OSSIM_DEFAULT_MAX_PIX_UINT13, OSSIM_DEFAULT_MAX_PIX_UINT14, OSSIM_DEFAULT_MAX_PIX_UINT15, OSSIM_DEFAULT_MAX_PIX_UINT16, OSSIM_DEFAULT_MAX_PIX_UINT32, OSSIM_DEFAULT_MAX_PIX_UINT8, OSSIM_FLOAT32, OSSIM_FLOAT64, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SCALAR_UNKNOWN, OSSIM_SINT16, OSSIM_SINT32, OSSIM_SINT8, OSSIM_UINT11, OSSIM_UINT12, OSSIM_UINT13, OSSIM_UINT14, OSSIM_UINT15, OSSIM_UINT16, OSSIM_UINT32, and OSSIM_UINT8.

Referenced by ossimGdalTileSource::computeMinMax(), ossim3x3ConvolutionFilter::computeNullMinMax(), ossimConvolutionFilter1D::computeNullMinMax(), ossimConvolutionSource::convolve(), ossimImageMetaData::getMaxPix(), ossimImageData::getMaxPix(), ossimCastTileSourceFilter::getMaxPixelValue(), ossimHdf5ImageDataset::getMaxPixelValue(), ossimImageSource::getMaxPixelValue(), ossimImageChain::getMaxPixelValue(), ossimEquationCombiner::getMaxPixelValue(), ossimGdalTileSource::getMaxPixelValue(), ossimImageHandler::getMaxPixelValue(), ossimCastTileSourceFilter::getMinPixelValue(), ossimBandAverageFilter::getMinPixelValue(), ossimHistogramRemapper::initializeClips(), ossimImageData::initializeMaxDefault(), ossimHistogramRemapper::initializeMinMaxOutput(), ossimImageMetaData::setDefaultsForArrays(), ossimHistogramRemapper::setupTable(), ossimImageData::stretchMinMax(), and ossimTiffTileSource::validateMinMaxNull().

153 {
154  switch(scalarType)
155  {
156  case OSSIM_UINT8:
157  {
159  }
160  case OSSIM_SINT8:
161  {
163  }
164  case OSSIM_UINT16:
165  {
167  }
168  case OSSIM_SINT16:
169  {
171  }
172  case OSSIM_UINT11:
173  {
175  }
176  case OSSIM_UINT12:
177  {
179  }
180  case OSSIM_UINT13:
181  {
183  }
184  case OSSIM_UINT14:
185  {
187  }
188  case OSSIM_UINT15:
189  {
191  }
192  case OSSIM_UINT32:
193  {
195  }
196  case OSSIM_SINT32:
197  {
199  }
200  case OSSIM_FLOAT32:
201  {
203  }
205  {
207  }
208  case OSSIM_FLOAT64:
209  {
211  }
213  {
215  }
217  default:
218  {
219  if(traceDebug())
220  {
222  << __FILE__ << ":" << __LINE__
223  << "\nUnhandled scalar type: " << scalarType << std::endl;
224  }
225  break;
226  }
227  }
228  return 0.0; // Should never happen...
229 }
8 bit signed integer
#define OSSIM_DEFAULT_MAX_PIX_UINT16
16 bit unsigned integer (12 bits used)
64 bit floating point
16 bit unsigned integer
#define OSSIM_DEFAULT_MAX_PIX_DOUBLE
16 bit unsigned integer (14 bits used)
16 bit signed integer
16 bit unsigned integer (13 bits used)
32 bit floating point
32 bit unsigned integer
#define OSSIM_DEFAULT_MAX_PIX_UINT32
#define OSSIM_DEFAULT_MAX_PIX_SINT8
#define OSSIM_DEFAULT_MAX_PIX_UINT12
32 bit signed integer
#define OSSIM_DEFAULT_MAX_PIX_UINT15
32 bit normalized floating point
#define OSSIM_DEFAULT_MAX_PIX_UINT13
#define OSSIM_DEFAULT_MAX_PIX_SINT16
#define OSSIM_DEFAULT_MAX_PIX_FLOAT
64 bit normalized floating point
16 bit unsigned integer (15 bits used)
#define OSSIM_DEFAULT_MAX_PIX_UINT14
#define OSSIM_DEFAULT_MAX_PIX_UINT11
#define OSSIM_DEFAULT_MAX_PIX_SINT32
8 bit unsigned integer
#define OSSIM_DEFAULT_MAX_PIX_UINT8
#define OSSIM_DEFAULT_MAX_PIX_NORM_FLOAT
16 bit unsigned integer (11 bits used)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
#define OSSIM_DEFAULT_MAX_PIX_NORM_DOUBLE

◆ defaultMin()

double ossim::defaultMin ( ossimScalarType  scalarType)

Definition at line 73 of file ossimCommon.cpp.

References OSSIM_DEFAULT_MIN_PIX_DOUBLE, OSSIM_DEFAULT_MIN_PIX_FLOAT, OSSIM_DEFAULT_MIN_PIX_NORM_DOUBLE, OSSIM_DEFAULT_MIN_PIX_NORM_FLOAT, OSSIM_DEFAULT_MIN_PIX_SINT16, OSSIM_DEFAULT_MIN_PIX_SINT32, OSSIM_DEFAULT_MIN_PIX_SINT8, OSSIM_DEFAULT_MIN_PIX_UINT11, OSSIM_DEFAULT_MIN_PIX_UINT12, OSSIM_DEFAULT_MIN_PIX_UINT13, OSSIM_DEFAULT_MIN_PIX_UINT14, OSSIM_DEFAULT_MIN_PIX_UINT15, OSSIM_DEFAULT_MIN_PIX_UINT16, OSSIM_DEFAULT_MIN_PIX_UINT32, OSSIM_DEFAULT_MIN_PIX_UINT8, OSSIM_FLOAT32, OSSIM_FLOAT64, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SCALAR_UNKNOWN, OSSIM_SINT16, OSSIM_SINT32, OSSIM_SINT8, OSSIM_UINT16, OSSIM_UINT32, OSSIM_UINT8, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, and OSSIM_USHORT15.

Referenced by ossimGdalTileSource::computeMinMax(), ossim3x3ConvolutionFilter::computeNullMinMax(), ossimConvolutionFilter1D::computeNullMinMax(), ossimConvolutionSource::convolve(), ossimCastTileSourceFilter::getMaxPixelValue(), ossimBandAverageFilter::getMaxPixelValue(), ossimImageMetaData::getMinPix(), ossimImageData::getMinPix(), ossimCastTileSourceFilter::getMinPixelValue(), ossimHdf5ImageDataset::getMinPixelValue(), ossimImageSource::getMinPixelValue(), ossimImageChain::getMinPixelValue(), ossimEquationCombiner::getMinPixelValue(), ossimGdalTileSource::getMinPixelValue(), ossimImageHandler::getMinPixelValue(), ossimHistogramRemapper::initializeClips(), ossimImageData::initializeMinDefault(), ossimHistogramRemapper::initializeMinMaxOutput(), ossimPiecewiseRemapper::initMinMax(), ossimImageMetaData::setDefaultsForArrays(), ossimHistogramRemapper::setupTable(), ossimImageData::stretchMinMax(), and ossimTiffTileSource::validateMinMaxNull().

74 {
75  switch(scalarType)
76  {
77  case OSSIM_UINT8:
78  {
80  }
81  case OSSIM_SINT8:
82  {
84  }
85  case OSSIM_UINT16:
86  {
88  }
89  case OSSIM_SINT16:
90  {
92  }
93  case OSSIM_USHORT11:
94  {
96  }
97  case OSSIM_USHORT12:
98  {
100  }
101  case OSSIM_USHORT13:
102  {
104  }
105  case OSSIM_USHORT14:
106  {
108  }
109  case OSSIM_USHORT15:
110  {
112  }
113  case OSSIM_UINT32:
114  {
116  }
117  case OSSIM_SINT32:
118  {
120  }
121  case OSSIM_FLOAT32:
122  {
124  }
126  {
128  }
129  case OSSIM_FLOAT64:
130  {
132  }
134  {
136  }
138  default:
139  {
140  if(traceDebug())
141  {
143  << __FILE__ << ":" << __LINE__
144  << "\nUnhandled scalar type: " << scalarType << std::endl;
145  }
146  break;
147  }
148  }
149  return 0.0; // Should never happen...
150 }
16 bit unsigned integer (15 bits used)
8 bit signed integer
#define OSSIM_DEFAULT_MIN_PIX_UINT13
64 bit floating point
16 bit unsigned integer
#define OSSIM_DEFAULT_MIN_PIX_UINT32
#define OSSIM_DEFAULT_MIN_PIX_UINT11
#define OSSIM_DEFAULT_MIN_PIX_UINT15
16 bit signed integer
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
#define OSSIM_DEFAULT_MIN_PIX_UINT16
32 bit floating point
32 bit unsigned integer
#define OSSIM_DEFAULT_MIN_PIX_SINT32
#define OSSIM_DEFAULT_MIN_PIX_SINT16
#define OSSIM_DEFAULT_MIN_PIX_DOUBLE
32 bit signed integer
32 bit normalized floating point
#define OSSIM_DEFAULT_MIN_PIX_UINT14
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
#define OSSIM_DEFAULT_MIN_PIX_FLOAT
#define OSSIM_DEFAULT_MIN_PIX_NORM_DOUBLE
#define OSSIM_DEFAULT_MIN_PIX_UINT12
#define OSSIM_DEFAULT_MIN_PIX_UINT8
#define OSSIM_DEFAULT_MIN_PIX_NORM_FLOAT
#define OSSIM_DEFAULT_MIN_PIX_SINT8
8 bit unsigned integer
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
16 bit unsigned integer (12 bits used)

◆ defaultNull()

double ossim::defaultNull ( ossimScalarType  scalarType)

Definition at line 231 of file ossimCommon.cpp.

References OSSIM_DEFAULT_NULL_PIX_DOUBLE, OSSIM_DEFAULT_NULL_PIX_FLOAT, OSSIM_DEFAULT_NULL_PIX_NORM_DOUBLE, OSSIM_DEFAULT_NULL_PIX_NORM_FLOAT, OSSIM_DEFAULT_NULL_PIX_SINT16, OSSIM_DEFAULT_NULL_PIX_SINT32, OSSIM_DEFAULT_NULL_PIX_SINT8, OSSIM_DEFAULT_NULL_PIX_UINT11, OSSIM_DEFAULT_NULL_PIX_UINT12, OSSIM_DEFAULT_NULL_PIX_UINT13, OSSIM_DEFAULT_NULL_PIX_UINT14, OSSIM_DEFAULT_NULL_PIX_UINT15, OSSIM_DEFAULT_NULL_PIX_UINT16, OSSIM_DEFAULT_NULL_PIX_UINT32, OSSIM_DEFAULT_NULL_PIX_UINT8, OSSIM_FLOAT32, OSSIM_FLOAT64, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SCALAR_UNKNOWN, OSSIM_SINT16, OSSIM_SINT32, OSSIM_SINT8, OSSIM_UINT11, OSSIM_UINT12, OSSIM_UINT13, OSSIM_UINT14, OSSIM_UINT15, OSSIM_UINT16, OSSIM_UINT32, and OSSIM_UINT8.

Referenced by ossimGdalTileSource::computeMinMax(), ossimImageData::computeMinMaxNulPix(), ossimSrtmSupportData::computeMinMaxTemplate(), ossim3x3ConvolutionFilter::computeNullMinMax(), ossimConvolutionFilter1D::computeNullMinMax(), ossimImageMetaData::getNullPix(), ossimImageData::getNullPix(), ossim3x3ConvolutionFilter::getNullPixelValue(), ossimCastTileSourceFilter::getNullPixelValue(), ossimConvolutionFilter1D::getNullPixelValue(), ossimImageSource::getNullPixelValue(), ossimImageChain::getNullPixelValue(), ossimEquationCombiner::getNullPixelValue(), ossimGdalTileSource::getNullPixelValue(), ossimImageHandler::getNullPixelValue(), ossimImageData::initializeNullDefault(), ossimImageMetaData::setDefaultsForArrays(), ossimImageData::stretchMinMax(), and ossimTiffTileSource::validateMinMaxNull().

232 {
233  switch(scalarType)
234  {
235  case OSSIM_UINT8:
236  {
238  }
239  case OSSIM_SINT8:
240  {
242  }
243  case OSSIM_UINT16:
244  {
246  }
247  case OSSIM_SINT16:
248  {
250  }
251  case OSSIM_UINT11:
252  {
254  }
255  case OSSIM_UINT12:
256  {
258  }
259  case OSSIM_UINT13:
260  {
262  }
263  case OSSIM_UINT14:
264  {
266  }
267  case OSSIM_UINT15:
268  {
270  }
271  case OSSIM_UINT32:
272  {
274  }
275  case OSSIM_SINT32:
276  {
278  }
279  case OSSIM_FLOAT32:
280  {
282  }
284  {
286  }
287  case OSSIM_FLOAT64:
288  {
290  }
292  {
294  }
296  default:
297  {
298  if(traceDebug())
299  {
301  << __FILE__ << ":" << __LINE__
302  << "\nUnhandled scalar type: " << scalarType << std::endl;
303  }
304  break;
305  }
306  }
307 
308  return 0.0; // Should never happen...
309 }
8 bit signed integer
#define OSSIM_DEFAULT_NULL_PIX_UINT14
16 bit unsigned integer (12 bits used)
#define OSSIM_DEFAULT_NULL_PIX_UINT16
64 bit floating point
16 bit unsigned integer
#define OSSIM_DEFAULT_NULL_PIX_UINT13
16 bit unsigned integer (14 bits used)
#define OSSIM_DEFAULT_NULL_PIX_SINT16
16 bit signed integer
16 bit unsigned integer (13 bits used)
32 bit floating point
32 bit unsigned integer
#define OSSIM_DEFAULT_NULL_PIX_SINT8
#define OSSIM_DEFAULT_NULL_PIX_UINT32
#define OSSIM_DEFAULT_NULL_PIX_DOUBLE
#define OSSIM_DEFAULT_NULL_PIX_UINT15
32 bit signed integer
32 bit normalized floating point
#define OSSIM_DEFAULT_NULL_PIX_UINT11
#define OSSIM_DEFAULT_NULL_PIX_NORM_FLOAT
64 bit normalized floating point
16 bit unsigned integer (15 bits used)
#define OSSIM_DEFAULT_NULL_PIX_FLOAT
8 bit unsigned integer
#define OSSIM_DEFAULT_NULL_PIX_UINT12
#define OSSIM_DEFAULT_NULL_PIX_NORM_DOUBLE
16 bit unsigned integer (11 bits used)
#define OSSIM_DEFAULT_NULL_PIX_SINT32
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
#define OSSIM_DEFAULT_NULL_PIX_UINT8

◆ defaultTileSize()

void ossim::defaultTileSize ( ossimIpt tileSize)

Definition at line 525 of file ossimCommon.cpp.

References ossimPreferences::instance(), OSSIM_DEFAULT_TILE_HEIGHT, OSSIM_DEFAULT_TILE_WIDTH, ossimString::split(), ossimIpt::x, and ossimIpt::y.

Referenced by ossimJpegTileSource::allocate(), ossimPngReader::allocate(), computeLevels(), ossimImageDataFactory::create(), ossimImageSource::getTileHeight(), ossimPointCloudImageHandler::getTileHeight(), ossimGpkgReader::getTileHeight(), ossimNitfTileSource::getTileHeight(), ossimLasReader::getTileHeight(), ossimTiffTileSource::getTileHeight(), ossimPdfWriter::getTileSize(), ossimImageSource::getTileWidth(), ossimPointCloudImageHandler::getTileWidth(), ossimGpkgReader::getTileWidth(), ossimNitfTileSource::getTileWidth(), ossimLasReader::getTileWidth(), ossimTiffTileSource::getTileWidth(), ossimOverviewBuilderBase::initializePreferenceSettings(), ossimKakaduJ2kReader::initializeTile(), ossimKakaduJp2Reader::initializeTile(), ossimTiffWriter::loadState(), ossimCacheTileSource::ossimCacheTileSource(), ossimDtedTileSource::ossimDtedTileSource(), ossimFixedTileCache::ossimFixedTileCache(), ossimImageData::ossimImageData(), ossimImageElevationHandler::ossimImageElevationHandler(), ossimImageSourceSequencer::ossimImageSourceSequencer(), ossimNitfWriter::ossimNitfWriter(), ossimWriter::ossimWriter(), and ossimFixedTileCache::setRect().

526 {
527  const char* tileSizeKw = ossimPreferences::instance()->
528  findPreference("tile_size");
529 
530  if(tileSizeKw)
531  {
532  std::vector<ossimString> splitArray;
533  ossimString tempString(tileSizeKw);
534  tempString.split(splitArray, " ");
535  bool hasX = true;
536  if(splitArray.size() == 2)
537  {
538  tileSize.x = splitArray[0].toInt32();
539  tileSize.y = splitArray[1].toInt32();
540  }
541  else if(splitArray.size() == 1)
542  {
543  tileSize.x = splitArray[0].toInt32();
544  tileSize.y = splitArray[0].toInt32();
545  }
546  else
547  {
548  tileSize = ossimIpt(0,0);
549  }
550  if(tileSize.x < 1)
551  {
552  tileSize.x = OSSIM_DEFAULT_TILE_WIDTH;
553  hasX = false;
554  }
555  if(tileSize.y < 1)
556  {
557  if(!hasX)
558  {
559  tileSize.y = OSSIM_DEFAULT_TILE_HEIGHT;
560  }
561  else
562  {
563  tileSize.y = tileSize.x;
564  }
565  }
566  }
567  else
568  {
569  tileSize.x = OSSIM_DEFAULT_TILE_WIDTH;
570  tileSize.y = OSSIM_DEFAULT_TILE_HEIGHT;
571  }
572 }
#define OSSIM_DEFAULT_TILE_WIDTH
static ossimPreferences * instance()
ossim_int32 y
Definition: ossimIpt.h:142
#define OSSIM_DEFAULT_TILE_HEIGHT
ossim_int32 x
Definition: ossimIpt.h:141

◆ degreesToRadians()

double ossim::degreesToRadians ( double  x)
inline

◆ extractSimpleValues()

bool ossim::extractSimpleValues ( std::vector< ossimString > &  values,
const ossimString stringOfPoints 
)

Generic function to extract a list of values into a vector of string where the string of points is of the form:

(value1,value2, ... , )

Parenthesis are required

Definition at line 948 of file ossimCommon.cpp.

References ossimString::empty(), and skipws().

Referenced by toSimpleVector().

950 {
951  std::istringstream in(stringOfPoints);
952  ossim::skipws(in);
953  bool result = true;
954  if(stringOfPoints.empty()) return result;
955  char c = in.get();
956  ossimString value = "";
957  if(c == '(')
958  {
959  c = (char)in.get();
960  while((c!=')')&&
961  (in.good()))
962  {
963  if(c!= ',')
964  {
965  value += ossimString(c);
966  }
967  else
968  {
969  values.push_back(value);
970  value = "";
971  }
972  ossim::skipws(in);
973  c = in.get();
974  }
975  }
976  if(c!= ')')
977  {
978  result = false;
979  }
980  else
981  {
982  if(!value.empty())
983  {
984  values.push_back(value);
985  }
986  }
987 
988  return result;
989 }
OSSIM_DLL std::istream & skipws(std::istream &in)
Definition: ossimCommon.cpp:38
bool empty() const
Definition: ossimString.h:411
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32

◆ ft2mtrs()

double ossim::ft2mtrs ( double  feet)
inline

Definition at line 372 of file ossimCommon.h.

References MTRS_PER_FT.

Referenced by ossimGeoTiff::convert2meters().

372 { return (feet * MTRS_PER_FT); }
#define MTRS_PER_FT

◆ gcd()

template<class IntType >
IntType ossim::gcd ( IntType  n,
IntType  m 
)

Definition at line 271 of file ossimCommon.h.

References n.

Referenced by gcd< int >(), lcm(), ossimRationalNumber::normalize(), ossimRationalNumber::operator*(), ossimRationalNumber::operator*=(), ossimRationalNumber::operator+(), ossimRationalNumber::operator+=(), ossimRationalNumber::operator-(), and ossimRationalNumber::operator-=().

275  {
276  IntType zero(0); // Avoid repeated construction
277 
278  // This is abs() - given the existence of broken compilers with Koenig
279  // lookup issues and other problems, I code this explicitly. (Remember,
280  // IntType may be a user-defined type).
281  if (n < zero)
282  n = -n;
283  if (m < zero)
284  m = -m;
285 
286  // As n and m are now positive, we can be sure that %= returns a
287  // positive value (the standard guarantees this for built-in types,
288  // and we require it of user-defined types).
289  for (;;) {
290  if (m == zero)
291  return n;
292  n %= m;
293  if (n == zero)
294  return m;
295  m %= n;
296  }
297  }
os2<< "> n<< " > nendobj n

◆ gcd< int >()

template<>
int ossim::gcd< int > ( int  n,
int  m 
)
inline

Definition at line 300 of file ossimCommon.h.

References gcd(), and n.

307  {
308  if (m == 0)
309  return n;
310  else
311  return gcd(m, n % m); // gcc can optimize tail calls right?
312  }
os2<< "> n<< " > nendobj n
IntType gcd(IntType n, IntType m)
Definition: ossimCommon.h:271

◆ getActualBitsPerPixel()

ossim_uint32 ossim::getActualBitsPerPixel ( ossimScalarType  scalarType)

Get actual bits per pixel for a given scalar type.

This is bits used. (OSSIM_USHORT11 = 11)

Returns
The actual bits per pixel. This will return 0 if the input connection is not hooked up or there is an unhandled scalar type.

Definition at line 392 of file ossimCommon.cpp.

References OSSIM_CFLOAT32, OSSIM_CFLOAT64, OSSIM_CINT16, OSSIM_CINT32, OSSIM_FLOAT32, OSSIM_FLOAT64, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SINT16, OSSIM_SINT32, OSSIM_SINT8, OSSIM_UINT16, OSSIM_UINT32, OSSIM_UINT8, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, and OSSIM_USHORT15.

Referenced by ossimOpjCompressor::createOpjImage(), ossimNitf20Writer::writeBlockBandSeparate(), ossimNitfWriter::writeBlockBandSeparate(), ossimNitf20Writer::writeBlockBandSequential(), ossimNitfWriter::writeBlockBandSequential(), and ossimKakaduCompressor::writeTile().

393 {
394  ossim_uint32 actualBitsPerPixel = 0;
395  switch(scalarType)
396  {
397  case OSSIM_UINT8:
398  case OSSIM_SINT8:
399  {
400  actualBitsPerPixel = 8;
401  break;
402  }
403  case OSSIM_USHORT11:
404  {
405  actualBitsPerPixel = 11;
406  break;
407  }
408  case OSSIM_USHORT12:
409  {
410  actualBitsPerPixel = 12;
411  break;
412  }
413  case OSSIM_USHORT13:
414  {
415  actualBitsPerPixel = 13;
416  break;
417  }
418  case OSSIM_USHORT14:
419  {
420  actualBitsPerPixel = 14;
421  break;
422  }
423  case OSSIM_USHORT15:
424  {
425  actualBitsPerPixel = 15;
426  break;
427  }
428  case OSSIM_UINT16:
429  case OSSIM_SINT16:
430  {
431  actualBitsPerPixel = 16;
432  break;
433  }
434  case OSSIM_UINT32:
435  case OSSIM_SINT32:
436  case OSSIM_FLOAT32:
437  case OSSIM_CINT16:
439  {
440  actualBitsPerPixel = 32;
441  break;
442  }
443  case OSSIM_FLOAT64:
444  case OSSIM_CFLOAT32:
445  case OSSIM_CINT32:
447  {
448  actualBitsPerPixel = 64;
449  break;
450  }
451  case OSSIM_CFLOAT64:
452  {
453  actualBitsPerPixel = 128;
454 
455  break;
456  }
457  default:
458  {
459  if (traceDebug())
460  {
462  << __FILE__ << ":" << __LINE__
463  << "\nUnhandled scalar type: " << scalarType << std::endl;
464  }
465  break;
466  }
467  }
468  return actualBitsPerPixel;
469 }
16 bit unsigned integer (15 bits used)
8 bit signed integer
32 bit complex floating point
64 bit floating point
16 bit unsigned integer
16 bit signed integer
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
32 bit floating point
32 bit unsigned integer
32 bit signed integer
unsigned int ossim_uint32
32 bit normalized floating point
16 bit complex integer
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
64 bit complex floating point
8 bit unsigned integer
32 bit complex integer
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
16 bit unsigned integer (12 bits used)

◆ getBitsPerPixel()

ossim_uint32 ossim::getBitsPerPixel ( ossimScalarType  scalarType)

Get bits per pixel for a given scalar type.

This the total bits per pixel. (OSSIM_USHORT11 = 16)

Returns
The bits per pixel. This will return 0 if the input connection is not hooked up or there is an unhandled scalar type.

Definition at line 471 of file ossimCommon.cpp.

References OSSIM_FLOAT32, OSSIM_FLOAT64, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SINT16, OSSIM_SINT32, OSSIM_SINT8, OSSIM_UINT16, OSSIM_UINT32, OSSIM_UINT8, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, and OSSIM_USHORT15.

Referenced by ossimOpjCompressor::createOpjImage(), ossimNitfCommon::getCompressionRate(), ossimNitf20Writer::writeBlockBandSeparate(), ossimNitfWriter::writeBlockBandSeparate(), ossimNitf20Writer::writeBlockBandSequential(), ossimNitfWriter::writeBlockBandSequential(), and ossimWriter::writeTiffTags().

472 {
473  ossim_uint32 bitsPerPixel = 0;
474  switch(scalarType)
475  {
476  case OSSIM_UINT8:
477  case OSSIM_SINT8:
478  {
479  bitsPerPixel = 8;
480  break;
481  }
482  case OSSIM_USHORT11:
483  case OSSIM_USHORT12:
484  case OSSIM_USHORT13:
485  case OSSIM_USHORT14:
486  case OSSIM_USHORT15:
487  {
488  bitsPerPixel = 16;
489  break;
490  }
491  case OSSIM_UINT16:
492  case OSSIM_SINT16:
493  {
494  bitsPerPixel = 16;
495  break;
496  }
497  case OSSIM_UINT32:
498  case OSSIM_SINT32:
499  case OSSIM_FLOAT32:
501  {
502  bitsPerPixel = 32;
503  break;
504  }
505  case OSSIM_FLOAT64:
507  {
508  bitsPerPixel = 64;
509  break;
510  }
511  default:
512  {
513  if (traceDebug())
514  {
516  << __FILE__ << ":" << __LINE__
517  << "\nUnhandled scalar type: " << scalarType << std::endl;
518  }
519  break;
520  }
521  }
522  return bitsPerPixel;
523 }
16 bit unsigned integer (15 bits used)
8 bit signed integer
64 bit floating point
16 bit unsigned integer
16 bit signed integer
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
32 bit floating point
32 bit unsigned integer
32 bit signed integer
unsigned int ossim_uint32
32 bit normalized floating point
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
8 bit unsigned integer
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
16 bit unsigned integer (12 bits used)

◆ getCodecFormat()

ossim_int32 ossim::getCodecFormat ( std::istream *  str)

Gets codec format from magic number.

Returns
OPJ_CODEC_J2K = 0, OPJ_CODEC_JP2 = 2, OPJ_CODEC_UNKNOWN = -1

Definition at line 479 of file ossimOpjCommon.cpp.

480 {
481  ossim_int32 result = OPJ_CODEC_UNKNOWN; // -1
482 
483  if ( str )
484  {
485  if ( str->good() )
486  {
487  const ossim_uint8 JP2_RFC3745_MAGIC[12] =
488  { 0x00,0x00,0x00,0x0c,0x6a,0x50,0x20,0x20,0x0d,0x0a,0x87,0x0a };
489  const ossim_uint8 JP2_MAGIC[4] = { 0x0d,0x0a,0x87,0x0a };
490  const ossim_uint8 J2K_CODESTREAM_MAGIC[4] = { 0xff,0x4f,0xff,0x51 };
491 
492  ossim_uint8 buf[12];
493 
494  // Read in the box.
495  str->read((char*)buf, 12);
496 
497  if ( ( std::memcmp(buf, JP2_RFC3745_MAGIC, 12) == 0 ) ||
498  ( std::memcmp(buf, JP2_MAGIC, 4) == 0 ) )
499  {
500  result = OPJ_CODEC_JP2;
501  }
502  else if ( std::memcmp(buf, J2K_CODESTREAM_MAGIC, 4) == 0 )
503  {
504  result = OPJ_CODEC_J2K;
505  }
506  }
507  }
508 
509  return result;
510 }
unsigned char ossim_uint8
int ossim_int32

◆ getCodestreamDimensions()

bool ossim::getCodestreamDimensions ( kdu_core::kdu_codestream &  codestream,
std::vector< ossimIrect > &  imageDims,
std::vector< ossimIrect > &  tileDims 
)

Gets image and tile dimensions from codestream for each resolution level (rlevel).

Note that on entry the arrays are cleared so they will be empty on failure.

Parameters
codestreamThe codestream to read from.
imageDimsArray to initialize with image size of each rlevel. This will have any sub image offset applied to it.
tileDimsArray to initialize with tile size of each rlevel. This is zero base tile size. No sub image offset if there is one.
Returns
true on success, false on error.
Note
On entry the arrays are cleared so they will can be empty on failure.

Definition at line 75 of file ossimKakaduCommon.cpp.

References getRect().

78 {
79  bool result = true;
80 
81  imageDims.clear();
82  tileDims.clear();
83 
84  if ( codestream.exists() )
85  {
86  kdu_core::kdu_coords tileIdx(0, 0);
87 
88  ossim_uint32 levels = codestream.get_min_dwt_levels();
89 
90  for (ossim_uint32 level=0; level <= levels; ++level)
91  {
92  // Get the image dimensions.
93 
94  codestream.apply_input_restrictions(
95  0, // first_component
96  0, // max_components (0 = all remaining will appear)
97  level, // highest resolution level
98  0, // max_layers (0 = all layers retained)
99  NULL, // expanded out to block boundary.
100  kdu_core::KDU_WANT_OUTPUT_COMPONENTS);
101 
102  kdu_core::kdu_dims dims;
103  codestream.get_dims(0, dims);
104 
105  // Make the imageRect upper left relative to any sub image offset.
106  ossimIrect imageRect;
107  getRect(dims, imageRect);
108 
109  imageDims.push_back(imageRect);
110 
111  // Get the tile dimensions.
112 
113  kdu_core::kdu_dims mappedRegion;
114  codestream.map_region(0, dims, mappedRegion, true);
115 
116  kdu_core::kdu_tile tile = codestream.open_tile(tileIdx);
117  if ( tile.exists() )
118  {
119  codestream.get_tile_dims( tile.get_tile_idx(), 0, dims );
120 
121  // Make the tile rect zero based.
122  ossimIrect tileRect(0,
123  0,
124  dims.size.x-1,
125  dims.size.y-1);
126 
127  tileDims.push_back(tileRect);
128 
129  // Every open has a close.
130  tile.close();
131  }
132  else
133  {
134  result = false;
135  }
136 
137  } // matches: for (ossim_uint32 level=0; level <= levels; ++level)
138 
139  // Set things back to level 0.
140  codestream.apply_input_restrictions(
141  0, // first_component
142  0, // max_components (0 = all remaining will appear)
143  0, // highest resolution level
144  0, // max_layers (0 = all layers retained)
145  NULL, // expanded out to block boundary.
146  kdu_core::KDU_WANT_OUTPUT_COMPONENTS);
147 
148  // Should be the same sizes as levels.
149  if ( (imageDims.size() != tileDims.size()) ||
150  (tileDims.size() != levels+1) )
151  {
152  result = false;
153  }
154  }
155  else // codestream.exists() == false
156  {
157  result = false;
158  }
159 
160  return result;
161 }
unsigned int ossim_uint32
void getRect(const kdu_core::kdu_dims &dims, ossimIrect &rect)
Convenience method to convert kdu_core::kdu_dims to ossimIrect.

◆ getDims()

void ossim::getDims ( const ossimIrect rect,
kdu_core::kdu_dims &  dims 
)

Convenience method to convert ossimIrect to kdu_dims.

Parameters
rectThe ossimIrect to convert.
dimsThis kdu_dim to initialize.

Definition at line 33 of file ossimKakaduCommon.cpp.

References ossimIrect::height(), ossimIrect::ul(), ossimIrect::width(), ossimIpt::x, and ossimIpt::y.

Referenced by copyRegionToTile().

34 {
35  dims.pos.x = rect.ul().x;
36  dims.pos.y = rect.ul().y;
37  dims.size.x = static_cast<int>(rect.width());
38  dims.size.y = static_cast<int>(rect.height());
39 }
ossim_uint32 height() const
Definition: ossimIrect.h:487
const ossimIpt & ul() const
Definition: ossimIrect.h:274
ossim_uint32 width() const
Definition: ossimIrect.h:500
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141

◆ getFormattedTime()

void ossim::getFormattedTime ( const std::string &  format,
bool  gmtFlag,
std::string &  result 
)

Gets the current time.

Example formats and output: format = "%Y-%m-%dT%H:%M:%SZ" output = "2014-03-06T13:55:10Z"

Parameters
formatE.g. "%Y-%m-%dT%H:%M:%SZ"
gmtFlagIf true get the zulu time; else, gets the local time.
resultInitialized by this with result.

E.g. "2014-03-06T13:55:10Z"

Note
If an error occurs result will be empty.

Definition at line 1204 of file ossimCommon.cpp.

Referenced by ossimFilename::appendTimestamp(), ossimImageUtil::gsubDate(), ossimAutRegUtil::saveAdjustment(), ossimTieMeasurementGenerator::summarizeRun(), and ossimAdjustmentExecutive::summarizeSolution().

1206 {
1207  std::lock_guard<std::mutex> lock(timeMutex);
1208  time_t rawTime;
1209  time(&rawTime);
1210 
1211  struct tm* timeInfo;
1212  if ( gmtFlag )
1213  {
1214  timeInfo = gmtime(&rawTime);
1215  }
1216  else
1217  {
1218  timeInfo = localtime(&rawTime);
1219  }
1220 
1221  size_t size = 0;
1222  if ( timeInfo )
1223  {
1224  const size_t STRING_SIZE = 196; // This is a big time string size.
1225  char outStr[STRING_SIZE];
1226 
1227  size = strftime(outStr, STRING_SIZE, format.c_str(), timeInfo );
1228 
1229  if ( size )
1230  {
1231  // Per strftime spec not needed but null terminating anyway.
1232  outStr[STRING_SIZE-1] = '\0';
1233  result = outStr;
1234  }
1235  }
1236  if ( !size )
1237  {
1238  result.clear();
1239  }
1240 
1241 }
yy_size_t size

◆ getNumberOfThreads()

ossim_uint32 ossim::getNumberOfThreads ( )

Get the number threads to use from ossimPreferences or ossim::Thread.

Keyword searched for is: "ossim_threads"

If keyword is not found ossim::Thread::getNumberOfProcessors() is used.

Returns
Number of threads. Default=1

Definition at line 1185 of file ossimCommon.cpp.

References ossimPreferences::findPreference(), ossim::Thread::getNumberOfProcessors(), ossimPreferences::instance(), and ossimString::toUInt32().

Referenced by ossimHlzTool::computeHLZ(), ossimViewshedTool::computeViewshed(), and ossimMultiThreadSequencer::setToStartOfSequence().

1186 {
1187  ossim_uint32 result;
1188  const char* str = ossimPreferences::instance()->findPreference("ossim_threads");
1189  if ( str )
1190  {
1191  result = ossimString(str).toUInt32();
1192  }
1193  else
1194  {
1195  result = static_cast<ossim_uint32>( ossim::Thread::getNumberOfProcessors() );
1196  }
1197  if ( !result )
1198  {
1199  result = 1;
1200  }
1201  return result;
1202 }
ossim_uint32 toUInt32() const
const char * findPreference(const char *key) const
unsigned int ossim_uint32
static ossim_uint64 getNumberOfProcessors()
Utility to return the number of processors (concurrent threads)
Definition: Thread.cpp:88
static ossimPreferences * instance()

◆ getProgressionOrderString()

std::string ossim::getProgressionOrderString ( ossim_int32  prog_order)

Definition at line 886 of file ossimOpjCommon.cpp.

Referenced by print().

887 {
888  std::string result = "";
889  switch (prog_order)
890  {
891  case OPJ_LRCP:
892  {
893  result = "LRCP";
894  break;
895  }
896  case OPJ_RLCP:
897  {
898  result = "RLCP";
899  break;
900  }
901  case OPJ_RPCL:
902  {
903  result = "RPCL";
904  break;
905  }
906  case OPJ_PCRL:
907  {
908  result = "PCRL";
909  break;
910  }
911  case OPJ_CPRL:
912  {
913  result = "CPRL";
914  break;
915  }
916  default:
917  {
918  result = "UNKOWN";
919  break;
920  }
921  }
922 
923  return result;
924 }

◆ getRect()

void ossim::getRect ( const kdu_core::kdu_dims &  dims,
ossimIrect rect 
)

Convenience method to convert kdu_core::kdu_dims to ossimIrect.

Parameters
dimsThis kdu_dim to convert.
rectThe ossimIrect to initialize.

Definition at line 41 of file ossimKakaduCommon.cpp.

Referenced by getCodestreamDimensions().

42 {
43  rect = ossimIrect(dims.pos.x,
44  dims.pos.y,
45  dims.pos.x + dims.size.x - 1,
46  dims.pos.y + dims.size.y - 1);
47 }

◆ getTime()

ossim_int64 ossim::getTime ( )

Gets the current time.

Wrapper around time.h time_t time(time_t *t) with a mutex lock.

Note that time_t is a long int. Returning ossim_int64 to avoid include of time.h.

Returns
The time as the number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).

Definition at line 1243 of file ossimCommon.cpp.

Referenced by ossimFilename::lastAccessed(), and ossimImageHandlerMtAdaptor::writeTime().

1244 {
1245  std::lock_guard<std::mutex> lock(timeMutex);
1246  time_t rawTime;
1247 
1248  time(&rawTime);
1249 
1250  return (ossim_int64)rawTime;
1251 }
long long ossim_int64

◆ inInterval()

template<class T >
bool ossim::inInterval ( x,
a,
b 
)
inline

Definition at line 58 of file ossimCommon.h.

References x.

60  { return x >= a && x <= b; }
ossim_uint32 x

◆ inOpenInterval()

template<class T >
bool ossim::inOpenInterval ( x,
a,
b 
)
inline

Definition at line 63 of file ossimCommon.h.

References x.

65  { return x > a && x < b; }
ossim_uint32 x

◆ inverseLerp()

template<class T >
T ossim::inverseLerp ( x,
begin,
end 
)
inline

Definition at line 152 of file ossimCommon.h.

References isnan(), and x.

155  { return begin == end ? (ossim::isnan(x) ? x : T(0)) : (x - begin)/(end - begin); }
ossim_uint32 x
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ isnan() [1/2]

bool ossim::isnan ( const float &  v)
inline

isnan Test for floating point Not A Number (NAN) value.

This should be used test for nan. DO NOT USE operator==. Like "if (height == ossim::nan())"

Returns
true if nan, false if not.
See also
nan()

Definition at line 91 of file ossimCommon.h.

References isnan().

Referenced by ossimKakaduNitfReader::allocateBuffers(), ossimGpt::changeDatum(), clamp(), ossimPositionQualityEvaluator::computeElevAzim(), ossimImageGeometry::computeGroundToImagePartials(), ATP::AtpGenerator::constructChain(), RadialProcessor::doRadial(), ossimGeoidNgs::ellipsoidToGeoidHeight(), ossimGeoidEgm96::ellipsoidToGeoidHeight(), ossimNitfTileSource::establishDecimationFactors(), ossimPositionQualityEvaluator::extractErrorEllipse(), ossimQuadProjection::extrapolate(), ossimPixelFlipper::flipPixels(), ossimGeoidNgs::geoidToEllipsoidHeight(), ossimGeoidEgm96::geoidToEllipsoidHeight(), ossimRpcModel::getForwardDeriv(), ossimTieGptSet::getGroundBoundaries(), ossimElevManager::getHeightAboveEllipsoid(), ossimImageElevationDatabase::getHeightAboveEllipsoid(), ossimElevManager::getHeightAboveMSL(), ossimPdfWriter::getLgiDictCtm(), ossimShiftFilter::getMaxPixelValue(), ossimImageCacheTileSource::getMaxPixelValue(), ossimKakaduNitfReader::getMaxPixelValue(), ossimNitfUse00aTag::getMeanGsdInMeters(), ossimNitfPiaimcTag::getMeanGsdInMeters(), ossimElevManager::getMeanSpacingMeters(), ossimShiftFilter::getMinPixelValue(), ossimImageCacheTileSource::getMinPixelValue(), ossimKakaduNitfReader::getMinPixelValue(), ossimGpkgTileEntry::getNewMapProjection(), ossimShiftFilter::getNullPixelValue(), ossimImageCacheTileSource::getNullPixelValue(), ossimKakaduNitfReader::getNullPixelValue(), ossimElevationDatabase::getOffsetFromEllipsoid(), ossimIntensityAdjustmentFilter::getTile(), ossimBrightnessMatch::getTile(), ossimShiftFilter::getTile(), ossimH5GridModel::getWktFootprint(), ossimTDpt::hasNans(), ossimFpt::hasNans(), ossimDpt3d::hasNans(), ossimDpt::hasNans(), ossimEcefPoint::hasNans(), ossimTieGpt::hasNans(), ossimEcefVector::hasNans(), ossimLsrPoint::hasNans(), ossimLsrVector::hasNans(), ossimPointObservation::hasNans(), ossimGpt::hasNans(), ossimElevationAccuracyInfo::hasValidAbsoluteError(), ossimElevationAccuracyInfo::hasValidRelativeError(), ossimHistogramEqualization::initializeLuts(), ATP::AtpTileSource::initializeStaticMembers(), ossimSonomaSensor::intersectRay(), inverseLerp(), ossimGpt::isEqualTo(), ossimGpt::isHgtNan(), ossimGpt::isLatLonNan(), ossimGpt::isLatNan(), ossimGrect::isLonLatNan(), ossimGpt::isLonLatNan(), ossimGpt::isLonNan(), ossimTDpt::isNan(), ossimDpt::isNan(), ossimEcefPoint::isNan(), ossimTieGpt::isNan(), ossimEcefVector::isNan(), ossimPointObservation::isNan(), ossimGpt::isNan(), ossimHlzTool::LsFitPatchProcessorJob::level1Test(), ossimHlzTool::NormPatchProcessorJob::level1Test(), ossimPpjFrameSensor::lineSampleHeightToWorld(), ossimPolynomProjection::lineSampleHeightToWorld(), ossimRsmModel::lineSampleHeightToWorld(), ossimBilinearProjection::lineSampleHeightToWorld(), ossimSonomaSensor::lineSampleHeightToWorld(), ossimSarModel::lineSampleHeightToWorld(), ossimRpcModel::lineSampleHeightToWorld(), ossimSrtmFilename::ll(), ossimIpodSensor::loadState(), ossimSkyBoxLearSensor::loadState(), ossimSonomaSensor::loadState(), ossimSrtmFilename::lr(), max< ossim_float32 >(), max< ossim_float64 >(), min< ossim_float32 >(), min< ossim_float64 >(), ossimDatum::molodenskyShift(), ossimGeoidManager::offsetFromEllipsoid(), ossimPolynomProjection::optimizeFit(), ossimInfo::outputHeight(), ossimNitfFile::print(), ossimTDpt::print(), ossimObservationSet::print(), ossimTieGpt::print(), ossimDpt::print(), ossimPointObservation::print(), ossimMapProjection::print(), ossimResampler::resamplePartialTile(), round(), ossimPointCloudImageHandler::setGSD(), ossimHistogramRemapper::setHighClipPoint(), ossimHistogramRemapper::setLowClipPoint(), ossimRangeDomeTileSource::setProperty(), ossimPointCloudImageHandler::setProperty(), ossimHistogramRemapper::setupTable(), sgn(), sgn< ossim_float32 >(), ossimNadconNarDatum::shift(), ossimRpcSolver::solveCoefficients(), ossimDpt::toString(), ossimDpt3d::toString(), ossimColumnVector3d::toString(), ossimString::toString(), ossimSrtmFilename::ul(), ossimImageGeometry::upIsUpAngle(), ossimSrtmFilename::ur(), ossimTiffTileSource::validateMinMaxNull(), ossimRsmModel::worldToLineSample(), ossimPolynomProjection::worldToLineSample(), ossimH5GridModel::worldToLineSample(), ossimSensorModel::worldToLineSample(), and wrap().

91 { return ( std::isnan(v) ); }
bool isnan(const double &v)
Definition: ossimCommon.h:92

◆ isnan() [2/2]

bool ossim::isnan ( const double &  v)
inline

Definition at line 92 of file ossimCommon.h.

Referenced by isnan().

92 { return ( std::isnan(v) ); }
bool isnan(const double &v)
Definition: ossimCommon.h:92

◆ isSigned()

bool ossim::isSigned ( ossimScalarType  scalarType)
Returns
true if scalar type is signed, false if not.

Definition at line 370 of file ossimCommon.cpp.

References OSSIM_FLOAT32, OSSIM_FLOAT64, OSSIM_SINT16, OSSIM_SINT32, and OSSIM_SINT8.

Referenced by ossimOpjCompressor::createOpjImage(), ossimJ2kSizRecord::getScalarType(), ossimHdf5::getScalarType(), ossim_hdf5::getScalarType(), ossim_hdf5::printAttribute(), ossim_hdf5::printIntType(), ossim_hdf5::printObject(), and ossimKakaduCompressor::writeTile().

371 {
372  bool result = false;
373  switch(scalarType)
374  {
375  case OSSIM_SINT8:
376  case OSSIM_SINT16:
377  case OSSIM_SINT32:
378  case OSSIM_FLOAT32:
379  case OSSIM_FLOAT64:
380  {
381  result = true;
382  break;
383  }
384  default:
385  {
386  break;
387  }
388  }
389  return result;
390 }
8 bit signed integer
64 bit floating point
16 bit signed integer
32 bit floating point
32 bit signed integer

◆ isWhiteSpace()

bool ossim::isWhiteSpace ( int  c)

Definition at line 49 of file ossimCommon.cpp.

Referenced by skipws().

50 {
51  return ( (c == ' ') || (c == '\t') || (c == '\n')|| (c == '\r') ) ;
52 }

◆ lcm()

template<class IntType >
IntType ossim::lcm ( IntType  n,
IntType  m 
)

Definition at line 315 of file ossimCommon.h.

References gcd(), and n.

319  {
320  IntType zero(0); // Avoid repeated construction
321 
322  if (n == zero || m == zero) {
323  return zero;
324  } else {
325  n /= gcd(n, m);
326  n *= m;
327  if (n < zero)
328  n = -n;
329  return n;
330  }
331  }
os2<< "> n<< " > nendobj n
IntType gcd(IntType n, IntType m)
Definition: ossimCommon.h:271

◆ lerp()

template<class S , class T >
T ossim::lerp ( x,
begin,
end 
)
inline

Definition at line 147 of file ossimCommon.h.

References x.

149  { return x*(end - begin) + begin; }
ossim_uint32 x

◆ lexQuotedTokens()

void ossim::lexQuotedTokens ( const std::string &  str,
ossim_uint32  start,
const char *  whitespace,
const char *  quotes,
std::vector< std::string > &  tokens,
bool &  unbalancedQuotes 
)

Definition at line 708 of file ossimCommon.cpp.

References ossimREQUIRE.

714 {
715  ossimREQUIRE(whitespace != NULL);
716  ossimREQUIRE(quotes != NULL);
717  ossimREQUIRE(tokens != NULL);
718 
719  const char openQuote(quotes[0]), closeQuote(quotes[1]);
720 
721  tokens.clear();
722  unbalancedQuotes = false;
723 
724  int end=0;
725  while (start < str.length())
726  {
727  if (str[start] == openQuote)
728  {
729  int openBraceCount = 1;
730 
731  if (start+1 < str.length())
732  {
733  start++;
734  if (str[start] != closeQuote)
735  {
736  // end = start+1;
737  end = start;
738  while (static_cast<ossim_uint32>(end) < str.length() &&
739  openBraceCount > 0)
740  {
741  if (str[end] == openQuote)
742  openBraceCount++;
743  else if (str[end] == closeQuote)
744  openBraceCount--;
745  end++;
746  }
747  }
748  else
749  {
750  openBraceCount = 0;
751  start++;
752  end = start+1;
753  }
754  }
755  if (openBraceCount == 0)
756  {
757  tokens.push_back(str.substr(start, end-1-start));
758  }
759  else
760  {
761  unbalancedQuotes = true;
762  end = (int)str.length();
763  }
764  }
765  else if (str[start] == closeQuote)
766  {
767  unbalancedQuotes = true;
768  end = (int)str.length();
769 
770  }
771  else
772  {
773  end = (int)str.find_first_of(whitespace, start);
774  tokens.push_back(str.substr(start, end-start));
775  }
776 
777  start = (ossim_uint32)str.find_first_not_of(whitespace, end);
778  }
779 }
unsigned int ossim_uint32
#define ossimREQUIRE(expr)
Definition: ossimCommon.h:19

◆ matrixToHpr() [1/2]

bool ossim::matrixToHpr ( ossim_float64  hpr[3],
const NEWMAT::Matrix &  rotation 
)

Heading pitch roll extraction from a matrix.

Definition at line 613 of file ossimCommon.cpp.

References asind(), atan2d(), clamp(), cosd(), and ossimDpt3d::length().

Referenced by matrixToHpr().

614 {
615  //implementation converted from plib's sg.cxx
616  //PLIB - A Suite of Portable Game Libraries
617  //Copyright (C) 1998,2002 Steve Baker
618  //For further information visit http://plib.sourceforge.net
619 
620  NEWMAT::Matrix mat(rotation);
621 
622  ossimDpt3d col1(rotation[0][0], rotation[1][0], rotation[2][0]);
623  double s = col1.length();
624 
625  hpr[0] = 0.0;
626  hpr[1] = 0.0;
627  hpr[2] = 0.0;
628 
629  if ( s <= 0.00001 )
630  {
631  return true;
632  }
633 
634 
635  double oneOverS = 1.0f / s;
636  for( int i = 0; i < 3; i++ )
637  for( int j = 0; j < 3; j++ )
638  mat[i][j] = rotation[j][i] * oneOverS;
639 
640 
641  hpr[1] = ossim::asind(ossim::clamp(mat[1][2], -1.0, 1.0));
642 
643  double cp = ossim::cosd(hpr[1]);
644 
645  if ( cp > -0.00001 && cp < 0.00001 )
646  {
647  double cr = ossim::clamp(mat[0][1], -1.0, 1.0);
648  double sr = ossim::clamp(-mat[2][1], -1.0, 1.0);
649 
650  hpr[0] = 0.0f;
651  hpr[2] = ossim::atan2d(sr,cr);
652  }
653  else
654  {
655  cp = 1.0 / cp;
656  double sr = ossim::clamp((-mat[0][2] * cp), -1.0,1.0);
657  double cr = ossim::clamp((mat[2][2] * cp), -1.0, 1.0);
658  double sh = ossim::clamp((-mat[1][0] * cp), -1.0, 1.0);
659  double ch = ossim::clamp((mat[1][1] * cp), -1.0, 1.0);
660 
661  if ( (sh == 0.0f && ch == 0.0f) || (sr == 0.0f && cr == 0.0f) )
662  {
663  cr = ossim::clamp(mat[0][1], -1.0, 1.0);
664  sr = ossim::clamp(-mat[2][1], -1.0, 1.0);
665 
666  hpr[0] = 0.0f;
667  }
668  else
669  {
670  hpr[0] = ossim::atan2d(sh, ch);
671  }
672 
673  hpr[2] = ossim::atan2d(sr, cr);
674  }
675 
676  hpr[0] *= -1.0;
677  return true;
678 }
double asind(double x)
Definition: ossimCommon.h:265
T clamp(T x, T a, T b)
Definition: ossimCommon.h:168
double atan2d(double y, double x)
Definition: ossimCommon.h:267
double cosd(double x)
Definition: ossimCommon.h:259

◆ matrixToHpr() [2/2]

bool ossim::matrixToHpr ( ossim_float64  hpr[3],
const NEWMAT::Matrix &  lsrMatrix,
const NEWMAT::Matrix &  rotationalMatrix 
)

Heading pitch roll extraction from a matrix.

Definition at line 680 of file ossimCommon.cpp.

References abs, FLT_EPSILON, and matrixToHpr().

683 {
684  bool result = false;
685  NEWMAT::Matrix invertLsr(lsrMatrix.i());
686 
687  hpr[0] = 0.0;
688  hpr[1] = 0.0;
689  hpr[2] = 0.0;
690  result = matrixToHpr(hpr, invertLsr*rotationalMatrix);
691  if(std::abs(hpr[0]) < FLT_EPSILON)
692  {
693  hpr[0] = 0.0;
694  }
695  if(std::abs(hpr[1]) < FLT_EPSILON)
696  {
697  hpr[1] = 0.0;
698  }
699  if(std::abs(hpr[2]) < FLT_EPSILON)
700  {
701  hpr[2] = 0.0;
702  }
703 
704  return result;
705 }
#define abs(a)
Definition: auxiliary.h:74
#define FLT_EPSILON
OSSIM_DLL bool matrixToHpr(ossim_float64 hpr[3], const NEWMAT::Matrix &rotation)
Heading pitch roll extraction from a matrix.

◆ max()

template<class T >
T ossim::max ( a,
b 
)
inline

◆ max< ossim_float32 >()

template<>
ossim_float32 ossim::max< ossim_float32 > ( ossim_float32  a,
ossim_float32  b 
)
inline

Definition at line 242 of file ossimCommon.h.

References isnan().

243  {
244  if (ossim::isnan(b))
245  return b;
246  else
247  return (a < b) ? b : a;
248  }
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ max< ossim_float64 >()

template<>
ossim_float64 ossim::max< ossim_float64 > ( ossim_float64  a,
ossim_float64  b 
)
inline

Definition at line 250 of file ossimCommon.h.

References isnan().

Referenced by ossimGrect::clipToRect(), and ossimGpkgWriter::initializeRect().

251  {
252  if (ossim::isnan(b))
253  return b;
254  else
255  return (a < b) ? b : a;
256  }
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ memClear() [1/2]

template<class T >
void ossim::memClear ( T &  var,
int  z = 0 
)
inline

Definition at line 390 of file ossimCommon.h.

392  { memset(&var, z, sizeof(T)); }

◆ memClear() [2/2]

template<class T >
void ossim::memClear ( T *  var)
inline

Definition at line 395 of file ossimCommon.h.

References ossimSTATIC_CHECK.

397  { ossimSTATIC_CHECK(false, YOU_PROBABLY_WANT_TO_MEMCLEAR_WHAT_THE_POINTER_POINTS_TO_NOT_THE_POINTER_ITSELF); }
#define ossimSTATIC_CHECK(expr, msg)
Definition: ossimCommon.h:22

◆ min()

template<class T >
T ossim::min ( a,
b 
)
inline

◆ min< ossim_float32 >()

template<>
ossim_float32 ossim::min< ossim_float32 > ( ossim_float32  a,
ossim_float32  b 
)
inline

Definition at line 210 of file ossimCommon.h.

References isnan(), and nan().

211  {
212  if (ossim::isnan(a)||ossim::isnan(b))
213  {
214  return ossim::nan();
215  }
216  else
217  {
218  return (a < b) ? a : b;
219  }
220  }
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ min< ossim_float64 >()

template<>
ossim_float64 ossim::min< ossim_float64 > ( ossim_float64  a,
ossim_float64  b 
)
inline

Definition at line 223 of file ossimCommon.h.

References isnan(), and nan().

Referenced by ossimGrect::clipToRect(), ossimElevationCellDatabase::getCellsForBounds(), and ossimGpkgWriter::initializeRect().

224  {
225  if (ossim::isnan(a)||ossim::isnan(b))
226  {
227  return ossim::nan();
228  }
229  else
230  {
231  return (a < b) ? a : b;
232  }
233  }
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ mtrs2ft()

double ossim::mtrs2ft ( double  meters)
inline

Definition at line 374 of file ossimCommon.h.

References MTRS_PER_FT.

374 { return (meters / MTRS_PER_FT); }
#define MTRS_PER_FT

◆ mtrs2usft()

double ossim::mtrs2usft ( double  meters)
inline

◆ nan()

double ossim::nan ( )
inline

Method to return ieee floating point double precision NAN.

Returns
ieee floating point double precision NAN.
See also
isnan()
Note
casts seamlessly to float and long double.
Use ossim::isnan(v) to test for nan. Like "if (isnan(myDoubleValue)) { doSomething; }" DO NOT USE operator==. Like "if (myDoubleValue == ossim::nan())"

Definition at line 135 of file ossimCommon.h.

Referenced by ossimLsrVector::angleTo(), ossim::JsonParam::asFloat(), ossimVpfAnnotationFeatureInfo::buildPointFeature(), ossimVpfAnnotationFeatureInfo::buildTxtFeature(), ossimDtedHandler::DtedHeight::calcHeight(), ossimSrtmSupportData::clear(), ossimFormosatDimapSupportData::clearFields(), ossimSpotDimapSupportData::clearFields(), ossimVideoSource::computeFrameTime(), ossimUnitConversionTool::computeMeters(), ATP::AtpTileSource::computeParallax(), ossimSpotDimapSupportData::convertTimeStamp(), ossimFormosatDimapSupportData::convertTimeStamp(), ossimLsrVector::cross(), ossimGeoidNgs::deltaHeight(), ossimLsrVector::dot(), ossimQuadProjection::extrapolate(), ossimTiledElevationDatabase::fillGrid(), ossimIgenGenerator::generateGeoTiledSpecList(), ossimSpotDimapSupportData::getAttSampTime(), ossimFormosatDimapSupportData::getAttSampTime(), ossimShapeObject::getBounds(), ossimPolyLine::getBounds(), ossimShapeFile::getBounds(), ossimChipperUtil::getCentralMeridian(), ossimKakaduJ2kReader::getDecimationFactor(), ossimNitfImageHeader::getDecimationFactor(), ossimSpotDimapSupportData::getEphSampTime(), ossimFormosatDimapSupportData::getEphSampTime(), ossimPointRecord::getField(), ossimPointBlock::getFieldMax(), ossimPointBlock::getFieldMin(), ossimPolygon::getFloatBounds(), ossimNitfRpcModel::getGsd(), ossimSrtmElevationDatabase::getHeightAboveEllipsoid(), ossimDtedElevationDatabase::getHeightAboveEllipsoid(), ossimElevManager::getHeightAboveEllipsoid(), ossimGeneralRasterElevationDatabase::getHeightAboveEllipsoid(), ossimTiledElevationDatabase::getHeightAboveEllipsoid(), ossimSrtmElevationDatabase::getHeightAboveMSL(), ossimImageElevationHandler::getHeightAboveMSL(), ossimDtedElevationDatabase::getHeightAboveMSL(), ossimSrtmHandler::getHeightAboveMSL(), ossimElevManager::getHeightAboveMSL(), ossimGeneralRasterElevationDatabase::getHeightAboveMSL(), ossimImageElevationDatabase::getHeightAboveMSL(), ossimTiledElevationDatabase::getHeightAboveMSL(), ossimDtedHandler::getHeightAboveMSL(), ossimSrtmHandler::getHeightAboveMSLFileTemplate(), ossimGeneralRasterElevHandler::getHeightAboveMSLFileTemplate(), ossimSrtmHandler::getHeightAboveMSLMemoryTemplate(), ossimGeneralRasterElevHandler::getHeightAboveMSLMemoryTemplate(), ossimGeoidNgsHeader::getHeightDelta(), ossimHistogramRemapper::getHighClipPoint(), ossimHistogram::getHighFractionFromValue(), ossimHistogramRemapper::getHighNormalizedClipPoint(), ossimSpotDimapSupportData::getInterpolatedLookAngle(), ossimFormosatDimapSupportData::getInterpolatedLookAngle(), ossimHistogramRemapper::getLowClipPoint(), ossimHistogram::getLowFractionFromValue(), ossimHistogramRemapper::getLowNormalizedClipPoint(), ossimHistogramRemapper::getMaxOutputValue(), ossimBandMergeSource::getMaxPixelValue(), ossimLinearStretchRemapper::getMaxPixelValue(), ossimImageCombiner::getMaxPixelValue(), ossimKMeansClustering::getMaxValue(), ossimMultiBandHistogramTileSource::getMaxValuePercent(), ossimKMeansClustering::getMean(), ossimElevManager::getMeanSpacingMeters(), ossimWarpProjection::getMetersPerPixel(), ossimAffineProjection::getMetersPerPixel(), ossimHistogramRemapper::getMidPoint(), ossimHistogramRemapper::getMinOutputValue(), ossimLinearStretchRemapper::getMinPixelValue(), ossimImageCombiner::getMinPixelValue(), ossimKMeansClustering::getMinValue(), ossimMultiBandHistogramTileSource::getMinValuePercent(), ossimRgbToHsvSource::getNullPixelValue(), ossimRgbToHsiSource::getNullPixelValue(), ossimFftFilter::getNullPixelValue(), ossimBandMergeSource::getNullPixelValue(), ossimChipperUtil::getOriginLatitude(), ossimSpotDimapSupportData::getPixelLookAngleX(), ossimSpotDimapSupportData::getPixelLookAngleY(), ossimImageElevationHandler::getPostValue(), ossimSrtmHandler::getPostValue(), ossimGeneralRasterElevHandler::getPostValue(), ossimChipperUtil::getRotation(), ossimNadconGridFile::getShiftAtLatLon(), ossimKMeansClustering::getSigma(), ossimImageGeometry::getTiePoint(), ossimUnitConversionTool::getValue(), ossimQuickbirdTileInfo::initialize(), ossimQuadProjection::initializeGrids(), ossimHistogramEqualization::initializeLuts(), ossimDblGrid::interpolate(), ossimBngProjection::inverse(), ossimHlzTool::PatchProcessorJob::level2Test(), ossimAdjMapModel::lineSampleHeightToWorld(), ossimQuadProjection::lineSampleToWorld(), ossimBilinearProjection::lineSampleToWorld(), ossimMapProjection::lineSampleToWorld(), ossimPointCloudTool::loadDem(), ossimQuadProjection::loadState(), ossimLsrVector::magnitude(), ossimElevationAccuracyInfo::makeNan(), ossimTDpt::makeNan(), ossimFpt::makeNan(), ossimDpt3d::makeNan(), ossimEcefPoint::makeNan(), ossimDpt::makeNan(), ossimTieGpt::makeNan(), ossimEcefVector::makeNan(), ossimLsrPoint::makeNan(), ossimLsrVector::makeNan(), ossimPointObservation::makeNan(), ossimGpt::makeNan(), ossimTiledElevationDatabase::mapRegion(), min< ossim_float32 >(), min< ossim_float64 >(), ossimImageGeometry::northUpAngle(), ossimGeoidEgm96::offsetFromEllipsoid(), ossimGeoidManager::offsetFromEllipsoid(), ossimGeoidImage::offsetFromEllipsoid(), ossimGeoidImage::offsetFromEllipsoidTemplate(), ossimLsrVector::operator+(), ossimLsrPoint::operator+(), ossimLsrPoint::operator-(), ossimLsrVector::operator-(), operator>>(), ossimApplanixEOFile::ossimApplanixEOFile(), ossimEsriShapeFileFilter::ossimEsriShapeFileFilter(), ossimImageHistogramSource::ossimImageHistogramSource(), ossimLlxyProjection::ossimLlxyProjection(), ossimLsrRay::ossimLsrRay(), ossimPointRecord::ossimPointRecord(), ossimInfo::outputHeight(), ossimQuickbirdRpcModel::parseNitfFile(), ossimResampler::resamplePartialTile(), RTTI_DEF1(), ossimSrtmFilename::setFilename(), ossimGeneralRasterElevHandler::setFilename(), ossimH5GridModel::setGridNodes(), ossimString::toDouble(), ossimString::toFloat32(), ossimString::toFloat64(), ossimDpt3d::toPoint(), ossimColumnVector3d::toPoint(), ossimGeoAnnotationMultiPolyLineObject::transform(), ossimLsrVector::unitVector(), ossimBngProjection::update(), ossimImageGeometry::upIsUpAngle(), and ossimAdjMapModel::worldToLineSample().

135 { return nanValue.bits.floatname; }

◆ operator<<() [1/2]

ostream& ossim::operator<< ( std::ostream &  out,
const JsonParam obj 
)

Definition at line 299 of file JsonConfig.cpp.

References ossim::JsonParam::saveJSON().

300 {
301  Json::Value jsonNode;
302  obj.saveJSON(jsonNode);
303  out << jsonNode << endl;
304  return out;
305 }

◆ operator<<() [2/2]

std::ostream& ossim::operator<< ( std::ostream &  out,
const JsonConfig obj 
)

Definition at line 472 of file JsonConfig.cpp.

References ossim::JsonConfig::saveJSON().

473 {
474  Json::Value configJsonNode;
475  obj.saveJSON(configJsonNode);
476  out<<configJsonNode<<endl;
477  return out;
478 }

◆ opj_decode()

bool ossim::opj_decode ( std::ifstream *  in,
const ossimIrect rect,
ossim_uint32  resLevel,
ossim_int32  format,
std::streamoff  fileOffset,
ossimImageData tile 
)

you may here add custom decoding parameters

Definition at line 143 of file ossimOpjCommon.cpp.

References status.

149 {
150  static const char MODULE[] = "ossimOpjDecoder::decode";
151 
152  bool status = false;
153 
154  if ( traceDebug() )
155  {
157  << MODULE << "entered...\nrect: " << rect
158  << "\nresLevel: " << resLevel << std::endl;
159  }
160 
161  // Need to check for NAN in rect
162  if ( in && tile && !rect.hasNans())
163  {
164  in->seekg( fileOffset, std::ios_base::beg );
165 
166  opj_dparameters_t param;
167  opj_codec_t* codec = 0;
168  opj_image_t* image = 0;;
169  opj_stream_t* stream = 0;
170 
171  opj_user_istream* userStream = new opj_user_istream();
172  userStream->m_str = in;
173  userStream->m_offset = fileOffset;
174 
175  /* Set the length to avoid an assert */
176  in->seekg(0, std::ios_base::end);
177 
178  // Fix: length must be passed in for nift blocks.
179  userStream->m_length = in->tellg();
180 
181  // Set back to front:
182  in->clear();
183  in->seekg(fileOffset, std::ios_base::beg);
184 
185  stream = opj_stream_default_create(OPJ_TRUE);
186  if (!stream)
187  {
188  opj_stream_destroy(stream);
189  std::string errMsg = MODULE;
190  errMsg += " ERROR: opj_setup_decoder failed!";
191  throw ossimException(errMsg);
192  }
193 
194  opj_stream_set_read_function(stream, ossim_opj_istream_read);
195  opj_stream_set_skip_function(stream, ossim_opj_istream_skip);
196  opj_stream_set_seek_function(stream, ossim_opj_istream_seek);
197 
198  // Fix: length must be passed in for nift blocks.
199  opj_stream_set_user_data_length(stream, userStream->m_length);
200 
201  opj_stream_set_user_data(stream, userStream,
202  ossim_opj_free_user_istream_data);
203 
204  opj_stream_set_user_data_length(stream, userStream->m_length);
205 
206 
207  /* Set the default decoding parameters */
208  opj_set_default_decoder_parameters(&param);
209 
210  param.decod_format = format;
211 
213  /* do not use layer decoding limitations */
214  param.cp_layer = 0;
215 
216  /* do not use resolutions reductions */
217  param.cp_reduce = resLevel;
218 
219  codec = opj_create_decompress( (CODEC_FORMAT)format );
220 
221  // catch events using our callbacks and give a local context
222  //opj_set_info_handler (codec, ossim::opj_info_callback, 00);
223  opj_set_info_handler (codec, NULL, 00);
224  opj_set_warning_handler(codec, ossim::opj_warning_callback,00);
225  opj_set_error_handler (codec, ossim::opj_error_callback, 00);
226 
227  // Setup the decoder decoding parameters using user parameters
228  if ( opj_setup_decoder(codec, &param) == false )
229  {
230  opj_stream_destroy(stream);
231  opj_destroy_codec(codec);
232  std::string errMsg = MODULE;
233  errMsg += " ERROR: opj_setup_decoder failed!";
234  throw ossimException(errMsg);
235  }
236 
237  // Read the main header of the codestream and if necessary the JP2 boxes.
238  if ( opj_read_header(stream, codec, &image) == false )
239  {
240  opj_stream_destroy(stream);
241  opj_destroy_codec(codec);
242  opj_image_destroy(image);
243  std::string errMsg = MODULE;
244  errMsg += " ERROR: opj_read_header failed!";
245  throw ossimException(errMsg);
246  }
247 
248  // tmp drb:
249  // opj_stream_destroy(stream);
250  // return;
251 
252  if ( opj_set_decoded_resolution_factor(codec, resLevel) == false)
253  {
254  opj_stream_destroy(stream);
255  opj_destroy_codec(codec);
256  opj_image_destroy(image);
257  std::string errMsg = MODULE;
258  errMsg += " ERROR: opj_set_decoded_resolution_factor failed!";
259  throw ossimException(errMsg);
260  }
261 
262  //ossim_float32 res = resLevel;
263  ossimIrect resRect = rect * (1 << resLevel);
264 
265  //std::cout << "resRect.ul(): " << resRect.ul()
266  // << "\nresRect.lr(): " << resRect.lr()
267  // << std::endl;
268 
269 // if ( opj_set_decode_area(codec, image, rect.ul().x, rect.ul().y,
270 // rect.lr().x+1, rect.lr().y+1) == false )
271  if ( opj_set_decode_area(codec, image, resRect.ul().x, resRect.ul().y,
272  resRect.lr().x+1, resRect.lr().y+1) == false )
273  {
274  opj_stream_destroy(stream);
275  opj_destroy_codec(codec);
276  opj_image_destroy(image);
277  std::string errMsg = MODULE;
278  errMsg += " ERROR: opj_set_decode_area failed!";
279  throw ossimException(errMsg);
280  }
281 
282  // Get the decoded image:
283  if ( opj_decode(codec, stream, image) == false )
284  {
285  opj_stream_destroy(stream);
286  opj_destroy_codec(codec);
287  opj_image_destroy(image);
288  std::string errMsg = MODULE;
289  errMsg += " ERROR: opj_decode failed!";
290  throw ossimException(errMsg);
291  }
292 
293  // ossim::print(std::cout, *image);
294  if(image->icc_profile_buf) {
295 #if defined(OPJ_HAVE_LIBLCMS1) || defined(OPJ_HAVE_LIBLCMS2)
296  color_apply_icc_profile(image); /* FIXME */
297 #endif
298  free(image->icc_profile_buf);
299  image->icc_profile_buf = NULL; image->icc_profile_len = 0;
300  }
301 
302  status = ossim::copyOpjImage(image, tile);
303 
304 #if 0
305  ossim_uint32 tile_index = 0;
306  ossim_uint32 data_size = 0;
307  ossim_int32 current_tile_x0 = 0;
308  ossim_int32 current_tile_y0 = 0;
309  ossim_int32 current_tile_x1 = 0;
310  ossim_int32 current_tile_y1 = 0;
311  ossim_uint32 nb_comps = 0;
312  OPJ_BOOL go_on = 1;
313 
314  if ( opj_read_tile_header( codec,
315  stream,
316  &tile_index,
317  &data_size,
318  &current_tile_x0,
319  &current_tile_y0,
320  &current_tile_x1,
321  &current_tile_y1,
322  &nb_comps,
323  &go_on) == false )
324  {
325  opj_stream_destroy(stream);
326  opj_destroy_codec(codec);
327  opj_image_destroy(image);
328  std::string errMsg = MODULE;
329  errMsg += " ERROR: opj_read_tile_header failed!";
330  throw ossimException(errMsg);
331  }
332 #endif
333 
334 #if 0
335  std::cout << "tile_index: " << tile_index
336  << "\ndata_size: " << data_size
337  << "\ncurrent_tile_x0: " << current_tile_x0
338  << "\ncurrent_tile_y0: " << current_tile_y0
339  << "\ncurrent_tile_x1: " << current_tile_x1
340  << "\ncurrent_tile_y1: " << current_tile_y1
341  << "\nnb_comps: " << nb_comps
342  << std::endl;
343 #endif
344 
345 #if 0
346  if ( opj_decode_tile_data(codec, tile_index,l_data,l_data_size,l_stream) == false)
347  {
348  opj_stream_destroy(l_stream);
349  opj_destroy_codec(l_codec);
350  opj_image_destroy(l_image);
351  std::string errMsg = MODULE;
352  errMsg += " ERROR: opj_read_tile_header failed!";
353  throw ossimException(errMsg);
354  }
355 #endif
356 
357 #if 0
358 
359  if (opj_end_decompress(codec,stream) == false )
360  {
361  opj_stream_destroy(stream);
362  opj_destroy_codec(codec);
363  opj_image_destroy(image);
364  std::string errMsg = MODULE;
365  errMsg += " ERROR: opj_end_decompress failed!";
366  throw ossimException(errMsg);
367  }
368 
369 #endif
370 
371  /* Free memory */
372  opj_stream_destroy(stream);
373  opj_destroy_codec(codec);
374  opj_image_destroy(image);
375 
376  // Tmp drb:
377  if ( in->eof() )
378  {
379  in->clear();
380  }
381  in->seekg(fileOffset, std::ios_base::beg );
382 
383  } // Matches: if ( in && tile )
384 
385  return status;
386 
387 } // End: ossim::opj_decode( ... )
const ossimIpt & ul() const
Definition: ossimIrect.h:274
std::streamsize m_length
void opj_warning_callback(const char *msg, void *)
Callback method for warnings.
void color_apply_icc_profile(opj_image *image)
unsigned int ossim_uint32
std::streamoff m_offset
const ossimIpt & lr() const
Definition: ossimIrect.h:276
bool opj_decode(std::ifstream *in, const ossimIrect &rect, ossim_uint32 resLevel, ossim_int32 format, std::streamoff fileOffset, ossimImageData *tile)
return status
ossim_int32 y
Definition: ossimIpt.h:142
To hold stream and offset.
void opj_error_callback(const char *msg, void *)
Callback method for errors.
bool hasNans() const
Definition: ossimIrect.h:337
ossim_int32 x
Definition: ossimIpt.h:141
bool copyOpjImage(opj_image *image, ossimImageData *tile)
std::istream * m_str
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
int ossim_int32

◆ opj_error_callback()

void ossim::opj_error_callback ( const char *  msg,
void *   
)

Callback method for errors.

Definition at line 46 of file ossimOpjCommon.cpp.

References ossimNotify(), and ossimNotifyLevel_WARN.

Referenced by ossimOpjCompressor::createOpjCodec().

47 {
48  ossimNotify(ossimNotifyLevel_WARN) << msg << std::endl;
49 }
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ opj_info_callback()

void ossim::opj_info_callback ( const char *  msg,
void *   
)

Callback method for info.

Definition at line 58 of file ossimOpjCommon.cpp.

Referenced by ossimOpjCompressor::createOpjCodec().

59 {
60  //ossimNotify(ossimNotifyLevel_NOTICE) << msg << std::endl;
61 }

◆ opj_warning_callback()

void ossim::opj_warning_callback ( const char *  msg,
void *   
)

Callback method for warnings.

Definition at line 52 of file ossimOpjCommon.cpp.

References ossimNotify(), and ossimNotifyLevel_WARN.

Referenced by ossimOpjCompressor::createOpjCodec().

53 {
54  ossimNotify(ossimNotifyLevel_WARN) << msg << std::endl;
55 }
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ OSSIM_DLL_DATA()

ossim::OSSIM_DLL_DATA ( const IntFloatBitCoercion  )

Declaration of nan part of nan() declared here for inline ossim::nan().

◆ print() [1/8]

std::ostream & ossim::print ( std::ostream &  out,
const opj_codestream_info &  info 
)

Prints codestream info from openjpeg struct opj_codestream_info.

Returns
std::ostream&

Definition at line 512 of file ossimOpjCommon.cpp.

References ossimString::string(), and ossimString::toString().

513 {
514  // Capture stream flags since we are going to mess with them.
515  std::ios_base::fmtflags f = out.flags();
516 
517  const int W = 20;
518 
519  out << std::setiosflags(std::ios_base::right) << std::setfill(' ')
520  << "opj_codestream_info:\n\n"
521  << std::setw(W) << "D_max: "
522  << info.D_max << "\n"
523  << std::setw(W) << "packno: "
524  << info.packno << "\n"
525  << std::setw(W) << "index_write: "
526  <<info.index_write << "\n"
527  << std::setw(W) << "image_w: "
528  << info.image_w << "\n"
529  << std::setw(W) << "image_h: "
530  << info.image_h << "\n"
531  << std::setw(W) << "proj: "
532  << info.prog << "\n"
533  << std::setw(W) << "tile_x: "
534  << info.tile_x << "\n"
535  << std::setw(W) << "tile_y: "
536  << info.tile_y << "\n"
537  << std::setw(W) << "tile_Ox: "
538  << info.tile_Ox << "\n"
539  << std::setw(W) << "tile_Oy: "
540  << info.tile_Oy << "\n"
541  << std::setw(W) << "tw: "
542  << info.tw << "\n"
543  << std::setw(W) << "th: "
544  << info.th << "\n"
545  << std::setw(W) << "numcomps: "
546  << info.numcomps << "\n"
547  << std::setw(W) << "numlayers: "
548  << info.numlayers << "\n";
549 
550  for (int i = 0; i < info.numcomps; ++i)
551  {
552  std::string s = "numdecompos[";
553  s += ossimString::toString(i).string();
554  s += "]: ";
555  out << std::setw(W) << s << info.numdecompos[i] << "\n";
556  }
557 
558  out << std::setw(W) << "marknum: "
559  << info.marknum << "\n"
560  // << std::setw(W) << "marker: " << info.marker << "\n"
561  << std::setw(W) << "maxmarknum: "
562  << info.maxmarknum << "\n"
563  << std::setw(W) << "main_head_start: "
564  << info.main_head_start << "\n"
565  << std::setw(W) << "main_head_end: "
566  << info.main_head_end << "\n"
567  << std::setw(W) << "codestream_size: "
568  << info.codestream_size << "\n"
569  // << "tile: " << info.tile
570  << std::endl;
571 
572  // Set the flags back.
573  out.flags(f);
574 
575  return out;
576 }
static ossimString toString(bool aValue)
Numeric to string methods.
const std::string & string() const
Definition: ossimString.h:414

◆ print() [2/8]

std::ostream & ossim::print ( std::ostream &  out,
const opj_cparameters &  param 
)

Prints compression parameters from openjpeg struct opj_cparameters.

Returns
std::ostream&

Definition at line 578 of file ossimOpjCommon.cpp.

References getProgressionOrderString().

579 {
580  // Capture stream flags since we are going to mess with them.
581  std::ios_base::fmtflags f = out.flags();
582 
583  const int W = 24;
584  int i;
585 
586  out << std::setiosflags(std::ios_base::left) << std::setfill(' ')
587  << "opj_cparameters:\n\n"
588 
589  << std::setw(W) << "tile_size_on:"
590  << param.tile_size_on << "\n"
591 
592  << std::setw(W) << "cp_tx0: "
593  << param.cp_tx0 << "\n"
594 
595  << std::setw(W) << "cp_ty0: "
596  << param.cp_ty0 << "\n"
597 
598  << std::setw(W) << "cp_tdx: "
599  << param.cp_tdx << "\n"
600 
601  << std::setw(W) << "cp_tdy: "
602  << param.cp_tdy << "\n"
603 
604  << std::setw(W) << "cp_disto_alloc: "
605  << param.cp_disto_alloc << "\n"
606 
607  << std::setw(W) << "cp_fixed_alloc: "
608  << param.cp_fixed_alloc << "\n"
609 
610  << std::setw(W) << "cp_fixed_quality: "
611  << param.cp_fixed_quality << "\n"
612 
613  << "cp_matrice:\n"
614 
615  << "cp_comment:\n"
616 
617  << std::setw(W) << "csty:"
618  << param.csty << "\n"
619 
620  << std::setw(W) << "prog_order: "
621  << getProgressionOrderString( (ossim_int32)param.prog_order ) << "\n"
622 
623  << "POC:\n"
624 
625  << std::setw(W) << "numpocs:"
626  << param.numpocs << "\n"
627 
628  << std::setw(W) << "tcp_numlayers:"
629  << param.tcp_numlayers << "\n";
630 
631  for ( i = 0; i < param.tcp_numlayers; ++i )
632  {
633  out << "tcp_rate[" << i << std::setw(14)<< "]: "<< std::setw(4) << param.tcp_rates[i] << "\n"
634  << "tcp_distoratio[" << i << std::setw(8) << "]: " << std::setw(4) << param.tcp_distoratio[i] << "\n";
635  }
636 
637  out << std::setw(W) << "numresolution:"
638  << param.numresolution << "\n"
639 
640  << std::setw(W) << "cblockw_init:"
641  << param.cblockw_init << "\n"
642 
643  << std::setw(W) << "cblockh_init:"
644  << param.cblockh_init << "\n"
645 
646  << std::setw(W) << "mode:"
647  << param.mode << "\n"
648 
649  << std::setw(W) << "irreversible:"
650  << param.irreversible << "\n"
651 
652  << std::setw(W) << "roi_compn:"
653  << param.roi_compno << "\n"
654 
655  << std::setw(W) << "roi_shift:"
656  << param.roi_shift << "\n"
657 
658  << std::setw(W) << "res_spec:"
659  << param.res_spec << "\n"
660 
661  << "prcw_init:\n"
662  // << param.prcw_init << "\n"
663 
664  << "prch_init:\n"
665  // << param.prcw_init << "\n"
666 
667  // << std::setw(W) << "infile:"
668  // << param.infile << "\n"
669 
670  << std::setw(W) << "outfile:"
671  << param.outfile << "\n"
672 
673  // << std::setw(W) << "index_on:"
674  // << param.index_on << "\n"
675 
676  // << std::setw(W) << "index:"
677  // << param.index << "\n"
678 
679  << std::setw(W) << "image_offset_x0:"
680  << param.image_offset_x0 << "\n"
681 
682  << std::setw(W) << "image_offset_y0:"
683  << param.image_offset_y0 << "\n"
684 
685  << std::setw(W) << "subsampling_dx:"
686  << param.subsampling_dx << "\n"
687 
688  << std::setw(W) << "image_offset_dy:"
689  << param.subsampling_dy << "\n"
690 
691  << std::setw(W) << "decod_format:"
692  << param.decod_format << "\n"
693 
694  << std::setw(W) << "cod_format:"
695  << param.cod_format << "\n"
696 
697  << std::setw(W) << "jpwl_epc_on:"
698  << param.jpwl_epc_on << "\n"
699 
700  << std::setw(W) << "jpwl_hprot_MH:"
701  << param.jpwl_hprot_MH << "\n"
702 
703  << "jpwl_hprot_TPH_tileno:\n"
704 
705  << "jpwl_pprot_TPH:\n"
706 
707  << "jpwl_pprot_tileno:\n"
708 
709  << "jpwl_pprot_packno:\n"
710 
711  << "jpwl_pprot:\n"
712 
713  << std::setw(W) << "jpwl_sens_size:"
714  << param.jpwl_sens_size << "\n"
715 
716  << std::setw(W) << "jpwl_sens_addr:"
717  << param.jpwl_sens_addr << "\n"
718 
719  << std::setw(W) << "jpwl_sens_range:"
720  << param.jpwl_sens_range << "\n"
721 
722  << std::setw(W) << "jpwl_sens_MH:"
723  << param.jpwl_sens_MH << "\n"
724 
725  << "jpwl_sens_TPH_tileno:\n"
726 
727  << "jpwl_sens_TPH:\n"
728 
729  << "cp_cinema:\n"
730 
731  << std::setw(W) << "max_comp_size:"
732  << param.max_comp_size << "\n"
733 
734  << std::setw(W) << "cp_rsiz:"
735  << param.cp_rsiz << "\n"
736 
737  << std::setw(W) << "tp_on:"
738  << param.tp_on << "\n"
739 
740  << std::setw(W) << "tp_flag:"
741  << param.tp_flag << "\n"
742 
743  << std::setw(W) << "tcp_mct:"
744  << int(param.tcp_mct) << "\n"
745 
746  << std::setw(W) << "jpip_on:"
747  << param.jpip_on << "\n"
748 
749  << "mct_data:\n"
750 
751  << std::setw(W) << "max_cs_size:"
752  << param.max_cs_size << "\n"
753 
754  << std::setw(W) << "rsiz:"
755  << param.rsiz << "\n"
756 
757  << std::endl;
758 
759  // Set the flags back.
760  out.flags(f);
761 
762  return out;
763 }
std::string getProgressionOrderString(ossim_int32 prog_order)
int ossim_int32

◆ print() [3/8]

std::ostream & ossim::print ( std::ostream &  out,
const opj_dparameters &  param 
)

Prints decode parameters from openjpeg struct opj_dparameters.

Returns
std::ostream&

Definition at line 765 of file ossimOpjCommon.cpp.

766 {
767  // Capture stream flags since we are going to mess with them.
768  std::ios_base::fmtflags f = out.flags();
769 
770  const int W = 20;
771 
772  out << std::setiosflags(std::ios_base::right) << std::setfill(' ')
773  << "opj_dparameters:\n\n"
774  << std::setw(W) << "cp_reduce: "
775  << param.cp_reduce << "\n"
776  << std::setw(W) << "cp_layer: "
777  << param.cp_layer << "\n"
778  << std::setw(W) << "infile: "
779  << param.infile << "\n"
780  << std::setw(W) << "outfile: "
781  << param.outfile << "\n"
782  << std::setw(W) << "decod_format: "
783  << param.decod_format << "\n"
784  << std::setw(W) << "cod_format: "
785  << param.cod_format << "\n"
786  << std::setw(W) << "jpwl_correct: "
787  << param.jpwl_correct << "\n"
788  << std::setw(W) << "jpwl_exp_comps: "
789  << param.jpwl_exp_comps << "\n"
790  << std::setw(W) << "jpwl_max_tiles: "
791  << param.jpwl_max_tiles << "\n"
792  << std::setw(W) << "cp_limit_decoding: "
793  // << param.cp_limit_decoding fix (drb)
794  << std::endl;
795  // Set the flags back.
796  out.flags(f);
797 
798  return out;
799 }

◆ print() [4/8]

std::ostream & ossim::print ( std::ostream &  out,
const opj_image &  image 
)

Prints opj_image structure.

Returns
std::ostream&

Definition at line 801 of file ossimOpjCommon.cpp.

References ossim_hdf5::print(), ossimString::string(), and ossimString::toString().

802 {
803  // Capture stream flags since we are going to mess with them.
804  std::ios_base::fmtflags f = out.flags();
805 
806  const int W = 20;
807 
808  out << std::setiosflags(std::ios_base::right) << std::setfill(' ')
809  << "opj_image:\n\n"
810  << std::setw(W) << "x0: "
811  << image.x0 << "\n"
812  << std::setw(W) << "y0: "
813  << image.y0 << "\n"
814  << std::setw(W) << "x1: "
815  << image.x1 << "\n"
816  << std::setw(W) << "y1: "
817  << image.y1 << "\n"
818  << std::setw(W) << "numcomps: "
819  << image.numcomps << "\n"
820  << std::setw(W) << "color_space: ";
821  if ( image.color_space == OPJ_CLRSPC_UNKNOWN ) out << "UNKNOWN\n";
822  else if ( image.color_space == OPJ_CLRSPC_UNSPECIFIED) out << "UNSPECIFIED\n";
823  else if ( image.color_space == OPJ_CLRSPC_SRGB) out << "SRGB\n";
824  else if ( image.color_space == OPJ_CLRSPC_GRAY) out << "GRAY\n";
825  else if ( image.color_space == OPJ_CLRSPC_SYCC) out << "SYCC\n";
826  else if ( image.color_space == OPJ_CLRSPC_EYCC) out << "EYCC\n";
827  else if ( image.color_space == OPJ_CLRSPC_CMYK) out << "CMYK\n";
828 
829  for (ossim_uint32 i = 0; i < image.numcomps; ++i)
830  {
831  std::string s = "comps[";
832  s += ossimString::toString(i).string();
833  s += "]: ";
834  out << s << std::endl;
835 
836  print(out, (image.comps[i]));
837  }
838 
839  out << std::endl;
840 
841  // Set the flags back.
842  out.flags(f);
843 
844  return out;
845 }
static ossimString toString(bool aValue)
Numeric to string methods.
std::ostream & print(H5::H5File *file, std::ostream &out)
Print method.
Definition: ossimH5Util.cpp:41
unsigned int ossim_uint32
const std::string & string() const
Definition: ossimString.h:414

◆ print() [5/8]

std::ostream & ossim::print ( std::ostream &  out,
const opj_image_comp &  comp 
)

Prints opj_image_comp structure.

Returns
std::ostream&

Definition at line 847 of file ossimOpjCommon.cpp.

848 {
849  // Capture stream flags since we are going to mess with them.
850  std::ios_base::fmtflags f = out.flags();
851 
852  const int W = 20;
853 
854  out << std::setiosflags(std::ios_base::right) << std::setfill(' ')
855  << "opj_image_comp:\n\n"
856  << std::setw(W) << "dx: "
857  << comp.dx << "\n"
858  << std::setw(W) << "dy: "
859  << comp.dy << "\n"
860  << std::setw(W) << "w: "
861  << comp.w << "\n"
862  << std::setw(W) << "h: "
863  << comp.h << "\n"
864  << std::setw(W) << "x0: "
865  << comp.x0 << "\n"
866  << std::setw(W) << "y0: "
867  << comp.y0 << "\n"
868  << std::setw(W) << "prec: "
869  << comp.prec << "\n"
870  << std::setw(W) << "bpp: "
871  << comp.bpp << "\n"
872  << std::setw(W) << "sgnd: "
873  << comp.sgnd << "\n"
874  << std::setw(W) << "resno_decoded: "
875  << comp.resno_decoded << "\n"
876  << std::setw(W) << "factor: "
877  << comp.factor
878  << std::endl;
879 
880  // Set the flags back.
881  out.flags(f);
882 
883  return out;
884 }

◆ print() [6/8]

std::ostream & ossim::print ( std::ostream &  out,
kdu_core::kdu_codestream &  cs 
)

Convenience print method for kdu_codestream.

Definition at line 860 of file ossimKakaduCommon.cpp.

861 {
862  out << "codestream debug:"
863  << "exists: " << (cs.exists()?"true":"false");
864  if (cs.exists())
865  {
866  const int BANDS = cs.get_num_components(true);
867  out << "\ncomponents: " << BANDS;
868  for (int i = 0; i < BANDS; ++i)
869  {
870  kdu_core::kdu_dims dims;
871  cs.get_dims(i, dims, true);
872  out << "\nbit_depth[" << i << "]: " << cs.get_bit_depth(i, true)
873  << "\nsigned[" << i << "]: " << cs.get_signed(i, true)
874  << "\ndims[" << i << "]: ";
875  ossim::print(out, dims);
876  }
877  out << "\nlevels: " << cs.get_min_dwt_levels();
878  }
879  return out;
880 }
std::ostream & print(std::ostream &out, kdu_core::kdu_codestream &cs)
Convenience print method for kdu_codestream.

◆ print() [7/8]

std::ostream & ossim::print ( std::ostream &  out,
const kdu_core::kdu_dims &  dims 
)

Convenience print method for kdu_dims.

Definition at line 882 of file ossimKakaduCommon.cpp.

References ossim_hdf5::print().

883 {
884  out << "pos: ";
885  print(out, dims.pos);
886  out << ", size: ";
887  print(out, dims.size);
888  out << "\n";
889  return out;
890 }
std::ostream & print(H5::H5File *file, std::ostream &out)
Print method.
Definition: ossimH5Util.cpp:41

◆ print() [8/8]

std::ostream & ossim::print ( std::ostream &  out,
const kdu_core::kdu_coords &  coords 
)

Convenience print method for kdu_coords.

Definition at line 892 of file ossimKakaduCommon.cpp.

893 {
894  out << "(" << coords.x << ", " << coords.y << ")";
895  return out;
896 }

◆ quaderp()

template<class S , class T >
T ossim::quaderp ( x,
begin,
middle,
end 
)

Definition at line 158 of file ossimCommon.h.

References x.

160  {
161  // newton interpolation
162  const T a1 = S(2)*(middle - begin);
163  const T a2 = S(2)*(end - middle) - a1;
164  return x*((x - S(0.5))*a2 + a1) + begin;
165  }
ossim_uint32 x

◆ quadraticRoots()

template<class T >
std::pair<T, T> ossim::quadraticRoots ( a,
b,
c 
)

Definition at line 379 of file ossimCommon.h.

381  {
382  // XXX could suffer from catastrophic cancellation,
383  // see David Goldberg's "What Every Computer Scientist Should Know About Floating-Point Arithmetic"
384  T s = std::sqrt(b*b - T(4)*a*c);
385  T twoA = T(2)*a;
386  return std::pair<T, T>((-b + s)/twoA, (-b - s)/twoA);
387  }

◆ radiansToDegrees()

double ossim::radiansToDegrees ( double  x)
inline

Definition at line 257 of file ossimCommon.h.

References DEG_PER_RAD, and x.

Referenced by ossim::Quaternion::getRotate(), ossimMercatorProjection::inverse(), and ossimRsmModel::lineSampleHeightToWorld().

257 { return x*DEG_PER_RAD;}
ossim_uint32 x
#define DEG_PER_RAD

◆ round()

template<class R , class F >
R ossim::round ( x)
inline

Definition at line 361 of file ossimCommon.h.

References isnan(), ossimENSURE, and x.

363  {
364  R result = static_cast<R>((x < F(0)) ? std::ceil(x - F(0.5)) : std::floor(x + F(0.5)));
365 
366  ossimENSURE(ossim::isnan(x) == ossim::isnan(result)); // if x is nan, R must be a float type
367  return result;
368 
369  // XXX is this better than use of ceil/floor?: return static_cast<long long>((x < T(0)) ? x - T(0.5) : x + T(0.5));
370  }
ossim_uint32 x
#define ossimENSURE(expr)
Definition: ossimCommon.h:20
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ scalarSizeInBytes()

ossim_uint32 ossim::scalarSizeInBytes ( ossimScalarType  scalarType)

Definition at line 311 of file ossimCommon.cpp.

References OSSIM_FLOAT32, OSSIM_FLOAT64, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SCALAR_UNKNOWN, OSSIM_SINT16, OSSIM_SINT32, OSSIM_SINT8, OSSIM_UINT16, OSSIM_UINT32, OSSIM_UINT8, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, and OSSIM_USHORT15.

Referenced by ossimNitfCommon::getCompressionRate(), ossimRectilinearDataObject::getScalarSizeInBytes(), ossimGdalTileSource::getTile(), ossimHdf5ImageHandler::getTile(), ossimH5ImageHandler::getTile(), ossimImageCombiner::initialize(), ossimH5ImageDataset::initialize(), ossimSrtmHandler::open(), ossimTiffWriter::openTiff(), ossimImageMetaData::ossimImageMetaData(), ossim_hdf5::printObject(), ossimHdf5ImageDataset::scanForMinMax(), ossimImageMetaData::setScalarType(), ossimImageMetaData::updateMetaData(), ossimNitf20Writer::writeBlockBandSeparate(), ossimNitfWriter::writeBlockBandSeparate(), ossimNitf20Writer::writeBlockBandSequential(), and ossimNitfWriter::writeBlockBandSequential().

312 {
313  switch(scalarType)
314  {
315  case OSSIM_UINT8:
316  {
317  return sizeof(ossim_uint8);
318  }
319  case OSSIM_SINT8:
320  {
321  return sizeof(ossim_sint8);
322  }
323  case OSSIM_UINT16:
324  case OSSIM_USHORT11:
325  case OSSIM_USHORT12:
326  case OSSIM_USHORT13:
327  case OSSIM_USHORT14:
328  case OSSIM_USHORT15:
329  {
330  return sizeof(ossim_uint16);
331  }
332  case OSSIM_SINT16:
333  {
334  return sizeof(ossim_sint16);
335  }
336  case OSSIM_UINT32:
337  {
338  return sizeof(ossim_uint32);
339  }
340  case OSSIM_SINT32:
341  {
342  return sizeof(ossim_sint32);
343  }
344  case OSSIM_FLOAT32:
346  {
347  return sizeof(ossim_float32);
348  }
349  case OSSIM_FLOAT64:
351  {
352  return sizeof(ossim_float64);
353  }
355  default:
356  {
357  if (traceDebug())
358  {
360  << __FILE__ << ":" << __LINE__
361  << "\nUnhandled scalar type: " << scalarType << std::endl;
362  }
363  break;
364  }
365  }
366 
367  return 1;
368 }
16 bit unsigned integer (15 bits used)
8 bit signed integer
64 bit floating point
16 bit unsigned integer
float ossim_float32
16 bit signed integer
16 bit unsigned integer (14 bits used)
signed char ossim_sint8
16 bit unsigned integer (13 bits used)
32 bit floating point
unsigned short ossim_uint16
32 bit unsigned integer
double ossim_float64
signed short ossim_sint16
32 bit signed integer
unsigned int ossim_uint32
32 bit normalized floating point
signed int ossim_sint32
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
8 bit unsigned integer
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
16 bit unsigned integer (12 bits used)

◆ sgn() [1/2]

template<class T >
T ossim::sgn ( x)
inline

Definition at line 339 of file ossimCommon.h.

Referenced by ossimPositionQualityEvaluator::atan3(), ossimImageGeometry::calculatePolyBounds(), ossimImageViewProjectionTransform::getViewSegments(), and ossimImageViewProjectionTransform::initializeViewSize().

341  {
342  const T table[] = {T(0), T(1), T(-1)};
343  return table[((x < T(0)) << 1) | (x > T(0))];
344  }

◆ sgn() [2/2]

template<>
ossim_float64 ossim::sgn ( ossim_float64  x)
inline

Definition at line 353 of file ossimCommon.h.

References isnan(), and x.

355  {
356  const ossim_float64 table[] = {ossim_float64(0), ossim_float64(1), ossim_float64(-1)};
357  return ossim::isnan(x) ? x : table[((x < ossim_float64(0)) << 1) | (x > ossim_float64(0))];
358  }
ossim_uint32 x
double ossim_float64
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ sgn< ossim_float32 >()

template<>
ossim_float32 ossim::sgn< ossim_float32 > ( ossim_float32  x)
inline

Definition at line 346 of file ossimCommon.h.

References isnan(), and x.

348  {
349  const ossim_float32 table[] = {ossim_float32(0), ossim_float32(1), ossim_float32(-1)};
350  return ossim::isnan(x) ? x : table[((x < ossim_float32(0)) << 1) | (x > ossim_float32(0))];
351  }
ossim_uint32 x
float ossim_float32
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ sind()

double ossim::sind ( double  x)
inline

◆ skipws()

std::istream & ossim::skipws ( std::istream &  in)

Definition at line 38 of file ossimCommon.cpp.

References isWhiteSpace().

Referenced by extractSimpleValues(), ossimEnviHeader::isEnviHeader(), ossimNmeaMessage::parseMessage(), ossimEnviHeader::readStream(), ossimIrect::toRect(), ossimDrect::toRect(), toSimpleVector(), and toVector().

39 {
40  int c = in.peek();
41  while( !in.bad() && ossim::isWhiteSpace(c))
42  {
43  in.ignore();
44  c = in.peek();
45  }
46 
47  return in;
48 }
OSSIM_DLL bool isWhiteSpace(int c)
Definition: ossimCommon.cpp:49

◆ square()

template<class T >
T ossim::square ( x)
inline

Definition at line 334 of file ossimCommon.h.

References x.

Referenced by Cholesky(), ossimMagicFilter::filter(), ossimRadialDecentLensDistortion::forward(), and SVD().

335  { return x*x; }
ossim_uint32 x

◆ tand()

double ossim::tand ( double  x)
inline

Definition at line 261 of file ossimCommon.h.

References RAD_PER_DEG, and x.

261 { return std::tan(x*RAD_PER_DEG); }
ossim_uint32 x
#define RAD_PER_DEG

◆ toSimpleStringList() [1/5]

template<class T >
void ossim::toSimpleStringList ( ossimString result,
const std::vector< T > &  valuesList 
)

This will output a vector of values inst a string.

(value1,...,valueN)

Parenthesis are required

Definition at line 484 of file ossimCommon.h.

References size.

Referenced by ossimBandSelector::getProperty(), ossimTangentialRadialLensDistortion::saveState(), ossimBandSelector::saveState(), ossimRectilinearDataObject::saveState(), ossimTiffTileSource::saveState(), and ossimImageData::saveState().

486  {
487  std::ostringstream out;
488 
489  if(!valuesList.empty())
490  {
491  ossim_uint32 idx = 0;
492  ossim_uint32 size = (ossim_uint32) (valuesList.size()-1);
493  for(idx = 0; idx < size; ++idx)
494  {
495  out << valuesList[idx] << ",";
496  }
497  out << valuesList[size];
498  }
499 
500  result = "("+out.str()+")";
501  }
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
yy_size_t size
unsigned int ossim_uint32

◆ toSimpleStringList() [2/5]

template<>
OSSIM_DLL void ossim::toSimpleStringList ( ossimString result,
const std::vector< ossim_uint8 > &  valuesList 
)

This will output a vector of values inst a string.

(value1,...,valueN)

Specialize the char for it will output the actual ascii char instead of the numeric value

Parenthesis are required

◆ toSimpleStringList() [3/5]

template<>
OSSIM_DLL void ossim::toSimpleStringList ( ossimString result,
const std::vector< ossim_float64 > &  valuesList 
)

◆ toSimpleStringList() [4/5]

template<>
OSSIM_DLL void ossim::toSimpleStringList ( ossimString result,
const std::vector< ossim_float32 > &  valuesList 
)

◆ toSimpleStringList() [5/5]

template<>
OSSIM_DLL void ossim::toSimpleStringList ( ossimString result,
const std::vector< ossimString > &  valuesList 
)

◆ toSimpleVector() [1/8]

template<class T >
bool ossim::toSimpleVector ( std::vector< T > &  result,
const ossimString stringOfPoints 
)

Definition at line 537 of file ossimCommon.h.

References ossimString::empty(), ossimString::push_back(), skipws(), and ossimString::toDouble().

Referenced by ossimImageMetaData::getRgbBands(), ossimTangentialRadialLensDistortion::loadState(), ossimBandSelector::loadState(), ossimRectilinearDataObject::loadState(), ossimTiffTileSource::loadState(), ossimImageData::loadState(), ossimTiffTileSource::populateLut(), and ossimBandSelector::setProperty().

538  {
539  std::istringstream in(stringOfPoints);
540  ossim::skipws(in);
541  bool returnValue = true;
542  char c = in.get();
543  ossimString value = "";
544  if(c == '(')
545  {
546  c = (char)in.get();
547  while( (c!=')') && (c!= '\n') && (in.good()) )
548  {
549  if(c!= ',')
550  {
551  value += ossimString(c);
552  }
553  else
554  {
555  result.push_back(static_cast<T>(value.toDouble()));
556  value = "";
557  }
558  c = in.get();
559  }
560  }
561  if(c!= ')')
562  {
563  returnValue = false;
564  }
565  else
566  {
567  if(!value.empty())
568  {
569  result.push_back(static_cast<T>(value.toDouble()));
570  }
571  }
572 
573  return returnValue;
574  }
void push_back(char c)
Equivalent to insert(end(), c).
Definition: ossimString.h:905
OSSIM_DLL std::istream & skipws(std::istream &in)
Definition: ossimCommon.cpp:38
double toDouble() const
bool empty() const
Definition: ossimString.h:411
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32

◆ toSimpleVector() [2/8]

bool ossim::toSimpleVector ( std::vector< ossim_uint32 > &  result,
const ossimString stringOfPoints 
)

Takes input format of the form: (value1,value2,...,valueN)

Definition at line 991 of file ossimCommon.cpp.

References extractSimpleValues(), and size.

993 {
994  std::vector<ossimString> extractedValues;
995  bool resultFlag = extractSimpleValues(extractedValues, stringOfPoints);
996  if(resultFlag)
997  {
998  ossim_uint32 idx = 0;
999  ossim_uint32 size = (ossim_uint32) extractedValues.size();
1000  for(idx = 0; idx < size; ++idx)
1001  {
1002  result.push_back(extractedValues[idx].toUInt32());
1003  }
1004  }
1005  return resultFlag;
1006 }
OSSIM_DLL bool extractSimpleValues(std::vector< ossimString > &values, const ossimString &stringOfPoints)
Generic function to extract a list of values into a vector of string where the string of points is of...
yy_size_t size
unsigned int ossim_uint32

◆ toSimpleVector() [3/8]

bool ossim::toSimpleVector ( std::vector< ossim_int32 > &  result,
const ossimString stringOfPoints 
)

Takes input format of the form: (value1,value2,...,valueN)

Definition at line 1091 of file ossimCommon.cpp.

References extractSimpleValues(), and size.

1093 {
1094  std::vector<ossimString> extractedValues;
1095  bool resultFlag = extractSimpleValues(extractedValues, stringOfPoints);
1096  if(resultFlag)
1097  {
1098  ossim_uint32 idx = 0;
1099  ossim_uint32 size = (ossim_int32) extractedValues.size();
1100  for(idx = 0; idx < size; ++idx)
1101  {
1102  result.push_back(extractedValues[idx].toInt32());
1103  }
1104  }
1105  return resultFlag;
1106 }
OSSIM_DLL bool extractSimpleValues(std::vector< ossimString > &values, const ossimString &stringOfPoints)
Generic function to extract a list of values into a vector of string where the string of points is of...
yy_size_t size
unsigned int ossim_uint32
int ossim_int32

◆ toSimpleVector() [4/8]

bool ossim::toSimpleVector ( std::vector< ossim_uint16 > &  result,
const ossimString stringOfPoints 
)

Takes input format of the form: (value1,value2,...,valueN)

Definition at line 1108 of file ossimCommon.cpp.

References extractSimpleValues(), and size.

1110 {
1111  std::vector<ossimString> extractedValues;
1112  bool resultFlag = extractSimpleValues(extractedValues, stringOfPoints);
1113  if(resultFlag)
1114  {
1115  ossim_uint32 idx = 0;
1116  ossim_uint32 size = (ossim_int32) extractedValues.size();
1117  for(idx = 0; idx < size; ++idx)
1118  {
1119  result.push_back(extractedValues[idx].toUInt32());
1120  }
1121  }
1122  return resultFlag;
1123 }
OSSIM_DLL bool extractSimpleValues(std::vector< ossimString > &values, const ossimString &stringOfPoints)
Generic function to extract a list of values into a vector of string where the string of points is of...
yy_size_t size
unsigned int ossim_uint32
int ossim_int32

◆ toSimpleVector() [5/8]

bool ossim::toSimpleVector ( std::vector< ossim_int16 > &  result,
const ossimString stringOfPoints 
)

Takes input format of the form: (value1,value2,...,valueN)

Definition at line 1125 of file ossimCommon.cpp.

References extractSimpleValues(), and size.

1127 {
1128  std::vector<ossimString> extractedValues;
1129  bool resultFlag = extractSimpleValues(extractedValues, stringOfPoints);
1130  if(resultFlag)
1131  {
1132  ossim_uint32 idx = 0;
1133  ossim_uint32 size = (ossim_uint32) extractedValues.size();
1134  for(idx = 0; idx < size; ++idx)
1135  {
1136  result.push_back(extractedValues[idx].toInt32());
1137  }
1138  }
1139  return resultFlag;
1140 }
OSSIM_DLL bool extractSimpleValues(std::vector< ossimString > &values, const ossimString &stringOfPoints)
Generic function to extract a list of values into a vector of string where the string of points is of...
yy_size_t size
unsigned int ossim_uint32

◆ toSimpleVector() [6/8]

bool ossim::toSimpleVector ( std::vector< ossim_uint8 > &  result,
const ossimString stringOfPoints 
)

Takes input format of the form: (value1,value2,...,valueN)

Definition at line 1142 of file ossimCommon.cpp.

References extractSimpleValues(), and size.

1144 {
1145  std::vector<ossimString> extractedValues;
1146  bool resultFlag = extractSimpleValues(extractedValues, stringOfPoints);
1147  if(resultFlag)
1148  {
1149  ossim_uint32 idx = 0;
1150  ossim_uint32 size = (ossim_uint32) extractedValues.size();
1151  for(idx = 0; idx < size; ++idx)
1152  {
1153  result.push_back(extractedValues[idx].toUInt8());
1154  }
1155  }
1156  return resultFlag;
1157 }
OSSIM_DLL bool extractSimpleValues(std::vector< ossimString > &values, const ossimString &stringOfPoints)
Generic function to extract a list of values into a vector of string where the string of points is of...
yy_size_t size
unsigned int ossim_uint32

◆ toSimpleVector() [7/8]

bool ossim::toSimpleVector ( std::vector< ossim_int8 > &  result,
const ossimString stringOfPoints 
)

Takes input format of the form: (value1,value2,...,valueN)

Definition at line 1159 of file ossimCommon.cpp.

References extractSimpleValues(), and size.

1161 {
1162  std::vector<ossimString> extractedValues;
1163  bool resultFlag = extractSimpleValues(extractedValues, stringOfPoints);
1164  if(resultFlag)
1165  {
1166  ossim_uint32 idx = 0;
1167  ossim_uint32 size = (ossim_uint32) extractedValues.size();
1168  for(idx = 0; idx < size; ++idx)
1169  {
1170  result.push_back(extractedValues[idx].toUInt8());
1171  }
1172  }
1173  return resultFlag;
1174 }
OSSIM_DLL bool extractSimpleValues(std::vector< ossimString > &values, const ossimString &stringOfPoints)
Generic function to extract a list of values into a vector of string where the string of points is of...
yy_size_t size
unsigned int ossim_uint32

◆ toSimpleVector() [8/8]

bool ossim::toSimpleVector ( std::vector< ossimString > &  result,
const ossimString stringOfStrings 
)

Takes input format of the form: (value1,value2,...,valueN)

Definition at line 1176 of file ossimCommon.cpp.

References extractSimpleValues().

1178 {
1179  std::vector<ossimString> extractedValues;
1180  bool resultFlag = extractSimpleValues(result, stringOfStrings);
1181 
1182  return resultFlag;
1183 }
OSSIM_DLL bool extractSimpleValues(std::vector< ossimString > &values, const ossimString &stringOfPoints)
Generic function to extract a list of values into a vector of string where the string of points is of...

◆ toStringList() [1/3]

void ossim::toStringList ( ossimString resultStringOfPoints,
const std::vector< ossimDpt > &  pointList,
char  separator = ' ' 
)

Will take a vector of ossimDpt and convert to a string list separated by spaces For example: (45,34) (12,34)

Definition at line 781 of file ossimCommon.cpp.

References ossimString::empty(), and ossimString::toString().

Referenced by ossimBilinearProjection::saveState(), and ossimImageGeometry::saveState().

784 {
785  ossim_uint32 idx = 0;
786  for(;idx < pointList.size();++idx)
787  {
788  ossimString pt = pointList[idx].toString();
789  if(resultStringOfPoints.empty())
790  {
791  resultStringOfPoints = pt;
792  }
793  else
794  {
795  resultStringOfPoints += (separator + pt);
796  }
797  }
798 }
static ossimString toString(bool aValue)
Numeric to string methods.
unsigned int ossim_uint32
bool empty() const
Definition: ossimString.h:411

◆ toStringList() [2/3]

void ossim::toStringList ( ossimString resultStringOfPoints,
const std::vector< ossimIpt > &  pointList,
char  separator = ' ' 
)

Definition at line 800 of file ossimCommon.cpp.

References ossimString::empty(), and ossimString::toString().

803 {
804  ossim_uint32 idx = 0;
805  for(;idx < pointList.size();++idx)
806  {
807  ossimString pt = pointList[idx].toString();
808  if(resultStringOfPoints.empty())
809  {
810  resultStringOfPoints = pt;
811  }
812  else
813  {
814  resultStringOfPoints += (separator + pt);
815  }
816  }
817 }
static ossimString toString(bool aValue)
Numeric to string methods.
unsigned int ossim_uint32
bool empty() const
Definition: ossimString.h:411

◆ toStringList() [3/3]

void ossim::toStringList ( ossimString resultStringOfPoints,
const std::vector< ossimGpt > &  pointList,
char  seaprator = ' ' 
)

Definition at line 819 of file ossimCommon.cpp.

References ossimString::empty(), and ossimString::toString().

822 {
823  ossim_uint32 idx = 0;
824  for(;idx < pointList.size();++idx)
825  {
826  ossimString pt = pointList[idx].toString();
827  if(resultStringOfPoints.empty())
828  {
829  resultStringOfPoints = pt;
830  }
831  else
832  {
833  resultStringOfPoints += (separator + pt);
834  }
835  }
836 }
static ossimString toString(bool aValue)
Numeric to string methods.
unsigned int ossim_uint32
bool empty() const
Definition: ossimString.h:411

◆ toVector() [1/3]

void ossim::toVector ( std::vector< ossimDpt > &  result,
const ossimString stringOfPoints 
)

Will take a string list separated by spaces and convert to a vector of ossimDpts.

It will not clear the passed in list but will append all points found.

Definition at line 838 of file ossimCommon.cpp.

References skipws(), ossimDpt::toPoint(), and ossimString::trim().

Referenced by ossimHdf5Tool::loadImageFiles(), ossimBilinearProjection::loadState(), ossimHistogram::loadState(), and ossimImageGeometry::loadState().

840 {
841  std::vector<ossimString> splitResult;
842 
843  // let grab each point string that is surrounded by ()
844  std::istringstream in(stringOfPoints.trim());
845  ossimString currentPoint = "";
846  ossimDpt tempPoint;
847  while(!in.bad()&&!in.eof())
848  {
849  skipws(in);
850  if(in.peek() == '(')
851  {
852  currentPoint += (char)in.get();
853  skipws(in);
854  if(in.peek() == '(') in.ignore();
855 
856  while(!in.bad()&&!in.eof()&&(in.peek() != ')'))
857  {
858  currentPoint += (char)in.get();
859  }
860  if(in.good())
861  {
862  currentPoint += (char)in.get();
863  tempPoint.toPoint(currentPoint);
864  result.push_back(tempPoint);
865  }
866  currentPoint = "";
867  }
868  else
869  {
870  in.ignore();
871  }
872  }
873 }
OSSIM_DLL std::istream & skipws(std::istream &in)
Definition: ossimCommon.cpp:38
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
void toPoint(const std::string &s)
Initializes this point from string.
Definition: ossimDpt.cpp:192
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32

◆ toVector() [2/3]

void ossim::toVector ( std::vector< ossimIpt > &  result,
const ossimString stringOfPoints 
)

Definition at line 875 of file ossimCommon.cpp.

References skipws(), ossimIpt::toPoint(), and ossimString::trim().

877 {
878  std::vector<ossimString> splitResult;
879 
880  // let grab each point string that is surrounded by ()
881  std::istringstream in(stringOfPoints.trim());
882  ossimString currentPoint = "";
883  ossimIpt tempPoint;
884  while(!in.bad()&&!in.eof())
885  {
886  skipws(in);
887  if(in.peek() == '(')
888  {
889  currentPoint += (char)in.get();
890  skipws(in);
891  if(in.peek() == '(') in.ignore();
892 
893  while(!in.bad()&&!in.eof()&&(in.peek() != ')'))
894  {
895  currentPoint += (char)in.get();
896  }
897  if(in.good())
898  {
899  currentPoint += (char)in.get();
900  tempPoint.toPoint(currentPoint);
901  result.push_back(tempPoint);
902  }
903  currentPoint = "";
904  }
905  else
906  {
907  in.ignore();
908  }
909  }
910 }
OSSIM_DLL std::istream & skipws(std::istream &in)
Definition: ossimCommon.cpp:38
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
void toPoint(const std::string &s)
Initializes this point from string.
Definition: ossimIpt.cpp:170
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32

◆ toVector() [3/3]

void ossim::toVector ( std::vector< ossimGpt > &  result,
const ossimString stringOfPoints 
)

Definition at line 911 of file ossimCommon.cpp.

References skipws(), ossimGpt::toPoint(), and ossimString::trim().

913 {
914  std::vector<ossimString> splitResult;
915 
916  // let grab each point string that is surrounded by ()
917  std::istringstream in(stringOfPoints.trim());
918  ossimString currentPoint = "";
919  ossimGpt tempPoint;
920  while(!in.bad()&&!in.eof())
921  {
922  skipws(in);
923  if(in.peek() == '(')
924  {
925  currentPoint += (char)in.get();
926  skipws(in);
927  if(in.peek() == '(') in.ignore();
928 
929  while(!in.bad()&&!in.eof()&&(in.peek() != ')'))
930  {
931  currentPoint += (char)in.get();
932  }
933  if(in.good())
934  {
935  currentPoint += (char)in.get();
936  tempPoint.toPoint(currentPoint);
937  result.push_back(tempPoint);
938  }
939  currentPoint = "";
940  }
941  else
942  {
943  in.ignore();
944  }
945  }
946 }
OSSIM_DLL std::istream & skipws(std::istream &in)
Definition: ossimCommon.cpp:38
void toPoint(const std::string &s)
Initializes this point from string.
Definition: ossimGpt.cpp:116
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32

◆ unNormalizeTile()

void ossim::unNormalizeTile ( ossimImageData result)

Un-normalizes float tile from kdu_region_decompressor::process method.

Takes tile which is assumed to be normalized by kakadu and stretches between the tile min and max.

Definition at line 802 of file ossimKakaduCommon.cpp.

References ossimImageData::getBuf(), ossimImageData::getFloatBuf(), ossimImageData::getMaxPix(), ossimImageData::getMinPix(), ossimImageData::getNullPix(), ossimRectilinearDataObject::getScalarType(), ossimImageData::getSize(), OSSIM_FLOAT32, OSSIM_SINT32, ossimNotify(), and ossimNotifyLevel_WARN.

Referenced by copyRegionToTile().

803 {
804  if (result)
805  {
806  const ossim_uint32 SIZE = result->getSize();
807  const ossim_float64 MINP = result->getMinPix(0);
808  const ossim_float64 MAXP = result->getMaxPix(0);
809  const ossim_float64 RANGE = MAXP - MINP;
810 
811  if ( result->getScalarType() == OSSIM_FLOAT32 )
812  {
813  const ossim_float32 NULLP = static_cast<ossim_float32>(result->getNullPix(0));
814  ossim_float32* buf = result->getFloatBuf();
815  for(ossim_uint32 idx = 0; idx < SIZE; ++idx)
816  {
817  ossim_float64 p = buf[idx];
818  if(p > 0.0)
819  {
820  p = MINP + RANGE * p;
821  p = (p < MAXP ? (p > MINP ? p : MINP) : MAXP);
822  buf[idx] = static_cast<ossim_float32>(p);
823  }
824  else
825  {
826  buf[idx] = NULLP;
827  }
828  }
829  }
830  else if ( result->getScalarType() == OSSIM_SINT32 )
831  {
832  const ossim_sint32 NULLP = static_cast<ossim_sint32>(result->getNullPix(0));
833  ossim_float32* inBuf = static_cast<ossim_float32*>(result->getBuf());
834  ossim_sint32* outBuf = static_cast<ossim_sint32*>(result->getBuf());
835  for(ossim_uint32 idx = 0; idx < SIZE; ++idx)
836  {
837  ossim_float64 p = inBuf[idx];
838  if(p > 0.0)
839  {
840  p = MINP + RANGE * p;
841  p = (p < MAXP ? (p > MINP ? p : MINP) : MAXP);
842  outBuf[idx] = static_cast<ossim_sint32>(p);
843  }
844  else
845  {
846  outBuf[idx] = NULLP;
847  }
848  }
849  }
850  else
851  {
853  << __FILE__ << " " << __LINE__ << " Unhandle scalar: "
854  << result->getScalarType() << "\n";
855  }
856  }
857 
858 } // End: ossim::unNormalizeTile
virtual const ossim_float64 * getMaxPix() const
float ossim_float32
32 bit floating point
double ossim_float64
32 bit signed integer
unsigned int ossim_uint32
virtual const ossim_float64 * getNullPix() const
signed int ossim_sint32
virtual const ossim_float32 * getFloatBuf() const
virtual const ossim_float64 * getMinPix() const
virtual ossimScalarType getScalarType() const
virtual ossim_uint32 getSize() const
Returns the total number of pixels in a tile for all bands.
virtual const void * getBuf() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ usft2mtrs()

double ossim::usft2mtrs ( double  feet)
inline

Definition at line 373 of file ossimCommon.h.

References US_METERS_PER_FT.

Referenced by ossimGeoTiff::convert2meters(), and ossimDemHeader::getImageGeometry().

373 { return (feet * US_METERS_PER_FT); }
#define US_METERS_PER_FT

◆ wrap()

template<class T >
T ossim::wrap ( x,
a,
b 
)

Definition at line 180 of file ossimCommon.h.

References isnan(), ossimREQUIRE, and x.

Referenced by ossimSrtmElevationDatabase::createId(), and ossimDtedElevationDatabase::createId().

182  {
183  ossimREQUIRE(a <= b); // input must make sense, disallow nans
184 
185  if (a == b && !ossim::isnan(x))
186  return a;
187  else {
188  T z = x < a ? b : a;
189  return std::fmod(x - z, b - a) + z;
190  }
191  }
ossim_uint32 x
#define ossimREQUIRE(expr)
Definition: ossimCommon.h:19
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91