OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimGeneralRasterWriter.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2000 ImageLinks Inc.
3 //
4 // License: See top level LICENSE.txt file.
5 //
6 // Author: David Burken
7 //
8 //*******************************************************************
9 // $Id: ossimGeneralRasterWriter.cpp 21962 2012-11-30 15:44:32Z dburken $
10 
17 #include <ossim/base/ossimTrace.h>
19 #include <ossim/base/ossimDpt.h>
22 #include <ossim/base/ossimEndian.h>
23 
24 #include <cstdlib>
25 #include <fstream>
26 
27 static ossimTrace traceDebug("ossimGeneralRasterWriter:debug");
28 
30  "ossimGeneralRasterWriter",
32 
33 static const char DEFAULT_FILE_NAME[] = "output.ras";
34 
36  :
38  theOutputStream(0),
39  theOwnsStreamFlag(false),
40  theRlevel(0),
41  theOutputByteOrder(OSSIM_LITTLE_ENDIAN),
42  theMinPerBand(0),
43  theMaxPerBand(0)
44 {
46 
47  // Since there is no internal geometry set the flag to write out one.
50 }
51 
53 {
54  if(isOpen())
55  {
56  close();
57  }
58 }
59 
61 {
62  return ( theOutputStream ? true : false );
63 }
64 
66 {
67  bool result = false;
68 
69  close();
70 
71  // Check for empty filenames.
72  if ( theFilename.size() )
73  {
74  std::ofstream* os = new std::ofstream();
75  os->open(theFilename.c_str(), ios::out | ios::binary);
76 
77  if(os->is_open())
78  {
79  theOutputStream = os;
80  theOwnsStreamFlag = true;
81  result = true;
82  }
83  else
84  {
85  delete os;
86  os = 0;
87  }
88  }
89 
90  return result;
91 }
92 
94 {
95  if (theOutputStream)
96  {
97  theOutputStream->flush();
99  {
100  delete theOutputStream;
101  theOwnsStreamFlag = false;
102  }
103  theOutputStream = 0;
104  }
105 }
106 
108 {
109  bool result = false;
110 
112  {
113  //---
114  // Make sure we can open the file. Note only the master process is used for
115  // writing...
116  //---
118  {
119  if (!isOpen())
120  {
121  open();
122  }
123  }
124 
125  result = writeStream();
126 
127  if ( result )
128  {
129  // Do this only on the master process. Note left to right precedence!
130  if (getSequencer() && getSequencer()->isMaster())
131  {
132  //---
133  // Write the header out. We do this last since we must
134  // compute min max pixel while we are writting the image.
135  // since the header is an external text file this is Ok
136  // to do.
137  //---
138  writeHeader();
139 
140  if (theOutputImageType.contains("envi"))
141  {
142  writeEnviHeader();
143  }
144  }
145  }
146 
147  close();
148  }
149 
150  return result;
151 
152 } // End: ossimGeneralRasterWriter::writeFile()
153 
155 {
156  static const char MODULE[] = "ossimGeneralRasterWriter::writeStream";
157 
158  bool result = false;
159 
162  {
163  if ( theInputConnection->isMaster() )
164  {
165  // Write the file with the image data.
166  if ( (theOutputImageType == "general_raster_bip") ||
167  (theOutputImageType == "general_raster_bip_envi") )
168  {
169  result = writeToBip();
170  }
171  else if ( (theOutputImageType == "general_raster_bil") ||
172  (theOutputImageType == "general_raster_bil_envi") )
173  {
174  result = writeToBil();
175  }
176  else if ( (theOutputImageType == "general_raster_bsq") ||
177  (theOutputImageType == "general_raster_bsq_envi") )
178  {
179  result = writeToBsq();
180  }
181  else
182  {
184  << MODULE << " ERROR:"
185  << "\nUnsupported output type: " << theOutputImageType << std::endl;
186  result = false;
187  }
188 
189  if ( result )
190  {
191  // Flush the stream to disk...
192  theOutputStream->flush();
193  }
194  }
195  else // Matching else: if ( theInputConnection->isMaster() )
196  {
197  // Slave process:
199  result = true;
200  }
201  }
202 
203  return result;
204 
205 } // End: ossimGeneralRasterWriter::writeStream()
206 
208 {
209  ossimEndian endian;
210  static const char* const MODULE = "ossimGeneralRasterWriter::writeToBip";
211 
212  if (traceDebug()) CLOG << " Entered." << std::endl;
213 
214 
215  //---
216  // Get an arbitrary tile just to get the size in bytes!
217  // This should be changed later... An ossimImageSource should know
218  // this.
219  //---
221 
222  // Start the sequence at the first tile.
224 
231 
232  if (traceDebug())
233  {
235  << "\nossimGeneralRasterWriter::writeToBip DEBUG:"
236  << "\nbands: " << bands
237  << "\ntilesWide: " << tilesWide
238  << "\ntilesHigh: " << tilesHigh
239  << "\ntileHeight: " << tileHeight
240  << "\nnumberOfTiles: " << numberOfTiles
241  << "\nwidth: " << width
242  << std::endl;
243  }
244 
245  //---
246  // Buffer to hold one line x tileHeight
247  //---
248  ossim_uint64 bufferSizeInBytes = 0;
249  ossim_uint64 bytesInLine = 0;
250  unsigned char* buffer = NULL;
251 
252  theMinPerBand.clear();
253  theMaxPerBand.clear();
255  bool wroteSomethingOut = false;
257  for(ossim_uint64 i = 0; ((i < tilesHigh)&&(!needsAborting())); ++i)
258  {
259  // Clear the buffer.
260  if(buffer)
261  {
262  memset(buffer, 0, bufferSizeInBytes);
263  }
264 
265  ossimIrect bufferRect(theAreaOfInterest.ul().x,
266  theAreaOfInterest.ul().y + i*tileHeight,
267  theAreaOfInterest.ul().x + (width - 1),
268  theAreaOfInterest.ul().y + i*tileHeight + (tileHeight - 1));
269  // Tile loop in the sample (width) direction.
270  for(ossim_uint64 j = 0; ((j < tilesWide)&&(!needsAborting())); ++j)
271  {
272  // Get the tile and copy it to the buffer.
274  if(id.valid())
275  {
277  if(!buffer)
278  {
279  bytesInLine = id->getScalarSizeInBytes() * width * bands;
280 
281  //---
282  // Buffer to hold one line x tileHeight
283  //---
284  bufferSizeInBytes = bytesInLine * tileHeight;
285  buffer = new unsigned char[bufferSizeInBytes];
286  memset(buffer, 0, bufferSizeInBytes);
287  }
288  id->unloadTile(buffer,
289  bufferRect,
290  OSSIM_BIP);
291  }
292  ++tileNumber;
293  }
294 
295  // Get the number of lines to write from the buffer.
296  ossim_uint64 linesToWrite =
297  min(tileHeight,
298  static_cast<ossim_uint64>(theAreaOfInterest.lr().y -
299  bufferRect.ul().y + 1));
300  // Write the buffer out to disk.
301  ossim_uint8* buf = buffer;
302  if(buf)
303  {
304  for (ossim_uint64 ii=0; ((ii<linesToWrite)&&(!needsAborting())); ++ii)
305  {
306  std::streamsize lineBytes = bytesInLine;
307  wroteSomethingOut = true;
308 
310  {
311  endian.swap(scalarType,
312  buf,
313  lineBytes/ossim::scalarSizeInBytes(scalarType));
314  }
315  theOutputStream->write((char*)buf, lineBytes);
316  if (theOutputStream->fail())
317  {
319  << MODULE << " ERROR:"
320  << "Error returned writing line!" << std::endl;
321  setErrorStatus();
322  if(buffer)
323  {
324  // Free the memory.
325  delete [] buffer;
326  }
327  return false;
328  }
329 
330  buf += bytesInLine;
331 
332  } // End of loop to write lines from buffer to tiff file.
333  }
334  double tile = tileNumber;
335  double numTiles = numberOfTiles;
336  setPercentComplete(tile / numTiles * 100);
337  if(needsAborting())
338  {
339  setPercentComplete(100.0);
340  }
341 
342  } // End of loop in the line (height) direction.
343  if(buffer)
344  {
345  // Free the memory.
346  delete [] buffer;
347  }
348 
349  if (traceDebug()) CLOG << " Exited." << std::endl;
350 
351  return wroteSomethingOut;
352 }
353 
355 {
356  ossimEndian endian;
357  static const char* const MODULE = "ossimGeneralRasterWriter::writeToBil";
358 
359  if (traceDebug()) CLOG << " Entered." << std::endl;
360 
361  //***
362  // Get an arbitrary tile just to get the size in bytes!
363  // This should be changed later... An ossimImageSource should know
364  // this.
365  //***
368 
375  ossim_uint64 bufferSizeInBytes = 0;
376  ossim_uint64 bytesInLine = 0;
377  unsigned char* buffer = NULL;
378 
379  // Start with a clean min/max.
380  theMinPerBand.clear();
381  theMaxPerBand.clear();
382 
384  bool wroteSomethingOut = false;
386  for(ossim_uint64 i = 0; ((i < tilesHigh)&&(!needsAborting())); ++i)
387  {
388  // Clear the buffer.
389  // Clear the buffer.
390  if(buffer)
391  {
392  memset(buffer, 0, bufferSizeInBytes);
393  }
394 
395  ossimIrect bufferRect(theAreaOfInterest.ul().x,
396  theAreaOfInterest.ul().y + i*tileHeight,
397  theAreaOfInterest.ul().x + (width - 1),
398  theAreaOfInterest.ul().y + i *
399  tileHeight + (tileHeight - 1));
400 
401  // Tile loop in the sample (width) direction.
402  for(ossim_uint64 j = 0; ((j < tilesWide)&&(!needsAborting())); ++j)
403  {
404  // Get the tile and copy it to the buffer.
406  if(id.valid())
407  {
409 
410  if(!buffer)
411  {
412  bytesInLine = id->getScalarSizeInBytes() * width;
413 
414  // Buffer to hold one line x tileHeight
415  bufferSizeInBytes = bytesInLine * tileHeight * bands;
416  buffer = new unsigned char[bufferSizeInBytes];
417  memset(buffer, 0, bufferSizeInBytes);
418  }
419  id->unloadTile(buffer,
420  bufferRect,
421  OSSIM_BIL);
422  }
423  ++tileNumber;
424  }
425 
426  // Get the number of lines to write from the buffer.
427  ossim_uint64 linesToWrite =
428  min(tileHeight,
429  static_cast<ossim_uint64>(theAreaOfInterest.lr().y -
430  bufferRect.ul().y + 1));
431 
432  // Write the buffer out to disk.
433  ossim_uint8* buf = buffer;
434  for (ossim_uint64 ii=0; ((ii<linesToWrite)&(!needsAborting())); ++ii)
435  {
436  for (ossim_uint64 band = 0;
437  ((band < bands)&&(!needsAborting()));
438  ++band)
439  {
440  wroteSomethingOut = true;
442  {
443  endian.swap(scalarType,
444  buf,
445  bytesInLine/ossim::scalarSizeInBytes(scalarType));
446  }
447  theOutputStream->write((char*)buf, bytesInLine);
448  if (theOutputStream->fail())
449  {
451  << MODULE << " ERROR:"
452  << "Error returned writing line!" << std::endl;
453  setErrorStatus();
454  if(buffer)
455  {
456  // Free the memory.
457  delete [] buffer;
458  }
459  return false;
460  }
461 
462  buf += bytesInLine;
463  }
464 
465  } // End of loop to write lines from buffer to tiff file.
466 
467  double tile = tileNumber;
468  double numTiles = numberOfTiles;
469  setPercentComplete(tile / numTiles * 100);
470 
471  if(needsAborting())
472  {
473  setPercentComplete(100.0);
474  }
475 
476  } // End of loop in the line (height) direction.
477 
478  if(buffer)
479  {
480  // Free the memory.
481  delete [] buffer;
482  }
483 
484  if (traceDebug()) CLOG << " Exited." << std::endl;
485 
486  return wroteSomethingOut;
487 }
488 
490 {
491  ossimEndian endian;
492  static const char* const MODULE = "ossimGeneralRasterWriter::writeToBsq";
493 
494  if (traceDebug()) CLOG << " Entered." << std::endl;
495 
496  //***
497  // Get an arbitrary tile just to get the size in bytes!
498  // This should be changed later... An ossimImageSource should know
499  // this.
500  //***
502 
503  // Start the sequence at the first tile.
505 
513 
514  ossim_uint64 bytesInLine = 0;
515  ossim_uint64 buf_band_offset = 0;
516 
517  // Use the system "streampos" typedef for future 64 bit seeks (long long).
518  streampos file_band_offset = 0;
519 
520  //***
521  // Buffer to hold one line x tileHeight
522  //***
523  ossim_uint64 bufferSizeInBytes = 0;
524  unsigned char* buffer = NULL;
525 
526  theMinPerBand.clear();
527  theMaxPerBand.clear();
528 
530  bool wroteSomethingOut = false;
532  for(ossim_uint64 i = 0; ((i < tilesHigh)&&(!needsAborting())); ++i)
533  {
534  if(buffer)
535  {
536  // Clear the buffer.
537  memset(buffer, 0, bufferSizeInBytes);
538  }
539 
540  ossimIrect bufferRect(theAreaOfInterest.ul().x,
541  theAreaOfInterest.ul().y + i*tileHeight,
542  theAreaOfInterest.ul().x + (width - 1),
543  theAreaOfInterest.ul().y + i *
544  tileHeight + (tileHeight - 1));
545 
546  // Tile loop in the sample (width) direction.
547  for(ossim_uint64 j = 0; ((j < tilesWide)&&(!needsAborting())); ++j)
548  {
549  // Get the tile and copy it to the buffer.
551  if(id.valid())
552  {
554  if(!buffer)
555  {
556  bytesInLine = id->getScalarSizeInBytes() * width;
557  buf_band_offset = bytesInLine * tileHeight;
558  file_band_offset = height * bytesInLine;
559  bufferSizeInBytes = bytesInLine * tileHeight * bands;
560  buffer = new unsigned char[bufferSizeInBytes];
561  memset(buffer, 0, bufferSizeInBytes);
562  }
563  id->unloadTile(buffer,
564  bufferRect,
565  OSSIM_BSQ);
566  }
567  ++tileNumber;
568  }
569 
570  // Get the number of lines to write from the buffer.
571  ossim_uint64 linesToWrite =
572  min(tileHeight,
573  static_cast<ossim_uint64>(theAreaOfInterest.lr().y -
574  bufferRect.ul().y + 1));
575 
576  // Write the buffer out to disk.
577  ossim_uint64 start_line =
578  static_cast<ossim_uint64>(bufferRect.ul().y -
580  for (ossim_uint64 band = 0; ((band < bands)&&(!needsAborting())); ++band)
581  {
582  ossim_uint8* buf = buffer;
583  buf += buf_band_offset * band;
584 
585  // Put the file pointer in the right spot.
586  streampos pos = file_band_offset * band + start_line * bytesInLine;
587  theOutputStream->seekp(pos, ios::beg);
588  if (theOutputStream->fail())
589  {
590  ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " ERROR:"
591  << "Error returned seeking to image data position!" << std::endl;
592  setErrorStatus();
593  return false;
594  }
595 
596  for (ossim_uint64 ii=0; ((ii<linesToWrite)&&(!needsAborting())); ++ii)
597  {
598  wroteSomethingOut = true;
600  {
601  endian.swap(scalarType,
602  buf,
603  bytesInLine/ossim::scalarSizeInBytes(scalarType));
604  }
605 
606  theOutputStream->write((char*)buf, bytesInLine);
607 
608  if (theOutputStream->fail())
609  {
610  ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " ERROR:"
611  << "Error returned writing line!" << std::endl;
612  setErrorStatus();
613  return false;
614  }
615 
616  buf += bytesInLine;
617  }
618 
619  } // End of loop to write lines from buffer to tiff file.
620 
621  double tile = tileNumber;
622  double numTiles = numberOfTiles;
623  setPercentComplete(tile / numTiles * 100);
624 
625  if(needsAborting())
626  {
627  setPercentComplete(100.0);
628  }
629 
630  } // End of loop in the line (height) direction.
631 
632  // Free the memory.
633  delete [] buffer;
634 
635  if (traceDebug()) CLOG << " Exited." << std::endl;
636 
637  return wroteSomethingOut;
638 }
639 
641  const char* prefix)const
642 {
643  kwl.add(prefix,
645  ((theOutputByteOrder==OSSIM_LITTLE_ENDIAN)?"little_endian":"big_endian"),
646  true);
648  prefix);
649 }
650 
652  const char* prefix)
653 {
654  const char* value;
655 
656  value = kwl.find(prefix, ossimKeywordNames::FILENAME_KW);
657  if(value)
658  {
659  setFilename(ossimFilename(value));
660  }
661 
662  value = kwl.find(prefix, ossimKeywordNames::INPUT_RR_LEVEL_KW);
663  if(value)
664  {
665  theRlevel = atoi(value);
666  }
667 
668  if(ossimImageFileWriter::loadState(kwl, prefix))
669  {
670  if( (theOutputImageType!="general_raster_bip") &&
671  (theOutputImageType!="general_raster_bil") &&
672  (theOutputImageType!="general_raster_bsq") &&
673  (theOutputImageType!="general_raster_bip_envi") &&
674  (theOutputImageType!="general_raster_bil_envi") &&
675  (theOutputImageType!="general_raster_bsq_envi")
676  )
677  {
678  theOutputImageType = "general_raster_bsq";
679  }
680  }
681  else
682  {
683  return false;
684  }
685  const char* outputByteOrder = kwl.find(prefix, ossimKeywordNames::BYTE_ORDER_KW);
687  if(outputByteOrder)
688  {
689  ossimString byteOrder = outputByteOrder;
690  byteOrder = byteOrder.downcase();
691  if(byteOrder.contains("little"))
692  {
694  }
695  else if(byteOrder.contains("big"))
696  {
698  }
699  }
700 
701  return true;
702 }
703 
705 {
706  static const char MODULE[] = "ossimGeneralRasterWriter::writeHeader";
707 
708  if (traceDebug()) CLOG << " Entered..." << std::endl;
709 
710  // Make a header file name from the image file.
711  ossimFilename headerFile = theFilename;
712  headerFile.setExtension(".omd"); // ossim meta data
713 
714  std::ofstream os;
715  os.open(headerFile.c_str(), ios::out);
716  if (!os)
717  {
718  ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " Error:\n"
719  << "Could not open: " << headerFile << std::endl;
720  return;
721  }
722 
723  ossimString interleaveType = getInterleaveString();
724 
725  ossimString scalar =
727  getOutputScalarType());
728 
729  os << "// *** ossim meta data general raster header file ***\n"
731  << theFilename.file().c_str() << "\n"
733  << getOutputImageTypeString() << "\n"
735  << interleaveType.c_str() << "\n"
739  << (theAreaOfInterest.lr().y - theAreaOfInterest.ul().y + 1) << "\n"
741  << (theAreaOfInterest.lr().x - theAreaOfInterest.ul().x + 1) << "\n"
743  << scalar.c_str() << "\n"
745  << ((theOutputByteOrder==OSSIM_BIG_ENDIAN)?"big_endian":"little_endian")
746  << "\n"
747  << std::endl;
748 
749  // Output the null/min/max for each band.
750  os << "\n// NOTE: Bands are one based, band1 is the first band."
751  << std::endl;
752 
754  {
756  ossimString::toString(i+1) + ".";
757 
759  getNullPixelValue(i));
760  ossimString min_pix;
761  ossimString max_pix;
762 
763  if(!theMinPerBand.size()||!theMaxPerBand.size())
764  {
766  getMinPixelValue(i));
768  getMaxPixelValue(i));
769  }
770  else
771  {
772  min_pix = ossimString::toString(theMinPerBand[i]);
773  max_pix = ossimString::toString(theMaxPerBand[i]);
774  }
775 
776  os << prefix.c_str() << ossimKeywordNames::NULL_VALUE_KW << ": "
777  << null_pix.c_str() << "\n"
778  << prefix << ossimKeywordNames::MIN_VALUE_KW << ": "
779  << min_pix.c_str() << "\n"
780  << prefix << ossimKeywordNames::MAX_VALUE_KW << ": "
781  << max_pix.c_str() << std::endl;
782  }
783 
784  os.close();
785 
786  if (traceDebug()) CLOG << " Exited..." << endl;
787 }
788 
790 {
791  static const char MODULE[] = "ossimGeneralRasterWriter::writeEnviHeader";
792 
793  if (traceDebug()) CLOG << " Entered..." << endl;
794 
795  if (!theInputConnection)
796  {
797  return;
798  }
799 
800  // Make a header file name from the image file.
801  ossimFilename headerFile = theFilename;
802  headerFile.setExtension(".hdr"); // ossim meta data
803 
804  ossimString interleaveType = getInterleaveString();
805  ossimKeywordlist kwl;
806  kwl.add(ossimKeywordNames::INTERLEAVE_TYPE_KW, interleaveType.c_str());
807 
810  hdr->initialize();
811  hdr->setFilename(headerFile);
812  hdr->loadState(kwl);
814  hdr->execute();
815 
816  if (traceDebug()) CLOG << " Exited..." << endl;
817 }
818 
820 {
821  return "ras";
822  //return getInterleaveString();
823 }
824 
825 void ossimGeneralRasterWriter::getImageTypeList(std::vector<ossimString>& imageTypeList)const
826 {
827  imageTypeList.push_back(ossimString("general_raster_bip"));
828  imageTypeList.push_back(ossimString("general_raster_bil"));
829  imageTypeList.push_back(ossimString("general_raster_bsq"));
830  imageTypeList.push_back(ossimString("general_raster_bip_envi"));
831  imageTypeList.push_back(ossimString("general_raster_bil_envi"));
832  imageTypeList.push_back(ossimString("general_raster_bsq_envi"));
833 }
834 
836 {
837  ossimString interleaveType = "unknown";
838  if ( (theOutputImageType == "general_raster_bip") ||
839  (theOutputImageType == "general_raster_bip_envi") )
840  {
841  interleaveType = "bip";
842  }
843  else if ( (theOutputImageType == "general_raster_bil") ||
844  (theOutputImageType == "general_raster_bil_envi") )
845  {
846  interleaveType = "bil";
847  }
848  else if ( (theOutputImageType == "general_raster_bsq") ||
849  (theOutputImageType == "general_raster_bsq_envi") )
850  {
851  interleaveType = "bsq";
852  }
853  return interleaveType;
854 }
855 
857 {
859  {
860  delete theOutputStream;
861  }
862  theOutputStream = &stream;
863  theOwnsStreamFlag = false;
864  return true;
865 }
static const char * BYTE_ORDER_KW
static const char * MIN_VALUE_KW
virtual void setOutputImageType(ossim_int32 type)
virtual bool writeStream()
Method to write the image to a stream.
virtual void setAreaOfInterest(const ossimIrect &areaOfInterest)
Sets the area of interest to write the meta data for.
#define CLOG
Definition: ossimTrace.h:23
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Initializes the state of the writer.
ossim_uint32 tileNumber
Represents serializable keyword/value map.
virtual void computeMinMaxPix(std::vector< ossim_float64 > &minBands, std::vector< ossim_float64 > &maxBands) const
If the minBands and maxBands are empty or not equal to the imageData&#39;s current number of bands it wil...
ossimGeneralRasterWriter()
default constructor
static const ossimErrorCode OSSIM_OK
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
bool valid() const
Definition: ossimRefPtr.h:75
const char * find(const char *key) const
virtual ossimString getEntryString(ossim_int32 entry_number) const
static const char * MAX_VALUE_KW
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
ossim_uint32 height() const
Definition: ossimIrect.h:487
bool contains(char aChar) const
Definition: ossimString.h:58
static const char * NULL_VALUE_KW
virtual ossimRefPtr< ossimImageData > getNextTile(ossim_uint32 resLevel=0)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
ossimIrect theAreaOfInterest
static ossimString toString(bool aValue)
Numeric to string methods.
static const char * NUMBER_LINES_KW
const ossimIpt & ul() const
Definition: ossimIrect.h:274
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
Pure virtual base class for image file writers.
virtual ~ossimGeneralRasterWriter()
Protected ( this is a ossimRefPtr) destructor.
void writeEnviHeader() const
Writes an envi header file which can be used to load file in envi.
virtual ossimImageSourceSequencer * getSequencer()
bool writeToBil()
Writes image data to output file in BIL(Band Interleaved by Line) format.
std::vector< double > theMaxPerBand
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static ossimScalarTypeLut * instance()
Returns the static instance of an ossimScalarTypeLut object.
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
RTTI_DEF1(ossimGeneralRasterWriter, "ossimGeneralRasterWriter", ossimImageFileWriter) static const char DEFAULT_FILE_NAME[]
std::string::size_type size() const
Definition: ossimString.h:405
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
virtual ossimString getExtension() const
Returns a 3-letter extension from the image type descriptor (theOutputImageType) that can be used for...
unsigned long long ossim_uint64
static const char * INPUT_RR_LEVEL_KW
unsigned int ossim_uint32
virtual void getImageTypeList(std::vector< ossimString > &imageTypeList) const
void getImageTypeList(std::vector<ossimString>& imageTypeList)const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
saves the state of the object.
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
const ossimIpt & lr() const
Definition: ossimIrect.h:276
static const char * NUMBER_BANDS_KW
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
ossim_uint32 width() const
Definition: ossimIrect.h:500
static const char * BAND_KW
ossimByteOrder getSystemEndianType() const
Definition: ossimEndian.h:78
bool writeToBsq()
Writes image data to output file in BSQ(Band Sequential) format.
ossimScalarType
virtual ossimString getOutputImageTypeString() const
virtual bool writeFile()
Write out the file.
virtual void setFilename(const ossimFilename &file)
virtual bool setOutputStream(std::ostream &stream)
Sets the output stream to write to.
static const char * INTERLEAVE_TYPE_KW
ossim_int64 getNumberOfTilesHorizontal() const
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
virtual ossimErrorCode getErrorStatus() const
ossim_int32 y
Definition: ossimIpt.h:142
virtual void setWriteExternalGeometryFlag(bool flag)
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
static const char * SCALAR_TYPE_KW
virtual void setFilename(const ossimFilename &file)
ossimFilename file() const
ossim_int32 x
Definition: ossimIpt.h:141
bool writeToBip()
Writes image data to output file in BIP(Band Interleaved by Pixel) format.
std::basic_ofstream< char > ofstream
Class for char output file streams.
Definition: ossimIosFwd.h:47
static const char * IMAGE_TYPE_KW
virtual void setPercentComplete(double percentComplete)
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
std::vector< double > theMinPerBand
Populated while writting the data.
static const char * FILENAME_KW
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
Class for writing a "ENVI" style header.
static const char * NUMBER_SAMPLES_KW
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_int64 getNumberOfTilesVertical() const
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
void writeHeader() const
Writes an ossim header file which can be used to load file in ossim.
#define min(a, b)
Definition: auxiliary.h:75