/usr/include/ossim/imaging/ossimSingleImageChain.h is in libossim-dev 1.8.16-3+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | //----------------------------------------------------------------------------
//
// License: LGPL
//
// See LICENSE.txt file in the top level directory for more details.
//
// Author: David Burken
//
// Description: Utility class declaration for a single image chain.
//
//----------------------------------------------------------------------------
// $Id$
#ifndef ossimSingleImageChain_HEADER
#define ossimSingleImageChain_HEADER 1
#include <vector>
#include <ossim/base/ossimConstants.h> /* OSSIM_DLL */
#include <ossim/imaging/ossimBandSelector.h>
#include <ossim/imaging/ossimCacheTileSource.h>
#include <ossim/imaging/ossimHistogramRemapper.h>
#include <ossim/imaging/ossimImageChain.h>
#include <ossim/imaging/ossimImageHandler.h>
#include <ossim/imaging/ossimImageRenderer.h>
#include <ossim/imaging/ossimScalarRemapper.h>
// Forward class declarations:
class ossimFilename;
class ossimSrcRecord;
/**
* @class ossimSingleImageChain
*
* @brief Single image chain class.
*
* Convenience class for a single image chain.
*
* For code example see: ossim/src/test/ossim-single-image-chain-test.cpp
*
* Just a clarification on "start of chain" versus "end of chain" in this
* file.
*
* Given chain of:
* 1) image handler
* 2) band selector (optional)
* 3) histogram remapper(optional)
* 4) scalar remapper (optional)
* 5) resampler cache
* 6) resampler
* 7) band selector (optional when going one band to three)
* 8) chain cache
*
* The "image handle" is the "start of chain".
* The "chain cache" is the "end of chain".
*/
class OSSIM_DLL ossimSingleImageChain : public ossimImageChain
{
public:
/** default constructor */
ossimSingleImageChain();
/** Constructor that takes flags.*/
ossimSingleImageChain(bool addHistogramFlag,
bool addResamplerCacheFlag,
bool addChainCacheFlag,
bool remapToEightBitFlag,
bool threeBandFlag,
bool threeBandReverseFlag);
/** virtual destructor */
virtual ~ossimSingleImageChain();
/**
* @brief reset method
* This deletes all links in the chain, zero's out all data members, and
* sets all flags back to default.
*/
void reset();
/**
* @brief open method that takes an image file.
*
* Opens file and creates a simple chain with ossimImageHandler.
*
* @param file File to open.
* @param openOverview If true image handler will attempt to open overview.
* Note that if you are planning on doing a rendered chain or want to go
* between res levels you should set this to true. default = true
*
* @return true on success, false on error.
*
* @note This will close previous chain if one was opened.
*/
bool open(const ossimFilename& file, bool openOverview=true);
/**
* @brief open method that takes an ossimSrcRecord.
*
* Opens file and creates a simple chain with ossimImageHandler.
*
* @return true on success, false on error.
*
* @note This will close previous chain if one was opened.
*/
bool open(const ossimSrcRecord& src);
/** @return true if image handler is opened. */
bool isOpen() const;
/** @brief close method to delete the image handler. */
void close();
/** @return The filename of the image. */
ossimFilename getFilename() const;
/**
* @brief Create a rendered image chain.
*
* Typical usage is to call this after "open" method returns true like:
* if ( myChain->open(myFile) == true )
* {
* myChain->createRenderedChain();
* code-goes-here();
* }
*
* Typical chain is:
*
* 1) image handler
* 2) band selector (optional)
* 3) histogram remapper(optional)
* 4) scalar remapper (optional)
* 5) resampler cache
* 6) resampler
* 7) band selector (optional when going one band to three)
* 8) chain cache
*
* NOTES:
* 1) Cache on left hand side of resampler is critical to speed if you
* have the ossimImageRender enabled.
*
* 2) If doing a sequential write where tiles to the right of the
* resampler will not be revisited the chain cache could be
* disabled to save memory.
*/
void createRenderedChain();
/**
* @brief Create a rendered image chain that takes an ossimSrcRecord.
*/
void createRenderedChain(const ossimSrcRecord& src);
/**
* @brief Adds an image handler for file.
*
* @param file File to open.
*
* @param openOverview If true image handler will attempt to open overview.
* Note that if you are planning on doing a rendered chain or want to go
* between res levels you should set this to true. default = true
*
* @return true on success, false on error.
*/
bool addImageHandler(const ossimFilename& file,
bool openOverview=true);
/**
* @brief Adds an image handler from src record.
*
* This take an ossimSrcRecord which can contain a supplemental directory
* to look for overviews.
*
* @param rec Record to open.
* @return true on success, false on error.
*/
bool addImageHandler(const ossimSrcRecord& src);
/** @brief Adds a band selector to the end of the chain. */
void addBandSelector();
/**
* @brief Adds a band selector.
*
* This takes an ossimSrcRecord which can contain a band selection list.
*
* @param src Record to initialize band selector from.
*
*/
void addBandSelector(const ossimSrcRecord& src);
/** @brief Adds histogram remapper to the chain. */
void addHistogramRemapper();
/**
* @brief Adds a band selector.
*
* This takes an ossimSrcRecord which can contain a histogram
* operation to be performed.
*
* @param src Record to initialize band selector from.
*/
void addHistogramRemapper(const ossimSrcRecord& src);
/**
* @brief Adds a new cache to the current end of the chain.
* @return Pointer to cache.
*/
ossimRefPtr<ossimCacheTileSource> addCache();
/** @brief Adds a resampler to the end of the chain. */
void addResampler();
/**
* @brief Adds scalar remapper either to the left of the resampler cache
* or at the end of the chain if not present.
*/
void addScalarRemapper();
/**
* @return ossimRefPtr containing the image handler.
* @note Can contain a null pointer so callers should validate.
*/
ossimRefPtr<ossimImageHandler> getImageHandler() const;
/**
* @return ossimRefPtr containing the image handler.
* @note Can contain a null pointer so callers should validate.
*/
ossimRefPtr<ossimImageHandler> getImageHandler();
/**
* @return ossimRefPtr containing the band selector.
* @note Can contain a null pointer so callers should validate.
*/
ossimRefPtr<ossimBandSelector> getBandSelector() const;
/**
* @return ossimRefPtr containing the band selector.
* @note Can contain a null pointer so callers should validate.
*/
ossimRefPtr<ossimBandSelector> getBandSelector();
/**
* @return ossimRefPtr containing the histogram remapper.
* @note Can contain a null pointer so callers should validate.
*/
ossimRefPtr<ossimHistogramRemapper> getHistogramRemapper() const;
/**
* @return ossimRefPtr containing the histogram remapper.
* @note Can contain a null pointer so callers should validate.
*/
ossimRefPtr<ossimHistogramRemapper> getHistogramRemapper();
/**
* @return ossimRefPtr containing the resampler cache.
* @note Can contain a null pointer so callers should validate.
*/
ossimRefPtr<ossimCacheTileSource> getResamplerCache() const;
/**
* @return ossimRefPtr containing the resampler cache.
* @note Can contain a null pointer so callers should validate.
*/
ossimRefPtr<ossimCacheTileSource> getResamplerCache();
/**
* @return ossimRefPtr containing the resampler.
* @note Can contain a null pointer so callers should validate.
*/
ossimRefPtr<ossimImageRenderer> getImageRenderer() const;
/**
* @return ossimRefPtr containing the resampler.
* @note Can contain a null pointer so callers should validate.
*/
ossimRefPtr<ossimImageRenderer> getImageRenderer();
/**
* @return ossimRefPtr containing the scalar remapper.
* @note Can contain a null pointer so callers should validate.
*/
ossimRefPtr<ossimScalarRemapper> getScalarRemapper() const;
/**
* @return ossimRefPtr containing the scalar remapper.
* @note Can contain a null pointer so callers should validate.
*/
ossimRefPtr<ossimScalarRemapper> getScalarRemapper();
/**
* @return ossimRefPtr containing the chain cache.
* @note Can contain a null pointer so callers should validate.
*/
ossimRefPtr<ossimCacheTileSource> getChainCache() const;
/**
* @return ossimRefPtr containing the chain cache.
* @note Can contain a null pointer so callers should validate.
*/
ossimRefPtr<ossimCacheTileSource> getChainCache();
/**
* @brief If flag is true a histogram will be added to the chain at create time.
* @param flag
*/
void setAddHistogramFlag(bool flag);
/**
* @brief Gets the add histogram flag.
* @return true or false.
*/
bool getAddHistogramFlag() const;
/**
* @brief If flag is true a resampler cache will be added to the chain at create time.
* This is a cache to the left of the resampler.
* @param flag
*/
void setAddResamplerCacheFlag(bool flag);
/**
* @brief Gets the add resampler cache flag.
* @return true or false.
*/
bool getAddResamplerCacheFlag() const;
/**
* @brief If flag is true a chain cache will be added to the chain at create time.
* This is a cache at the end of the chain.
* @param flag
*/
void setAddChainCacheFlag(bool flag);
/**
* @brief Gets the add chain cache flag.
* @return true or false.
*/
bool getAddChainCacheFlag() const;
/**
* @brief Sets remap to eigth bit flag.
* @param flag
*/
void setRemapToEightBitFlag(bool flag);
/**
* @brief Get the remap to eight bit flag.
* @return true or false.
*/
bool getRemapToEightBitFlag() const;
/**
* @brief Sets the three band flag.
*
* If set will for a three band output. So if one band it will duplicate
* so that rgb = b1,b1,b1.
*
* @param flag
*/
void setThreeBandFlag(bool flag);
/**
* @brief Get the three band flag.
* @return true or false.
*/
bool getThreeBandFlag() const;
/**
* @brief Sets the three band reverse flag.
*
* @param flag
*/
void setThreeBandReverseFlag(bool flag);
/**
* @brief Get the three band reverse flag.
* @return true or false.
*/
bool getThreeBandReverseFlag() const;
/**
* @brief Utility method to force 3 band output.
*
* Set band selector to a three band (rgb) output. If image has less than
* three bands it will set to rgb = b1,b1,b1. If image has three or
* more bands the band selector will be see to rgb = b1, b2, b3.
*
* @note This will not work unless the image handler is initialized.
*/
void setToThreeBands();
/**
* @brief Utility method to set to 3 bandsand reverse them. This is
* mainly used by NITF and Lndsat color data where the bands are in bgr
* format and you want it in rgb combination. If image has less than
* three bands it will set to rgb = b1,b1,b1. If image has three or
* more bands the band selector will be see to rgb = b3, b2, b1.
*
* @note This will not work unless the image handler is initialized.
*/
void setToThreeBandsReverse();
/**
* @brief method to set band selector.
*
* This will set the band selection to bandList. If a band selector is
* not in the chain yet it will be added.
*
* @param bandList The list of bands.
*/
void setBandSelection(const std::vector<ossim_uint32>& bandList);
/**
* @brief Convenience method to return the scalar type of the image handler.
*
* @return Scalar type of the image handler.
*
* This can return OSSIM_SCALAR_UNKNOWN if the image handler has not been
* set yet. Also, this is NOT the same as calling getOutputScalarType
* which could have a different scalar type than the image if the
* m_remapToEightBitFlag has been set.
*/
ossimScalarType getImageHandlerScalarType() const;
/**
* @brief Convenience method to open the histogram and apply a default
* stretch.
*
* This will only work if the image is open, there is a histogram remapper
* in the chain, and there was a histogram created.
*
* Valid stretches (from ossimHistogramRemapper.h):
*
@verbatim
ossimHistogramRemapper::LINEAR_ONE_PIECE
ossimHistogramRemapper::LINEAR_1STD_FROM_MEAN
ossimHistogramRemapper::LINEAR_2STD_FROM_MEAN
ossimHistogramRemapper::LINEAR_3STD_FROM_MEAN
ossimHistogramRemapper::LINEAR_AUTO_MIN_MAX
@endverbatim
*
* @return true on success, false on error.
*/
bool openHistogram( ossimHistogramRemapper::StretchMode mode );
private:
/** Pointers to links in chain. */
ossimRefPtr<ossimImageHandler> m_handler;
ossimRefPtr<ossimBandSelector> m_bandSelector;
ossimRefPtr<ossimHistogramRemapper> m_histogramRemapper;
ossimRefPtr<ossimCacheTileSource> m_resamplerCache;
ossimRefPtr<ossimImageRenderer> m_resampler;
ossimRefPtr<ossimScalarRemapper> m_scalarRemapper;
ossimRefPtr<ossimCacheTileSource> m_chainCache;
/** control flags */
bool m_addHistogramFlag;
bool m_addResamplerCacheFlag;
bool m_addChainCacheFlag;
bool m_remapToEightBitFlag;
bool m_threeBandFlag;
bool m_threeBandReverseFlag;
};
#endif /* #ifndef ossimSingleImageChain_HEADER */
|