1 //*******************************************************************
2 //
3 // License: MIT
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: Garrett Potts
8 //
9 // Description: Container class for a tile of image data.
10 //
11 //*******************************************************************
12 // $Id$
13 #ifndef ossimImageData_HEADER
14 #define ossimImageData_HEADER 1
15
16 #include <ossim/base/ossimCommon.h>
17 #include <ossim/base/ossimRectilinearDataObject.h>
18 #include <ossim/base/ossimIrect.h>
19 #include <ossim/base/ossimIpt.h>
20 #include <ossim/base/ossimRefPtr.h>
21 #include <ossim/base/ossimMultiResLevelHistogram.h>
22
23 #include <vector>
24 #include <iosfwd> /* for std::ostream */
25
26
27 class ossimMultiBandHistogram;
28
29 class OSSIMDLLEXPORT ossimImageData : public ossimRectilinearDataObject
30 {
31 public:
32
33 /** Definitions for the unloadBand routines. */
34 enum OverwriteBandRule
35 {
36 /*
37 * The COLOR_DISCREPANCY rule directs that the selected band of a pixel
38 * of the destination buffer is to be overwritten if *any* one of the
39 * other bands of the same destination pixel have color values that
40 * deviate from its color.
41 * Deprecated in favor of COLOR_DISCREPANCY_OF_ANY_FROM_DEST.
42 */
43 COLOR_DISCREPANCY = 0,
44
45 /*
46 * The COLOR_DISCREPANCY_OF_ANY_FROM_DEST rule directs that the selected
47 * band of a pixel of the destination buffer is to be overwritten if
48 * *any* one of the other bands of the same destination pixel have color
49 * values that deviate from its color.
50 * Same as the deprecated COLOR_DISCREPANCY.
51 */
52 COLOR_DISCREPANCY_OF_ANY_FROM_DEST = 1,
53
54 /*
55 * The COLOR_DISCREPANCY_OF_ALL_FROM_DEST rule directs that the selected
56 * band of a pixel of the destination buffer is to be overwritten only if
57 * *all* of the other bands of the same destination pixel have color
58 * values that deviate from its color.
59 */
60 COLOR_DISCREPANCY_OF_ALL_FROM_DEST = 2,
61
62 /*
63 * The COLOR_EQUALITY_OF_ANY_TO_SRC rule directs that the selected
64 * band of a pixel of the destination buffer is to be overwritten if
65 * *any* one of the other bands of the same destination pixel have color
66 * values that are equal to the color of the selected band of the source
67 * pixel.
68 */
69 COLOR_EQUALITY_OF_ANY_TO_SRC = 3,
70
71 /*
72 * The COLOR_EQUALITY_OF_ALL_TO_SRC rule directs that the selected
73 * band of a pixel of the destination buffer is to be overwritten only if
74 * *all* of the other bands of the same destination pixel have color
75 * values that are equal to the color of the selected band of the source
76 * pixel.
77 */
78 COLOR_EQUALITY_OF_ALL_TO_SRC = 4,
79
80 /*
81 * The selected band of the destination buffer is to be overwritten
82 * by the selected band of the source image data (no questions asked).
83 */
84 NULL_RULE = 5
85 };
86
87 /** @brief copy constructor */
88 ossimImageData(const ossimImageData &rhs);
89
90 ossimImageData();
91
92 /**
93 * @brief Constructor
94 * @param source The owner. This can be null.
95 * @param scalar The Scalar type like OSSIM_UINT8, OSSIM_UINT16...
96 * @param bands The number of bands.
97 *
98 * @note This does not initialize the undelying data buffer.
99 * Call the initialize method to allocate storage.
100 */
101 ossimImageData(ossimSource* source,
102 ossimScalarType scalar,
103 ossim_uint32 bands = 1);
104
105 /**
106 * @brief Constructor
107 * @param source The owner. This can be null.
108 * @param scalar The Scalar type like OSSIM_UINT8, OSSIM_UINT16...
109 * @param bands The number of bands.
110 * @param width The width or number of samples in the buffer.
111 * @param height The height or numer of lines in the buffer.
112 *
113 * @note This does not initialize the undelying data buffer.
114 * Call the initialize method to allocate storage.
115 */
116 ossimImageData(ossimSource* source,
117 ossimScalarType scalar,
118 ossim_uint32 bands,
119 ossim_uint32 width,
120 ossim_uint32 height);
121
122 /** @brief virtual destructor */
123 virtual ~ossimImageData();
124
125 /**
126 * @brief assignment operator=
127 * @param rhs The data to assign from.
128 * @param A reference to this object.
129 */
130 virtual const ossimImageData& operator=(const ossimImageData &rhs);
131
132
133 /**
134 * @return The width of the data object.
135 */
136 virtual ossim_uint64 getWidth() const;
137
138 /**
139 * @return The height of the data object.
140 */
141 virtual ossim_uint64 getHeight() const;
142
143 /**
144 * @return The image rectangle relative to origin, height and width.
145 */
146 virtual ossimIrect getImageRectangle() const;
147 virtual void getWidthHeight(ossim_uint32& w, ossim_uint32& h);
148 virtual void setWidth(ossim_uint32 width);
149 virtual void setHeight(ossim_uint32 height);
150 virtual void setWidthHeight(ossim_uint32 w, ossim_uint32 h);
151 virtual void setImageRectangleAndBands(const ossimIrect& rect,
152 ossim_uint32 numberOfBands);
153 virtual void setImageRectangle(const ossimIrect& rect);
154 virtual void setOrigin(const ossimIpt& origin);
155
156 virtual void assign(const ossimDataObject* data);
157 virtual void assign(const ossimImageData* data);
158 virtual void assignBand(const ossimImageData* data,
159 ossim_uint32 source_band,
160 ossim_uint32 output_band);
161
162 virtual ossimObject* dup() const;
163
164 /**
165 * Uses prime numbers as coefficients for this summation.
166 * Take the the fours bytes of each origin and multiply
167 * by the prime numbers and sum together. This has
168 * been proven by others to give nicely distributed
169 * id number.
170 */
171 virtual ossim_uint32 getHashId()const;
172
173 virtual void setNullPix(ossim_float64 null_pix);
174 virtual void setNullPix(ossim_float64 null_pix, ossim_uint32 band);
175 virtual void setNullPix(const ossim_float64* nullPixArray,
176 ossim_uint32 numberOfValues);
177 virtual void setMinPix(ossim_float64 min_pix);
178 virtual void setMinPix(ossim_float64 min_pix, ossim_uint32 band);
179 virtual void setMinPix(const ossim_float64* minPixArray,
180 ossim_uint32 numberOfValues);
181 virtual void setMaxPix(ossim_float64 max_pix);
182 virtual void setMaxPix(ossim_float64 max_pix, ossim_uint32 band);
183 virtual void setMaxPix(const ossim_float64* maxPixArray,
184 ossim_uint32 numberOfValues);
185
getOrigin()186 virtual const ossimIpt& getOrigin()const{return m_origin;}
187
188 /**
189 * If the minBands and maxBands are empty or not equal to the imageData's
190 * current number of bands it will erase the contents, resize, and then
191 * replace the values in the passed in array with this objects min max
192 * values. If the arrays are the same size as this objects number of
193 * bands it will just update the values and use the current values in the
194 * arrays as initial min max values.
195 *
196 * If the status of this object(getDataObjectStatus()) is OSSIM_NULL or
197 * OSSIM_EMPTY no action is performed.
198 */
199 virtual void computeMinMaxPix(std::vector<ossim_float64>& minBands,
200 std::vector<ossim_float64>& maxBands) const;
201
202 /**
203 * @brief Scans tile for min, max, nulls.
204 *
205 * If the nullBands, minBands and maxBands are empty or not equal to the
206 * imageData's current number of bands it will erase the contents, resize,
207 * and then replace the values in the passed in array with this objects
208 * min max values. If the arrays are the same size as this objects number
209 * of bands it will just update the values and use the current values in the
210 * arrays as initial min max values.
211 *
212 * If the status of this object(getDataObjectStatus()) is OSSIM_NULL no
213 * action is performed.
214 */
215 virtual void computeMinMaxNulPix(
216 std::vector<ossim_float64>& minBands,
217 std::vector<ossim_float64>& maxBands,
218 std::vector<ossim_float64>& nulBands) const;
219
220 virtual const ossim_float64* getNullPix()const;
221 virtual const ossim_float64* getMinPix()const;
222 virtual const ossim_float64* getMaxPix()const;
223 virtual ossim_float64 getNullPix(ossim_uint32 band) const;
224 virtual ossim_float64 getMinPix(ossim_uint32 band) const;
225 virtual ossim_float64 getMaxPix(ossim_uint32 band) const;
226
227 /**
228 * returns normalized minimum pixel value of band zero.
229 */
230 virtual ossim_float64 getMinNormalizedPix() const;
231 virtual ossimString getScalarTypeAsString()const;
232 virtual ossim_uint32 getNumberOfBands() const;
233 virtual void setNumberOfBands(ossim_uint32 bands,
234 bool reallocate=false);
235
236 /**
237 * Will return the pixel at location position. Note it will first get
238 * the passed in position relative to the origin or upper left
239 * corner of this tile and then return the result.
240 */
241 virtual ossim_float64 getPix(const ossimIpt& position,
242 ossim_uint32 band=0) const;
243
244 /**
245 * Will return the pixel at offset and band number.
246 */
247 virtual ossim_float64 getPix(ossim_uint32 offset,
248 ossim_uint32 band = 0) const;
249
250 /**
251 * will fill the entire band with
252 * the value.
253 */
254 void fill(ossim_uint32 band, ossim_float64 value);
255
256 /**
257 * will fill all bands with the passed in
258 * value.
259 */
260 void fill(ossim_float64 value);
261
262 /**
263 * @brief Creates a step wedge for testing only.
264 *
265 * Writes line at a time of a single value, starting at scalar null,
266 * and going to scalar max in increments of scalar range/tile_lines.
267 */
268 void createTestTile();
269
270 bool isNull(ossim_uint32 offset)const;
271 bool isNull(ossim_uint32 offset, ossim_uint32 band)const;
272 void setNull(ossim_uint32 offset);
273 void setNull(ossim_uint32 offset, ossim_uint32 band);
274
275 bool isNull(const ossimIpt& pt)const;
276 void setNull(const ossimIpt& pt);
277 bool isNull(const ossimIpt& pt, ossim_uint32 band)const;
278 void setNull(const ossimIpt& pt, ossim_uint32 band);
279
280 virtual bool isValidBand(ossim_uint32 band) const;
281 virtual ossimDataObjectStatus validate() const;
282
283 /**
284 * Will take this tile and normalize it to a newly
285 * allocated floating point tile.
286 */
287 virtual ossimRefPtr<ossimImageData> newNormalizedFloat()const;
288
289 /**
290 * will go to the band and offset and compute the
291 * normalized float and return it back to the
292 * caller through the result argument.
293 */
294 virtual void getNormalizedFloat(ossim_uint32 offset,
295 ossim_uint32 bandNumber,
296 ossim_float32& result)const;
297
298 /**
299 * This will assign to this object a normalized
300 * value by unnormalizing to its native type.
301 */
302 virtual void setNormalizedFloat(ossim_uint32 offset,
303 ossim_uint32 bandNumber,
304 ossim_float32 input);
305
306 /**
307 * Will use the memory that you pass in to normalize
308 * this data object.
309 */
310 virtual void convertToNormalizedFloat(ossimImageData* result)const;
311
312 /**
313 * Will take this tile and normalize it to a newly
314 * allocated double point tile.
315 */
316 virtual ossimImageData* newNormalizedDouble()const;
317
318 /**
319 * Will use the memory that you pass in to normalize
320 * this data object.
321 */
322 virtual void convertToNormalizedDouble(ossimImageData* result)const;
323
copyTileToFloatBuffer(T,ossim_float32 * buf)324 template <class T> void copyTileToFloatBuffer(
325 T /* dummyTemplate*/, ossim_float32* buf)const
326 {
327 const ossim_uint64 SIZE = getSizePerBand();
328 const ossim_uint64 BANDS = getNumberOfBands();
329
330 for (ossim_uint64 band = 0; band < BANDS; ++band)
331 {
332 const T* s = (T*)getBuf(band); // source
333 ossim_float32* d = (ossim_float32*)(buf + (band*SIZE)); // destination
334
335 for (ossim_uint64 offset = 0; offset < SIZE; ++offset)
336 {
337 ossim_float32 p = s[offset];
338 d[offset] = p;
339 }
340 }
341 }
342
343 /**
344 * Will take the normalized input and convert it
345 * to this tile's data type. Example: if this
346 * tile is of type UCHAR and its input is of type
347 * NORALIZED_FLOAT it will unnormalize the data by
348 * doing:
349 *
350 * minPix + normalizedInput*(maxPix-minPix)
351 *
352 * on a per band basis.
353 */
354 virtual void unnormalizeInput(ossimImageData* normalizedInput);
355
356 /**
357 * This will compute the average value for the band.
358 */
359 virtual ossim_float64 computeAverageBandValue(
360 ossim_uint32 bandNumber = 0) const;
361
362 /**
363 * This will call the compute average band value and then
364 * use that in the calculation of:
365
366 * It will then do a SUM[(Mean - Actual)^2]/width*height.
367 *
368 * This is the average variance from the passed in
369 * mean.
370 */
371 virtual ossim_float64 computeMeanSquaredError(
372 ossim_float64 meanValue,
373 ossim_uint32 bandNumber = 0) const;
374
375 /**
376 * @brief Populates the histogram with data from this tile.
377 * @param histo Populated by this.
378 * @param clip_rect Should be the rectangle of valid data so as to not
379 * count pixels outside of image area on edge tiles. This will be clipped
380 * to the tile rectangle so callers can simply pass the full image rectangle
381 * in.
382 */
383 virtual void populateHistogram(ossimRefPtr<ossimMultiBandHistogram> histo,
384 const ossimIrect& clip_rect);
385
386 virtual void setHistogram(ossimRefPtr<ossimMultiResLevelHistogram> histo);
387 ossimRefPtr<ossimMultiResLevelHistogram> getHistogram();
388
389 /**
390 * @return true if alpha channel is initialized, false if not.
391 */
392 virtual bool hasAlpha() const;
393
394 /**
395 * @return const ossim_uint8* to the alpha channel or null if the alpha
396 * channel was not computed.
397 */
398 virtual const ossim_uint8* getAlphaBuf() const;
399
400 /**
401 * @return ossim_uint8* to the alpha channel or null if the alpha channel
402 * was not computed.
403 */
404 virtual ossim_uint8* getAlphaBuf();
405
406 /**
407 * @return const void* to theDataBuffer
408 */
409 virtual const void* getBuf() const;
410
411 /**
412 * @return const ossim_uint8* to theDataBuffer if scalar is of type
413 * OSSIM_UCHAR; else, NULL.
414 */
415 virtual const ossim_uint8* getUcharBuf() const;
416
417 /**
418 * @return const ossim_uint16* to theDataBuffer if scalar is of type
419 * OSSIM_USHORT16 or USHORT11; else, NULL.
420 */
421 virtual const ossim_uint16* getUshortBuf() const;
422
423 /**
424 * @return const ossim_sint16* to theDataBuffer if scalar is of type
425 * OSSIM_SSHORT16; else, NULL.
426 */
427 virtual const ossim_sint16* getSshortBuf() const;
428
429 /**
430 * @return const ossim_float32* to theDataBuffer if scalar is of type
431 * OSSIM_FLOAT or OSSIM_NORMALIZED_FLOAT; else, NULL.
432 */
433 virtual const ossim_float32* getFloatBuf() const;
434
435 /**
436 * @return const ossim_float64* to theDataBuffer if scalar is of type
437 * OSSIM_DOUBLE or OSSIM_NORMALIZED_DOUBLE; else, NULL.
438 */
439 virtual const ossim_float64* getDoubleBuf() const;
440
441 /**
442 * @return void* to theDataBuffer
443 */
444 virtual void* getBuf();
445
446 /**
447 * @return ossim_uint8* to theDataBuffer if scalar is of type
448 * OSSIM_UCHAR; else, NULL.
449 */
450 virtual ossim_uint8* getUcharBuf();
451
452 /**
453 * @return ossim_uint16* to theDataBuffer if scalar is of type
454 * OSSIM_USHORT16 or OSSIM_USHORT11; else, NULL.
455 */
456 virtual ossim_uint16* getUshortBuf();
457
458 /**
459 * @return ossim_sint16* to theDataBuffer if scalar is of type
460 * OSSIM_SSHORT16; else, NULL.
461 */
462 virtual ossim_sint16* getSshortBuf();
463
464 /**
465 * @return ossim_float32* to theDataBuffer if scalar is of type
466 * OSSIM_FLOAT or OSSIM_NORMALIZED_FLOAT; else, NULL.
467 */
468 virtual ossim_float32* getFloatBuf();
469
470 /**
471 * @return float64* to theDataBuffer if scalar is of type OSSIM_DOUBLE or
472 * OSSIM_NORMALIZED_DOUBLE; else, NULL.
473 */
474 virtual ossim_float64* getDoubleBuf();
475
476 /**
477 * @param band (zero based)
478 * @return void* to theDataBuffer positioned at band.
479 */
480 virtual const void* getBuf(ossim_uint32 band) const;
481
482 /**
483 * @param band (zero based)
484 * @return ossim_uint8* to theDataBuffer positioned at band if scalar is
485 * of type OSSIM_UCHAR; else, NULL.
486 */
487 virtual const ossim_uint8* getUcharBuf(ossim_uint32 band) const;
488
489 /**
490 * @param band (zero based)
491 * @return ossim_uint16* to theDataBuffer positioned at band if scalar is
492 * of type OSSIM_USHORT16 or OSSIM_USHORT11; else, NULL.
493 */
494 virtual const ossim_uint16* getUshortBuf(ossim_uint32 band) const;
495
496 /**
497 * @param band (zero based)
498 * @return ossim_sint16* to theDataBuffer positioned at band if scalar is
499 * of type OSSIM_SSHORT16; else, NULL.
500 */
501 virtual const ossim_sint16* getSshortBuf(ossim_uint32 band) const;
502
503 /**
504 * @param band (zero based)
505 * @return ossim_float32* to theDataBuffer positioned at band if scalar is
506 * of type OSSIM_FLOAT or OSSIM_NORMALIZED_FLOAT; else, NULL.
507 */
508 virtual const ossim_float32* getFloatBuf(ossim_uint32 band) const;
509
510 /**
511 * @param band (zero based)
512 * @return ossim_float64* to theDataBuffer positioned at band if scalar is
513 * of type OSSIM_DOUBLE or OSSIM_NORMALIZED_DOUBLE; else, NULL.
514 */
515 virtual const ossim_float64* getDoubleBuf(ossim_uint32 band) const;
516
517 /**
518 * @param band (zero based)
519 * @return void* to theDataBuffer positioned at band.
520 */
521 virtual void* getBuf(ossim_uint32 band);
522
523 /**
524 * @param band (zero based)
525 * @return ossim_uint8* to theDataBuffer positioned at band if scalar is
526 * of type OSSIM_UCHAR; else, NULL.
527 */
528 virtual ossim_uint8* getUcharBuf(ossim_uint32 band);
529
530 /**
531 * @param band (zero based)
532 * @return ossim_uint16* to theDataBuffer positioned at band if scalar is
533 * of type OSSIM_USHORT16 or OSSIM_USHORT11; else, NULL.
534 */
535 virtual ossim_uint16* getUshortBuf(ossim_uint32 band);
536
537 /**
538 * @param band (zero based)
539 * @return ossim_sint16* to theDataBuffer positioned at band if scalar is
540 * of type OSSIM_SSHORT16; else, NULL.
541 */
542 virtual ossim_sint16* getSshortBuf(ossim_uint32 band);
543
544 /**
545 * @param band (zero based)
546 * @return ossim_float32* to theDataBuffer positioned at band if scalar is
547 * of type OSSIM_FLOAT or OSSIM_NORMALIZED_FLOAT; else, NULL.
548 */
549 virtual ossim_float32* getFloatBuf(ossim_uint32 band);
550
551 /**
552 * @param band (zero based)
553 * @return ossim_float64* to theDataBuffer positioned at band if scalar is
554 * of type OSSIM_DOUBLE or OSSIM_NORMALIZED_DOUBLE; else, NULL.
555 */
556 virtual ossim_float64* getDoubleBuf(ossim_uint32 band);
557
558 /**
559 * Returns the total number of pixels in a tile for all bands.
560 * Note: This is not in bytes but in pixels.
561 */
562 virtual ossim_uint64 getSize() const;
563
564 /**
565 * Returns the number of pixels in a single band in a tile.
566 * Note: This is not in bytes but in pixels.
567 */
568 virtual ossim_uint64 getSizePerBand() const;
569
570 /**
571 * Returns the number of bytes in single band of the tile.
572 */
573 virtual ossim_uint64 getSizePerBandInBytes() const;
574
575 virtual ossim_uint64 getDataSizeInBytes() const;
576
577 /**
578 * Returns the total number of bytes for all bands.
579 */
580 virtual ossim_uint64 getSizeInBytes() const;
581
582 /**
583 * Initializes data to null pixel values.
584 */
585 virtual void makeBlank();
586
587 /**
588 * Initialize the data buffer.
589 */
590 virtual void initialize();
591
592 /**
593 * @brief Writes tile to stream.
594 *
595 * This will write the buffer to file with an associated header file.
596 * Assuming a contiguous buffer in BSQ format. Currently does not
597 * support converting to BIP or BIL or byte swapping but probably
598 * should add at some point.
599 *
600 * @param f File to write.
601 *
602 * @return true on success, false on error.
603 */
604 virtual bool write(const ossimFilename& f) const;
605
606 /**
607 * Copies entire tile to buf passed in. Data put in buf is normalized.
608 * The "buf" passed to method is assumed to be at least as big as:
609 * "getSize() * sizeof(double)"
610 */
611 virtual void copyTileToNormalizedBuffer(ossim_float64* buf) const;
612 virtual void copyTileToNormalizedBuffer(ossim_float32* buf)const;
613
614 /**
615 * Will copy this tiles specified band number to the normalized buffer.
616 * if the band is out of range then nothing is done and returns.
617 *
618 * @param band Zero based band to copy.
619 *
620 * @param buf Buffer to copy to.
621 */
622 virtual void copyTileBandToNormalizedBuffer(ossim_uint32 band,
623 ossim_float64* buf) const;
624
625 /**
626 * Will copy this tiles specified band number to the normalized buffer.
627 * if the band is out of range then nothing is done and returns.
628 *
629 * @param band Zero based band to copy.
630 *
631 * @param buf Buffer to copy to.
632 */
633 virtual void copyTileBandToNormalizedBuffer(ossim_uint32 band,
634 ossim_float32* buf)const;
635
636 /**
637 * Copies buf passed in to tile. Data is unnormalized to the tile's
638 * scalar type.
639 * The "buf" passed to method is assumed to be at least as big as the tiles:
640 * "getSize() * sizeof(double)"
641 */
642 virtual void copyNormalizedBufferToTile(ossim_float64* buf);
643 virtual void copyNormalizedBufferToTile(ossim_float32* buf);
644
645 /**
646 * Will copy the normalized buffer to this tiles
647 * specified band. If band is out of range then nothing
648 *
649 * is done and returns.
650 */
651 virtual void copyNormalizedBufferToTile(ossim_uint32 band,
652 ossim_float64* buf);
653 virtual void copyNormalizedBufferToTile(ossim_uint32 band,
654 ossim_float32* buf);
655
656 virtual bool isWithin(ossim_int32 x, ossim_int32 y);
657
658 /** Sets the pixel at x,y to color value for all bands */
659 virtual void setValue(ossim_int32 x, ossim_int32 y, ossim_float64 color);
660
661 /** Sets the pixel at x,y to color on specified band */
662 virtual void setValue(ossim_int32 x, ossim_int32 y, ossim_float64 color, ossim_uint32 band);
663
664 virtual void loadBand(const void* src,
665 const ossimIrect& src_rect,
666 ossim_uint32 band);
667
668 virtual void loadBand(const void* src,
669 const ossimIrect& src_rect,
670 const ossimIrect& clip_rect,
671 ossim_uint32 band);
672
673 virtual void loadTile(const void* src,
674 const ossimIrect& src_rect,
675 ossimInterleaveType il_type);
676 virtual void loadTileWithAlpha(const void* src,
677 const ossimIrect& src_rect,
678 ossimInterleaveType il_type);
679
680 virtual void loadTile(const void* src,
681 const ossimIrect& src_rect,
682 const ossimIrect& clip_rect,
683 ossimInterleaveType il_type);
684
685 virtual void nullTileAlpha(const ossim_uint8* src,
686 const ossimIrect& src_rect,
687 bool mutliplyAlphaFlag=false);
688 virtual void nullTileAlpha(const ossim_uint8* src,
689 const ossimIrect& src_rect,
690 const ossimIrect& clip_rect,
691 bool multiplyAlphaFlag=false);
692 /**
693 * Will load a tile of different types. If they
694 * are the same then it will call loadTile(void*...)
695 * method. Note if they are of different types we
696 * will have to go through a much slower assign
697 * process by normalizing the right side and then
698 * unnormalizing to the destination type. For this
699 * method to work they both must have the same
700 * number of bands.
701 */
702 virtual void loadTile(const ossimImageData* src);
703
704 virtual void loadTileFrom1Band(const ossimImageData* data);
705
706 virtual void loadTileFrom1Band(const void* src,
707 const ossimIrect& src_rect);
708
709 /**
710 * @brief Loads a tile from a tile.
711 * This assumes last band of src is an alpha channel.
712 *
713 * Written for compressed data where alpha channel may have been compressed
714 * lossy, e.g. 0s flipped to 1s.
715 *
716 * Alpha is applied in the following manner:
717 * if alpha pixel is less than half of bit depth the input pixel is assumed
718 * null; else, valid. If alpha is valid and input is null, output pixel is
719 * set to min pixel value.
720 */
721 void loadTileFromBsqAlpha(const void* src,
722 const ossimIrect& src_rect,
723 const ossimIrect& clip_rect);
724
725 /**
726 * Specialized to load a tile from a short (16 bit scalar type) buffer.
727 * Performs byte swapping if swap_bytes is set to true.
728 */
729 virtual void loadShortBand(const void* src,
730 const ossimIrect& src_rect,
731 ossim_uint32 band,
732 bool swap_bytes=false);
733
734 /**
735 * This routine is designed for overwriting a selected band of the
736 * destination buffer 'dest' by an independent selected band of the
737 * source buffer according to a user-selected rule, defined by
738 * OverwriteBandRule.
739 *
740 * Currently the rules available in OverwriteBandRule are:
741 *
742 * The COLOR_DISCREPANCY_OF_ANY_FROM_DEST rule directs that the selected
743 * band of a pixel of the destination buffer is to be overwritten if *any*
744 * one of the other bands of the same destination pixel have color values
745 * that deviate from its color. Same as the deprecated COLOR_DISCREPANCY.
746 *
747 * The COLOR_DISCREPANCY_OF_ALL_FROM_DEST rule directs that the selected
748 * band of a pixel of the destination buffer is to be overwritten only if
749 * *all* of the other bands of the same destination pixel have color values
750 * that deviate from its color.
751 *
752 * The COLOR_EQUALITY_OF_ANY_TO_SRC rule directs that the selected
753 * band of a pixel of the destination buffer is to be overwritten if
754 * *any* one of the other bands of the same destination pixel have color
755 * values that are equal to the color of the selected band of the source
756 * pixel.
757 *
758 * The COLOR_EQUALITY_OF_ALL_TO_SRC rule directs that the selected
759 * band of a pixel of the destination buffer is to be overwritten only if
760 * *all* of the other bands of the same destination pixel have color
761 * values that are equal to the color of the selected band of the source
762 * pixel.
763 *
764 * The NULL_RULE rule directs that the selected band of the
765 * destination buffer is to be overwritten by the selected band of the
766 * source image data (no questions asked).
767 *
768 * @note: The 'dest' buffer should have at least the same number of bands
769 * as the 'src' object.
770 *
771 * Currently this routine is only implemented for il_type set to OSSIM_BSQ.
772 *
773 * @param dest The destination buffer, which should have at least the
774 * same number of bands as the 'src' object.
775 * @param src_band The 0-based band of the source image data.
776 * @param dest_band The 0-based band of the dest buffer.
777 * @param dest_rect The rectangle of the destination buffer.
778 * @param il_type The interleave type. Only OSSIM_BSQ available.
779 * @param ow_type The rule for overwriting the destination buffer.
780 */
781 virtual void unloadBand( void* dest,
782 ossim_uint32 src_band,
783 ossim_uint32 dest_band,
784 const ossimIrect& dest_rect,
785 ossimInterleaveType il_type=OSSIM_BSQ,
786 OverwriteBandRule ow_type=NULL_RULE ) const;
787
788 /**
789 * This routine is designed for overwriting a selected band of the
790 * destination buffer 'dest' by an independent selected band of the
791 * source buffer according to a user-selected rule, defined by
792 * OverwriteBandRule.
793 *
794 * Currently the rules available in OverwriteBandRule are:
795 *
796 * The COLOR_DISCREPANCY_OF_ANY_FROM_DEST rule directs that the selected
797 * band of a pixel of the destination buffer is to be overwritten if *any*
798 * one of the other bands of the same destination pixel have color values
799 * that deviate from its color. Same as the deprecated COLOR_DISCREPANCY.
800 *
801 * The COLOR_DISCREPANCY_OF_ALL_FROM_DEST rule directs that the selected
802 * band of a pixel of the destination buffer is to be overwritten only if
803 * *all* of the other bands of the same destination pixel have color values
804 * that deviate from its color.
805 *
806 * The COLOR_EQUALITY_OF_ANY_TO_SRC rule directs that the selected
807 * band of a pixel of the destination buffer is to be overwritten if
808 * *any* one of the other bands of the same destination pixel have color
809 * values that are equal to the color of the selected band of the source
810 * pixel.
811 *
812 * The COLOR_EQUALITY_OF_ALL_TO_SRC rule directs that the selected
813 * band of a pixel of the destination buffer is to be overwritten only if
814 * *all* of the other bands of the same destination pixel have color
815 * values that are equal to the color of the selected band of the source
816 * pixel.
817 *
818 * The NULL_RULE rule directs that the selected band of the
819 * destination buffer is to be overwritten by the selected band of the
820 * source image data (no questions asked).
821 *
822 * @note: The 'dest' buffer should have at least the same number of bands
823 * as the 'src' object.
824 *
825 * Currently this routine is only implemented for il_type set to OSSIM_BSQ.
826 *
827 * @param dest The destination buffer, which should have at least the
828 * same number of bands as the 'src' object.
829 * @param src_band The 0-based band of the source image data.
830 * @param dest_band The 0-based band of the dest buffer.
831 * @param dest_rect The rectangle of the destination buffer.
832 * @param clip_rect Only data within will be copied.
833 * @param il_type The interleave type. Only OSSIM_BSQ available.
834 * @param ow_type The rule for overwriting the destination buffer.
835 */
836 virtual void unloadBand( void* dest,
837 ossim_uint32 src_band,
838 ossim_uint32 dest_band,
839 const ossimIrect& dest_rect,
840 const ossimIrect& clip_rect,
841 ossimInterleaveType il_type=OSSIM_BSQ,
842 OverwriteBandRule ow_type=NULL_RULE ) const;
843
844 /**
845 * @param dest The destination buffer. It is assumed this is a single band
846 * and the size of dest_rect.
847 * @param dest_rect The rectangle of the destination buffer.
848 * @param src_band The band to copy (unload) from the tile.
849 */
850 virtual void unloadBand(void* dest,
851 const ossimIrect& dest_rect,
852 ossim_uint32 src_band) const;
853
854 /**
855 * @param dest The destination buffer. It is assumed this is a single band
856 * and the size of dest_rect.
857 * @param dest_rect The rectangle of the destination buffer.
858 * param clip_rect Only data within the clip_rect will be copied.
859 * @param src_band The band to copy (unload) from the tile.
860 */
861 virtual void unloadBand(void* dest,
862 const ossimIrect& dest_rect,
863 const ossimIrect& clip_rect,
864 ossim_uint32 src_band) const;
865
866 virtual void unloadTile(void* dest,
867 const ossimIrect& dest_rect,
868 ossimInterleaveType il_type ) const;
869
870 virtual void unloadTile(void* dest,
871 const ossimIrect& dest_rect,
872 const ossimIrect& clip_rect,
873 ossimInterleaveType il_type) const;
874
875 /**
876 * @param dest The destination buffer.
877 * @param dest_rect The rectangle of the destination buffer.
878 * param clip_rect Only data within the clip_rect will be copied.
879 * @param src_band The band to copy (unload) from the tile.
880 */
881 virtual void unloadTileToBipAlpha(void* dest,
882 const ossimIrect& dest_rect,
883 const ossimIrect& clip_rect) const;
884
885 virtual bool isPointWithin(const ossimIpt& point)const;
886 virtual bool isPointWithin(ossim_int32 x,
887 ossim_int32 y)const;
888
889 virtual std::ostream& print(std::ostream& out) const;
890
891 /**
892 * @brief Performs linear stretch on tile data from min/max to limits of
893 * scalar type.
894 */
895 virtual void stretchMinMax();
896
897 /**
898 * @brief Computes the alpha channel.
899 *
900 * For each pixel if any band value is not null then alpha will be 255;
901 * else, 0.
902 */
903 virtual void computeAlphaChannel();
904
905 /**
906 * @brief Method to copy a single line to the tile.
907 *
908 * This will copy a line to the tile. It is assumed that all bands are in
909 * the buffer "src". Only pixels within the tile rect will be copied.
910 * Note that all coordinates are relative to the tile coordinates.
911 * Clipping will be performed on pixels outside of the tile rectangle.
912 * No fill is added if a partial tile line is copied so callers
913 * should do a ossimImageData::makeBlank if the whole tile is not to be
914 * stuffed. ossimImageData::validate should be called after all lines
915 * are copied if in doubt of a full tile.
916 *
917 * @param src The source buffer or line to copy containing all bands.
918 *
919 * @param lineNumber Line number to copy.
920 *
921 * @param lineStartSample The start sample of the source buffer relative
922 * to tile coordinates.
923 *
924 * @param lineStopSample The stop sample of the source buffer relative
925 * to tile coordinates.
926 *
927 * @param lineInterleave Interleave of src buffer. If OSSIM_BIP assumed
928 * rgbrgbrgb; else, red row, green row, blue row.
929 *
930 * Usage example in method: ossimTiffTileSource::loadFromScanLine
931 */
932 virtual void copyLine(const void *src,
933 ossim_int64 lineNumber,
934 ossim_int64 lineStartSample,
935 ossim_int64 lineStopSample,
936 ossimInterleaveType lineInterleave);
937
938 /**
939 * @brief Sets the indexed flag.
940 *
941 * This indicates the data contains palette indexes. Default is false.
942 *
943 * @param flag If true data is indexed.
944 */
945 void setIndexedFlag(bool flag);
946
947 /** @return The indexed flag. */
948 bool getIndexedFlag() const;
949
950 /**
951 * @brief Returns the percentage (0-100) of data buffer containing non-null
952 * (valid) entries. Undefined until validate() is called.
953 */
954 ossim_float64 percentFull() const;
955
956 /**
957 * @brief External means to set percent full.
958 * @param percent full.
959 */
960 void setPercentFull( const ossim_float64& percentFull );
961
962 virtual bool saveState(ossimKeywordlist& kwl, const char* prefix=0)const;
963 virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=0);
964 protected:
965 /** @brief Templated copy line method. */
966 template <class T>
967 void copyLineTemplate(T dummyTemplate,
968 const void *src,
969 ossim_int64 lineNumber,
970 ossim_int64 lineStartSample,
971 ossim_int64 lineStopSample,
972 ossimInterleaveType lineInterleave);
973
974 /**
975 * @brief Templated stretch method.
976 *
977 * Performs linear stretches on tile data from min/max to limits of
978 * scalar type.
979 */
980 template <class T> void stretchMinMax(T dummyTemplate);
981
982 /**
983 * @brief Templated compute alpha channel.
984 *
985 * For each pixel if any band value is not null then alpha will be 255;
986 * else, 0.
987 */
988 template <class T> void computeAlphaChannel(T dummyTemplate);
989
990 /**
991 * Templated validate method.
992 *
993 * @return The status of the ossimImageDataMethod.
994 *
995 * @note See ossimConstants.h for ossimDataObjectStatus enumerations.
996 */
997 template <class T> ossimDataObjectStatus validate(T dummyTemplate) const;
998
999 /**
1000 * Templated makeBlank method.
1001 */
1002 template <class T> void makeBlank(T dummyTemplate);
1003
1004 /**
1005 * Templated computeMeanSquaredError method.
1006 */
1007 template <class T>
1008 ossim_float64 computeMeanSquaredError(T dummyTemplate,
1009 ossim_float64 meanValue,
1010 ossim_uint32 bandNumber) const;
1011
1012 /**
1013 * Templated computeAverageBandValue method.
1014 */
1015 template <class T>
1016 ossim_float64 computeAverageBandValue(T dummyTemplate,
1017 ossim_uint32 bandNumber) const;
1018
1019 void loadTileFromBip(const void* src, const ossimIrect& src_rect);
1020 void loadTileFromBipAlpha(const void* src, const ossimIrect& src_rect);
1021 void loadTileFromBil(const void* src, const ossimIrect& src_rect);
1022 void loadTileFromBsq(const void* src, const ossimIrect& src_rect);
1023
1024 void loadTileFromBip(const void* src,
1025 const ossimIrect& src_rect,
1026 const ossimIrect& clip_rect);
1027 void loadTileFromBil(const void* src,
1028 const ossimIrect& src_rect,
1029 const ossimIrect& clip_rect);
1030 void loadTileFromBsq(const void* src,
1031 const ossimIrect& src_rect,
1032 const ossimIrect& clip_rect);
1033
1034 void unloadTileToBip(void* dest,
1035 const ossimIrect& dest_rect,
1036 const ossimIrect& clip_rect) const;
1037 void unloadTileToBil(void* dest,
1038 const ossimIrect& dest_rect,
1039 const ossimIrect& clip_rect) const;
1040 void unloadTileToBsq(void* dest,
1041 const ossimIrect& dest_rect,
1042 const ossimIrect& clip_rect) const;
1043
1044 /**
1045 * Called from public unloadBand() routines that have an
1046 * OverwriteBandRule interface.
1047 *
1048 * @param dest The destination buffer.
1049 * @param src_band The 0-based band of the source image data.
1050 * @param dest_band The 0-based band of the destination buffer.
1051 * @param dest_rect The rectangle of the destination buffer.
1052 * @param clip_rect Only data within will be copied.
1053 * @param ow_type The rule for overwriting the destination buffer.
1054 */
1055 virtual void unloadBandToBsq( void* dest,
1056 ossim_uint32 src_band,
1057 ossim_uint32 dest_band,
1058 const ossimIrect& dest_rect,
1059 const ossimIrect& clip_rect,
1060 OverwriteBandRule ow_type=NULL_RULE ) const;
1061
1062 /**
1063 * Copies entire tile to buf passed in. Data put in buf is normalized.
1064 * The "buf" passed to method is assumed to be at least as big as:
1065 * "getSize() * sizeof(double)"
1066 */
1067 template <class T>
1068 void copyTileToNormalizedBuffer(T dummyTemplate,
1069 ossim_float64* buf) const;
1070 template <class T>
1071 void copyTileToNormalizedBuffer(T dummyTemplate,
1072 ossim_float32* buf)const;
1073
1074 /**
1075 * Will copy this tiles specified band number to the normalized buffer.
1076 * if the band is out of range then nothing is done and returns.
1077 */
1078 template <class T>
1079 void copyTileToNormalizedBuffer(T dummyTemplate,
1080 ossim_uint32 band, ossim_float64* buf) const;
1081 template <class T>
1082 void copyTileToNormalizedBuffer(T dummyTemplate,
1083 ossim_uint32 band, ossim_float32* buf)const;
1084
1085 /**
1086 * Copies buf passed in to tile. Data is unnormalized to the tile's
1087 * scalar type.
1088 * The "buf" passed to method is assumed to be at least as big as the tiles:
1089 * "getSize() * sizeof(double)"
1090 */
1091 template <class T>
1092 void copyNormalizedBufferToTile(T dummyTemplate,
1093 ossim_float64* buf);
1094 template <class T>
1095 void copyNormalizedBufferToTile(T dummyTemplate,
1096 ossim_float32* buf);
1097 template <class T>
1098 void copyNormalizedBufferToTile(T dummyTemplate,
1099 ossim_uint32 band,
1100 ossim_float64* buf);
1101 template <class T>
1102 void copyNormalizedBufferToTile(T dummyTemplate,
1103 ossim_uint32 band,
1104 ossim_float32* buf);
1105
1106
1107 template <class T>
1108 void computeMinMaxPix(T dummyValue,
1109 std::vector<ossim_float64>& minBands,
1110 std::vector<ossim_float64>& maxBands) const;
1111
1112 template <class T>
1113 void computeMinMaxNulPix(T dummyValue,
1114 std::vector<ossim_float64>& minBands,
1115 std::vector<ossim_float64>& maxBands,
1116 std::vector<ossim_float64>& nulBands) const;
1117
1118 template <class T> void loadBandTemplate(T, // dummy template variable
1119 const void* src,
1120 const ossimIrect& src_rect,
1121 ossim_uint32 band);
1122
1123 template <class T> void loadBandTemplate(T, // dummy template variable
1124 const void* src,
1125 const ossimIrect& src_rect,
1126 const ossimIrect& clip_rect,
1127 ossim_uint32 band);
1128
1129 template <class T> void nullTileAlphaTemplate(T,
1130 const ossim_uint8* src,
1131 const ossimIrect& src_rect,
1132 const ossimIrect& clip_rect,
1133 bool multiplyAlphaFlag=false);
1134
1135 template <class T> void loadTileFromBipTemplate(T, // dummy template variable
1136 const void* src,
1137 const ossimIrect& src_rect);
1138 template <class T> void loadTileFromBipAlphaTemplate(T, // dummy template variable
1139 const void* src,
1140 const ossimIrect& src_rect);
1141
1142 template <class T> void loadTileFromBipTemplate(T, // dummy template variable
1143 const void* src,
1144 const ossimIrect& src_rect,
1145 const ossimIrect& clip_rect);
1146 template <class T>
1147 void loadTileFromBipAlphaTemplate(T, // dummy template variable
1148 const void* src,
1149 const ossimIrect& src_rect,
1150 const ossimIrect& clip_rect);
1151
1152 template <class T> void loadTileFromBilTemplate(T, // dummy template variable
1153 const void* src,
1154 const ossimIrect& src_rect);
1155
1156 template <class T> void loadTileFromBilTemplate(T, // dummy template variable
1157 const void* src,
1158 const ossimIrect& src_rect,
1159 const ossimIrect& clip_rect);
1160
1161 template <class T> void loadTileFromBsqTemplate(T, // dummy template variable
1162 const void* src,
1163 const ossimIrect& src_rect);
1164
1165 template <class T> void loadTileFromBsqTemplate(T, // dummy template variable
1166 const void* src,
1167 const ossimIrect& src_rect,
1168 const ossimIrect& clip_rect);
1169
1170 template <class T> void loadTileFromBsqAlphaTemplate(T, // dummy template variable
1171 const void* src,
1172 const ossimIrect& src_rect,
1173 const ossimIrect& clip_rect);
1174
1175 template <class T> void unloadTileToBipTemplate(T, // dummy template variable
1176 void* dest,
1177 const ossimIrect& dest_rect,
1178 const ossimIrect& clip_rect) const;
1179
1180 template <class T> void unloadTileToBipAlphaTemplate(T, // dummy template variable
1181 void* dest,
1182 const ossimIrect& dest_rect,
1183 const ossimIrect& clip_rect) const;
1184
1185 template <class T> void unloadTileToBilTemplate(T, // dummy template variable
1186 void* dest,
1187 const ossimIrect& dest_rect,
1188 const ossimIrect& clip_rect) const;
1189
1190 template <class T> void unloadTileToBsqTemplate(T, // dummy template variable
1191 void* dest,
1192 const ossimIrect& dest_rect,
1193 const ossimIrect& clip_rect) const;
1194
1195 template <class T> void unloadBandTemplate(T, // dummy template variable
1196 void* dest,
1197 const ossimIrect& dest_rect,
1198 const ossimIrect& clip_rect,
1199 ossim_uint32 band) const;
1200
1201 template <class T> void unloadBandToBsqTemplate(T, // dummy template variable
1202 void* dest,
1203 ossim_uint32 src_band,
1204 ossim_uint32 dest_band,
1205 const ossimIrect& dest_rect,
1206 const ossimIrect& clip_rect,
1207 OverwriteBandRule ow_type=NULL_RULE) const;
1208
1209 /**
1210 * @brief Creates a test tile for scalar type for testing only.
1211 *
1212 * Protected template implementation of matching public createTestTile.
1213 */
1214 template <class T> void createTestTile(T);
1215
1216 /**
1217 * @brief initializeDefaults() Resizes and sets min/max/null arrays to
1218 * number of bands and some default value for scalar type.
1219 */
1220 virtual void initializeDefaults();
1221
1222 /**
1223 * @brief initializeMinDefault() Resizes theMinPixelValue array to number
1224 * of bands and initializes to the default min for scalar type.
1225 */
1226 virtual void initializeMinDefault();
1227
1228 /**
1229 * @brief initializeMaxDefault() Resizes theMaxPixelValue array to number
1230 * of bands and initializes to the default max for scalar type.
1231 */
1232 virtual void initializeMaxDefault();
1233
1234 /**
1235 * @brief initializeNullDefault() Resizes theNullPixelValue array to number
1236 * of bands and initializes to the default null for scalar type.
1237 */
1238 virtual void initializeNullDefault();
1239
1240 virtual bool isEqualTo(const ossimDataObject& rhs,
1241 bool deepTest=false)const;
1242
hasSameDimensionsAs(ossimImageData * data)1243 bool hasSameDimensionsAs(ossimImageData* data)const
1244 {
1245 bool result = false;
1246 if(data)
1247 {
1248 result = ((m_spatialExtents.size() ==
1249 data->m_spatialExtents.size())&&
1250 (m_spatialExtents[0] == data->m_spatialExtents[0])&&
1251 (m_spatialExtents[1] == data->m_spatialExtents[1])&&
1252 (m_scalarType == data->m_scalarType));
1253 }
1254 return result;
1255 }
1256
1257 /** Null pixel value for each band. */
1258 std::vector<ossim_float64> m_nullPixelValue;
1259
1260 /** Min pixel value for each band. */
1261 std::vector<ossim_float64> m_minPixelValue;
1262
1263 /** Max pixel value for each band. */
1264 std::vector<ossim_float64> m_maxPixelValue;
1265
1266 /** Alpha channel */
1267 std::vector<ossim_uint8> m_alpha;
1268
1269 ossimIpt m_origin;
1270
1271 /** Indicates data contains palette indexes. */
1272 bool m_indexedFlag;
1273
1274 ossimRefPtr<ossimMultiResLevelHistogram> m_histogram;
1275
1276 /** percentage (0-100) of image tile that has valid (non-null) pixel values. This is computed
1277 * in validate() method.
1278 */
1279 mutable ossim_float64 m_percentFull;
1280
1281 private:
1282
1283
1284 TYPE_DATA
1285 };
1286
hasAlpha()1287 inline bool ossimImageData::hasAlpha() const
1288 {
1289 return (m_alpha.size()?true:false);
1290 }
1291
getImageRectangle()1292 inline ossimIrect ossimImageData::getImageRectangle() const
1293 {
1294 ossimIpt lr(m_origin.x + getWidth() - 1,
1295 m_origin.y + getHeight() - 1);
1296
1297 return ossimIrect(m_origin, lr);
1298 }
1299
getNullPix()1300 inline const ossim_float64* ossimImageData::getNullPix()const
1301 {
1302 return ( m_nullPixelValue.size() > 0 ? &m_nullPixelValue.front() : 0 );
1303 }
1304
getMinPix()1305 inline const ossim_float64* ossimImageData::getMinPix()const
1306 {
1307 return ( m_minPixelValue.size() > 0 ? &m_minPixelValue.front() : 0 );
1308 }
1309
getMaxPix()1310 inline const ossim_float64* ossimImageData::getMaxPix()const
1311 {
1312 return ( m_maxPixelValue.size() > 0 ? &m_maxPixelValue.front() : 0 );
1313 }
1314
getNullPix(ossim_uint32 band)1315 inline ossim_float64 ossimImageData::getNullPix(ossim_uint32 band) const
1316 {
1317 return ( band < m_nullPixelValue.size() ? m_nullPixelValue[band] :
1318 ossim::defaultNull( getScalarType() ) );
1319 }
1320
getMinPix(ossim_uint32 band)1321 inline ossim_float64 ossimImageData::getMinPix(ossim_uint32 band) const
1322 {
1323 return ( band < m_minPixelValue.size() ? m_minPixelValue[band] :
1324 ossim::defaultMin( getScalarType() ) );
1325 }
1326
getMaxPix(ossim_uint32 band)1327 inline ossim_float64 ossimImageData::getMaxPix(ossim_uint32 band) const
1328 {
1329 return ( band < m_maxPixelValue.size() ? m_maxPixelValue[band] :
1330 ossim::defaultMax( getScalarType() ) );
1331 }
1332
getHashId()1333 inline ossim_uint32 ossimImageData::getHashId()const
1334 {
1335 const unsigned char *bufx = (unsigned char*)(&m_origin.x);
1336 const unsigned char *bufy = (unsigned char*)(&m_origin.y);
1337 return (ossim_uint32)(bufx[0]*101 + bufx[1]*103 +
1338 bufx[2]*107 + bufx[3]*109 +
1339 bufy[0]*139 + bufy[1]*149 +
1340 bufy[2]*151 + bufy[3]*157);
1341 }
1342
1343 #endif
1344