OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ossimTiffWriter Class Reference

#include <ossimTiffWriter.h>

Inheritance diagram for ossimTiffWriter:
ossimImageFileWriter ossimImageWriter ossimProcessInterface ossimConnectableObjectListener ossimOutputSource ossimListener ossimSource ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced

Public Types

enum  UnitType {
  UNDEFINED = 0, LINEAR_METER = 9001, LINEAR_FOOT = 9002, LINEAR_FOOT_US_SURVEY = 9003,
  ANGULAR_DEGREES = 9102
}
 
enum  { USER_DEFINED = 32767 }
 
- Public Types inherited from ossimConnectableObject
enum  ossimConnectableObjectDirectionType { CONNECTABLE_DIRECTION_NONE = 0, CONNECTABLE_DIRECTION_INPUT = 1, CONNECTABLE_DIRECTION_OUTPUT = 2 }
 
typedef std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
 
- Public Types inherited from ossimProcessInterface
enum  ossimProcessStatus {
  PROCESS_STATUS_UNKNOWN = 0, PROCESS_STATUS_EXECUTING = 1, PROCESS_STATUS_ABORTED = 2, PROCESS_STATUS_ABORT_REQUEST = 3,
  PROCESS_STATUS_NOT_EXECUTING = 4
}
 

Public Member Functions

 ossimTiffWriter ()
 
virtual ~ossimTiffWriter ()
 
virtual void getImageTypeList (std::vector< ossimString > &imageTypeList) const
 void getImageTypeList(std::vector<ossimString>& imageTypeList)const More...
 
virtual bool isOpen () const
 
virtual bool open ()
 
virtual void close ()
 
virtual void setJpegQuality (ossim_int32 quality)
 Ranges from 1 to 100 with 100 being the best. More...
 
virtual ossim_int32 getJpegQuality () const
 
virtual void setCompressionType (const ossimString &type)
 compression type can be JPEG, PACKBITS, or ZIP/DEFLATE More...
 
virtual ossimString getCompressionType () const
 
virtual bool getGeotiffFlag () const
 
virtual void setGeotiffFlag (bool flag)
 
virtual void setTileSize (const ossimIpt &tileSize)
 Sets the output image tiling size if supported by the writer. More...
 
virtual ossimIpt getOutputTileSize () const
 
virtual ossim_int32 setProjectionInfo (const ossimMapProjectionInfo &proj)
 
void setLut (const ossimNBandLutDataObject &lut)
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 saves the state of the object. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Method to the load (recreate) the state of an object from a keyword list. More...
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 Will set the property whose name matches the argument "property->getName()". More...
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 Pushes this's names onto the list of property names. More...
 
virtual ossimString getExtension () const
 Returns a 3-letter extension from the image type descriptor (theOutputImageType) that can be used for image file extensions. More...
 
bool hasImageType (const ossimString &imageType) const
 bool hasImageType(const ossimString& imageType) const More...
 
- Public Member Functions inherited from ossimImageFileWriter
 ossimImageFileWriter (const ossimFilename &filename=ossimFilename(), ossimImageSource *inputSource=0, ossimObject *owner=0)
 The writer will own the sequencer. More...
 
virtual ~ossimImageFileWriter ()
 
virtual ossimObjectgetObject ()
 
virtual const ossimObjectgetObject () const
 
virtual bool getOutputHasInternalOverviews (void) const
 Examples of writers that always generate internal overviews are ossim_kakadu_jp2 and ossim_kakadu_nitf_j2k. More...
 
virtual bool writeEnviHeaderFile ()
 Will write an envi header file. More...
 
virtual bool writeErsHeaderFile ()
 Will write an ER Mapper header file. More...
 
virtual bool writeExternalGeometryFile ()
 Will write an external geometry file. More...
 
virtual bool writeFgdcFile ()
 Will write an fgdc file. More...
 
virtual bool writeHistogramFile ()
 Returns true on success, false on error. More...
 
virtual bool writeJpegWorldFile ()
 Will write a jpeg world file. More...
 
virtual bool writeOverviewFile (ossim_uint16 tiff_compress_type=1, ossim_int32 jpeg_compress_quality=75, bool includeR0=false)
 Write out an ossim overview file from the source_file. More...
 
virtual bool writeReadmeFile ()
 Will write a readme file. More...
 
virtual bool writeTiffWorldFile ()
 Will write a world file. More...
 
virtual bool writeWorldFile ()
 Will write a world file. More...
 
virtual bool writeMetaDataFiles ()
 Convenience method that calls meta data write methods that are flagged to be called. More...
 
virtual void setAreaOfInterest (const ossimIrect &inputRect)
 
virtual void changeSequencer (ossimImageSourceSequencer *sequencer)
 Sets the sequencer and connects it to the input of this. More...
 
virtual ossimImageSourceSequencergetSequencer ()
 
virtual void initialize ()
 Initialize method. More...
 
virtual bool execute ()
 Calls: writeFile() writeMetaDataFiles() More...
 
virtual bool writeStream ()
 Method to write the image to a stream. More...
 
virtual bool setOutputStream (ossimRefPtr< ossimOStream > stream)
 Sets the output stream to write to. More...
 
virtual bool setOutputStream (std::ostream &str)
 tmp drb More...
 
virtual ossimRefPtr< ossimOStreamgetOutputStream () const
 Method to return the stream attached to output. More...
 
virtual void setPercentComplete (double percentComplete)
 
virtual void setOutputImageType (ossim_int32 type)
 
virtual void setOutputImageType (const ossimString &type)
 
virtual ossim_int32 getOutputImageType () const
 
virtual ossimString getOutputImageTypeString () const
 
virtual void setOutputName (const ossimString &outputName)
 
virtual void setFilename (const ossimFilename &file)
 
virtual const ossimFilenamegetFilename () const
 
virtual bool canConnectMyInputTo (ossim_int32 inputIndex, const ossimConnectableObject *object) const
 required to be overriden by derived classes More...
 
virtual void disconnectInputEvent (ossimConnectionEvent &event)
 
virtual void connectInputEvent (ossimConnectionEvent &event)
 
virtual void propertyEvent (ossimPropertyEvent &event)
 
virtual bool getWriteImageFlag () const
 Control flags... More...
 
virtual bool getWriteHistogramFlag () const
 
virtual bool getWriteOverviewFlag () const
 
virtual bool getScaleToEightBitFlag () const
 
virtual bool getWriteEnviHeaderFlag () const
 
virtual bool getWriteErsHeaderFlag () const
 
virtual bool getWriteExternalGeometryFlag () const
 
virtual bool getWriteFgdcFlag () const
 
virtual bool getWriteJpegWorldFileFlag () const
 
virtual bool getWriteReadmeFlag () const
 
virtual bool getWriteTiffWorldFileFlag () const
 
virtual bool getWriteWorldFileFlag () const
 
virtual void setWriteImageFlag (bool flag)
 
virtual void setWriteOverviewFlag (bool flag)
 
virtual void setWriteHistogramFlag (bool flag)
 
virtual void setScaleToEightBitFlag (bool flag)
 
virtual void setWriteEnviHeaderFlag (bool flag)
 
virtual void setWriteErsHeaderFlag (bool flag)
 
virtual void setWriteExternalGeometryFlag (bool flag)
 
virtual void setWriteFgdcFlag (bool flag)
 
virtual void setWriteJpegWorldFile (bool flag)
 
virtual void setWriteReadme (bool flag)
 
virtual void setWriteTiffWorldFile (bool flag)
 
virtual void setWriteWorldFile (bool flag)
 
virtual ossim_uint16 getOverviewCompressType () const
 
virtual ossim_int32 getOverviewJpegCompressQuality () const
 
virtual void setOverviewCompressType (ossim_uint16 type)
 
virtual void setOverviewJpegCompressQuality (ossim_int32 quality)
 
virtual bool addListener (ossimListener *listener)
 Overrides base "addListener" this will capture the pointer and then call the base class "addListener". More...
 
virtual bool removeListener (ossimListener *listener)
 Overrides base "removeListener". More...
 
virtual void setPixelType (ossimPixelType type)
 If "point" the coordinate tie points are relative to the center of the pixel. More...
 
virtual void setPixelType (const ossimString &type)
 If "point" the coordinate tie points are relative to the center of the pixel. More...
 
virtual ossimPixelType getPixelType () const
 
virtual void getPixelTypeString (ossimString &type) const
 
- Public Member Functions inherited from ossimImageWriter
 ossimImageWriter (ossimObject *owner=NULL)
 
 ossimImageWriter (ossimObject *owner, ossim_uint32 numberOfInputs, ossim_uint32 numberOfOutputs, bool inputListIsFixed, bool outputListIsFixed)
 
virtual ~ossimImageWriter ()
 
virtual bool setViewingRect (const ossimIrect &aRect)
 
virtual ossimIrect getAreaOfInterest () const
 
- Public Member Functions inherited from ossimOutputSource
 ossimOutputSource (ossimObject *owner=NULL)
 
 ossimOutputSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimOutputSource ()
 
virtual bool open (const ossimString &outputName)
 
virtual const ossimStringgetOutputName ()
 
- Public Member Functions inherited from ossimSource
 ossimSource (ossimObject *owner=0)
 
 ossimSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimSource ()
 
virtual bool isSourceEnabled () const
 
virtual void enableSource ()
 
virtual void disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimConnectableObject
 ossimConnectableObject (ossimObject *owner=0)
 Base constructor of this object. More...
 
 ossimConnectableObject (ossimObject *owner, ossim_int32 inputListSize, ossim_int32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimConnectableObject ()
 
void setId (const ossimId &id)
 All connectable objects will have id's. More...
 
const ossimIdgetId () const
 Will allow us to get this object's id. More...
 
const ossimObjectgetOwner () const
 Fetches the current owner, most likely a container but not limited to one. More...
 
virtual void changeOwner (ossimObject *owner)
 Permits changing the object's owner. More...
 
virtual void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual bool isConnected (ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
 will check the direction specified to see if all slots are full. More...
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findConnectableObject(const ossimId &id))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(RTTItypeid typeId, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(const ossimString &obj, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findInputObjectOfType(const ossimString &className))
 
virtual ossim_int32 findInputIndex (const ossimConnectableObject *object)
 Return a valid index of the input list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findInputIndex (const ossimId &id)
 Return a valid index of the input list if the passed id is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimConnectableObject *object)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimId &id)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 getMyInputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual ossim_int32 getMyOutputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual bool canConnectMyOutputTo (ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
 default implementation is to allow anyone to connect to us. More...
 
virtual void disconnect (ossimConnectableObject *object=0)
 Will disconnect the object passed in. More...
 
virtual void disconnect (const ossimId &id)
 Will disconnect the object passed in. More...
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyInput (ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given input index and generate a connection event. More...
 
virtual void disconnectMyInput (ossimConnectableObject *input, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Finds the index of the passed in input and calls disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);. More...
 
virtual void disconnectMyInputs (ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyOutput (ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given output index and generate a connection event. More...
 
virtual void disconnectMyOutput (ossimConnectableObject *output, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the output object. More...
 
virtual void disconnectMyOutputs (ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual void disconnectAllInputs ()
 Will disconnect all of the input objects. More...
 
virtual void disconnectAllOutputs ()
 Will disconnect all of the output objects. More...
 
virtual ossim_int32 connectMyInputTo (ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will try to connect this objects input to the passed in object. More...
 
virtual ossim_int32 connectMyInputTo (ossim_int32 inputIndex, ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will connect the specified input to the passed in object. More...
 
virtual bool connectMyInputTo (ConnectableObjectList &inputList, bool makeOutputConnection=true, bool createEventFlag=true)
 
virtual ossim_int32 connectMyOutputTo (ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
 Will try to connect this objects output to the passed in object. More...
 
virtual bool connectMyOutputTo (ConnectableObjectList &outputList, bool makeInputConnection=true, bool createEventFlag=true)
 
virtual bool connectInputList (ConnectableObjectList &inputList)
 Will disconnect itself from all inputs and reset to the passed in input list. More...
 
virtual bool connectOutputList (ConnectableObjectList &outputList)
 Will disconnect itself from all outputs and reset to the passed in output list. More...
 
virtual ossim_uint32 getNumberOfInputs () const
 Returns the number of input objects. More...
 
virtual ossim_uint32 getNumberOfOutputs () const
 Return the number of output objects. More...
 
ossimConnectableObjectgetInput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetInput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
ossimConnectableObjectgetOutput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetOutput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
virtual void setNumberOfInputs (ossim_int32 numberOfInputs)
 Will set the number of inputs. More...
 
virtual bool getInputListIsFixedFlag () const
 
virtual bool getOutputListIsFixedFlag () const
 
virtual void setNumberOfOutputs (ossim_int32 numberOfInputs)
 Will set the number of outputs. More...
 
const ConnectableObjectListgetInputList () const
 
const ConnectableObjectListgetOutputList () const
 
ConnectableObjectListgetInputList ()
 
ConnectableObjectListgetOutputList ()
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const RTTItypeid &typeInfo, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const ossimString &className, bool recurse=true))
 
virtual void propagateEventToOutputs (ossimEvent &event)
 
virtual void propagateEventToInputs (ossimEvent &event)
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossim_uint32 saveStateOfAllInputs (ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
 Save the state of all inputs to a keyword list. More...
 
virtual bool fillContainer (ossimConnectableContainer &container)
 Inserts this object and all of its children and inputs into the container provided. More...
 
bool moveInputUp (const ossimId &id)
 Moves the input connection matching id up one in the connection list. More...
 
bool moveInputDown (const ossimId &id)
 Moves the input connection matching id down one in the connection list. More...
 
bool moveInputToTop (const ossimId &id)
 Moves the input connection matching id to the top of the connection list. More...
 
bool moveInputToBottom (const ossimId &id)
 Moves the input connection matching id to the bottom of the connection list. More...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool findListener (ossimListener *listener)
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 
- Public Member Functions inherited from ossimProcessInterface
 ossimProcessInterface ()
 
virtual ~ossimProcessInterface ()
 
virtual void abort ()
 
bool needsAborting () const
 
bool isAbortRequested () const
 
bool isAborted () const
 
bool isExecuting () const
 
ossimProcessStatus getProcessStatus () const
 
virtual void setProcessStatus (ossimProcessStatus processStatus)
 
virtual double getPercentComplete () const
 
virtual ossimListenerManagergetManager ()
 
void enableEvents ()
 
void disableEvents ()
 
void setCurrentMessage (const ossimString &message)
 
virtual std::ostream & print (std::ostream &out) const
 
- Public Member Functions inherited from ossimConnectableObjectListener
 ossimConnectableObjectListener ()
 
virtual ~ossimConnectableObjectListener ()
 
virtual void processEvent (ossimEvent &event)
 ProcessEvent. More...
 
virtual void objectDestructingEvent (ossimObjectDestructingEvent &)
 
virtual void connectionEvent (ossimConnectionEvent &)
 
virtual void disconnectOutputEvent (ossimConnectionEvent &)
 
virtual void connectOutputEvent (ossimConnectionEvent &)
 
virtual void addObjectEvent (ossimContainerEvent &)
 
virtual void removeObjectEvent (ossimContainerEvent &)
 
virtual void containerEvent (ossimContainerEvent &)
 
virtual void refreshEvent (ossimRefreshEvent &)
 
- Public Member Functions inherited from ossimListener
 ossimListener ()
 
virtual ~ossimListener ()
 
void enableListener ()
 
void disableListener ()
 
void setListenerEnableFlag (bool flag)
 
bool isListenerEnabled () const
 
bool getListenerEnableFlag () const
 

Static Public Member Functions

static void dumpTileToFile (ossimRefPtr< ossimImageData > t, const ossimFilename &f)
 Will take an ossimIMageData tile and write it to disk as a general raster file. More...
 

Protected Member Functions

virtual bool writeFile ()
 Write out the file. More...
 
bool openTiff ()
 
bool closeTiff ()
 
bool writeToTiles ()
 Writes image data to a tiled tiff format. More...
 
bool writeToTilesBandSep ()
 Writes image data to a tiled tiff band separate format. More...
 
bool writeToStrips ()
 Writes image data to a strip tiff format. More...
 
bool writeToStripsBandSep ()
 Writes image data to a strip tiff band separate format. More...
 
bool writeTiffTags ()
 Writes tiff tags from ossimMapProjectionInfo to tiff file. More...
 
bool writeGeotiffTags (ossimRefPtr< ossimMapProjectionInfo > projectionInfo)
 Writes geotiff tags from ossimMapProjectionInfo to tiff file. More...
 
bool isTiled () const
 
void writeMinMaxTags (const vector< ossim_float64 > &minBand, const vector< ossim_float64 > &maxBand)
 
bool isLutEnabled () const
 
UnitType getUnitType (ossim_int32 pcsCode, const ossimString &projName) const
 
UnitType getPcsUnitType (ossim_int32 pcsCode) const
 
void checkColorLut ()
 
- Protected Member Functions inherited from ossimImageFileWriter
bool writeWorldFile (const ossimFilename &file)
 Common world file writer method. More...
 
- Protected Member Functions inherited from ossimSource
 ossimSource (const ossimSource &rhs)
 
const ossimSourceoperator= (const ossimSource &rhs)
 
- Protected Member Functions inherited from ossimConnectableObject
ossimConnectableObjectfindObjectOfType (ConnectableObjectList *connectableList, ossimVisitor &visitor)
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimListenerManager
 ossimListenerManager (const ossimListenerManager &rhs)
 

Protected Attributes

void * theTif
 
ossimString theCompressionType
 
ossimString thePhotoMetric
 
ossim_int32 theJpegQuality
 
bool theOutputGeotiffTagsFlag
 
bool theColorLutFlag
 
ossimRefPtr< ossimMapProjectionInfotheProjectionInfo
 
ossimIpt theOutputTileSize
 
ossimRefPtr< ossimNBandLutDataObjecttheColorLut
 
ossimFilename theLutFilename
 
bool theForceBigTiffFlag
 
bool theBigTiffFlag
 
ossimRefPtr< ossimNBandToIndexFiltertheNBandToIndexFilter
 
- Protected Attributes inherited from ossimImageFileWriter
ossimRefPtr< ossimImageSourceSequencertheInputConnection
 
ossimRefPtr< ossimViewControllertheViewController
 
ossimListenertheProgressListener
 
ossimFilename theFilename
 
ossimString theOutputImageType
 
bool theWriteImageFlag
 
bool theWriteOverviewFlag
 
bool theWriteHistogramFlag
 
bool theScaleToEightBitFlag
 
ossim_uint16 theOverviewCompressType
 
ossim_int32 theOverviewJpegCompressQuality
 
bool theWriteEnviHeaderFlag
 External meta data writer flags. More...
 
bool theWriteErsHeaderFlag
 
bool theWriteExternalGeometryFlag
 
bool theWriteFgdcFlag
 
bool theWriteJpegWorldFileFlag
 
bool theWriteReadmeFlag
 
bool theWriteTiffWorldFileFlag
 
bool theWriteWorldFileFlag
 
bool theAutoCreateDirectoryFlag
 
ossimUnitType theLinearUnits
 If not a geographic projection this allows the user to set the linear units of the output tag to be: More...
 
ossimPixelType thePixelType
 OSSIM_PIXEL_IS_POINT = 0, OSSIM_PIXEL_IS_AREA = 1. More...
 
- Protected Attributes inherited from ossimImageWriter
ossimIrect theAreaOfInterest
 
- Protected Attributes inherited from ossimOutputSource
ossimString theOutputName
 
- Protected Attributes inherited from ossimSource
bool theEnableFlag
 
bool theInitializedFlag
 
- Protected Attributes inherited from ossimConnectableObject
ossimId theId
 
ossimString theDescription
 
ossimObjecttheOwner
 
bool theInputListIsFixedFlag
 Indicates whether the theInputObjectList is fixed. More...
 
bool theOutputListIsFixedFlag
 Indicates whether the theOutputObjectList is fixed. More...
 
ConnectableObjectList theInputObjectList
 Holds a list of input objects. More...
 
ConnectableObjectList theOutputObjectList
 Holds a list of output objects. More...
 
- Protected Attributes inherited from ossimListenerManager
std::list< ossimListener * > theListenerList
 
bool theEnabledFlag
 
std::list< ossimListener * > theDelayedAdd
 
std::list< ossimListener * > theDelayedRemove
 
bool theFireEventFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 
- Protected Attributes inherited from ossimProcessInterface
double thePercentComplete
 
ossimProcessStatus theProcessStatus
 
ossimString theMessage
 
bool theEventFlag
 
- Protected Attributes inherited from ossimListener
bool theListenerEnableFlag
 

Detailed Description

Definition at line 25 of file ossimTiffWriter.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
USER_DEFINED 

Definition at line 42 of file ossimTiffWriter.h.

43  {
44  USER_DEFINED = 32767
45  };

◆ UnitType

Enumerator
UNDEFINED 
LINEAR_METER 
LINEAR_FOOT 
LINEAR_FOOT_US_SURVEY 
ANGULAR_DEGREES 

Definition at line 33 of file ossimTiffWriter.h.

Constructor & Destructor Documentation

◆ ossimTiffWriter()

ossimTiffWriter::ossimTiffWriter ( )

Definition at line 61 of file ossimTiffWriter.cpp.

Referenced by dumpTileToFile().

62 :
64  theTif(NULL),
65  theCompressionType("none"),
66  theJpegQuality(DEFAULT_JPEG_QUALITY),
68  theColorLutFlag(false),
69  theProjectionInfo(NULL),
71  theForceBigTiffFlag(false),
72  theBigTiffFlag(false)
73 {
76  theOutputImageType = "tiff_tiled_band_separate";
77 
78 
79 #ifdef OSSIM_ID_ENABLED /* to quell unused variable warning. */
80  if (traceDebug())
81  {
82  ossimNotify(ossimNotifyLevel_DEBUG)<< "OSSIM_ID: " << OSSIM_ID << endl;
83  }
84 #endif
85 }
ossimRefPtr< ossimNBandLutDataObject > theColorLut
ossimIpt theOutputTileSize
ossimString theCompressionType
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
ossim_int32 theJpegQuality
ossimImageFileWriter(const ossimFilename &filename=ossimFilename(), ossimImageSource *inputSource=0, ossimObject *owner=0)
The writer will own the sequencer.
#define OSSIM_DEFAULT_TILE_WIDTH
ossimRefPtr< ossimMapProjectionInfo > theProjectionInfo
#define OSSIM_DEFAULT_TILE_HEIGHT
class ossimNBandLutDataObject
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ~ossimTiffWriter()

ossimTiffWriter::~ossimTiffWriter ( )
virtual

Definition at line 87 of file ossimTiffWriter.cpp.

References closeTiff(), and isOpen().

88 {
89  if(isOpen())
90  {
91  closeTiff();
92  }
93 }
virtual bool isOpen() const

Member Function Documentation

◆ checkColorLut()

void ossimTiffWriter::checkColorLut ( )
protected

Definition at line 390 of file ossimTiffWriter.cpp.

References ossimConnectableContainerInterface::findAllObjectsOfType(), ossimRefPtr< T >::get(), ossimConnectableObject::getInputList(), ossimImageHandler::getLut(), PTR_CAST, setLut(), STATIC_TYPE_INFO, and ossimImageFileWriter::theInputConnection.

391 {
392 
393  // this code appears to be wrong. We can only do an outo lut if the immediate input to the sequencer is
394  // a handler with a lut or some kind of lut source.
395  //
396  // I think that we should add a flag to enable auto setting of the lut instead of just doing it. This code causes core
397  // dumps if one is to replicate bands with a band selector where a lut is a single band output like a CIB
398  //
399  // I currenlty have to disable
400  //
401 
402 
403 #if 0
404  bool needColorLut = false;
405  bool needLoop = true;
408  if (imageInputs.size() > 0)
409  {
410  for (ossim_uint32 i = 0; i < imageInputs.size(); i++)
411  {
412  if (needLoop == false)
413  {
414  break;
415  }
416  ossimImageChain* source = PTR_CAST(ossimImageChain, imageInputs[i].get());
417  if (source)
418  {
420  for (ossim_uint32 j = 0; j < imageChains.size(); j++)
421  {
422  if (needLoop == false)
423  {
424  break;
425  }
426  ossimImageChain* imageChain = PTR_CAST(ossimImageChain, imageChains[j].get());
427  if (imageChain)
428  {
431 
432  for (ossim_uint32 h= 0; h < imageHandlers.size(); h++)
433  {
434  ossimImageHandler* handler =
435  PTR_CAST(ossimImageHandler, imageHandlers[h].get());
436  if (handler)
437  {
438  if (handler->getLut() != 0) //
439  {
440  colorLut = handler->getLut();
441  needColorLut = true;
442  }
443  else //if not all handlers have color luts, ignore the color lut.
444  {
445  needColorLut = false;
446  needLoop = false;
447  break;
448  }
449  }
450  }
451  }
452  }
453  }
454  }
455  }
456 
457  if (needColorLut && colorLut != 0)
458  {
459  setLut(*colorLut.get());
460  }
461 #endif
462 }
virtual ossimRefPtr< ossimNBandLutDataObject > getLut() const
virtual ossimConnectableObject::ConnectableObjectList findAllObjectsOfType(const RTTItypeid &typeInfo, bool recurse=true)=0
const ConnectableObjectList & getInputList() const
std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
unsigned int ossim_uint32
#define STATIC_TYPE_INFO(T)
Definition: ossimRtti.h:319
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
This class defines an abstract Handler which all image handlers(loaders) should derive from...
void setLut(const ossimNBandLutDataObject &lut)

◆ close()

void ossimTiffWriter::close ( )
virtual

Generic interface to allow one to close a consumer. For displays this might minimize the window and free up internal pointers for file writers it will make sure the file stream is closed and flushed.

Implements ossimOutputSource.

Definition at line 1580 of file ossimTiffWriter.cpp.

References closeTiff().

Referenced by ATP::AtpAnnotatedImage::write().

1581 {
1582  closeTiff();
1583 }

◆ closeTiff()

bool ossimTiffWriter::closeTiff ( )
protected
Returns
true on success, false on error.

Definition at line 152 of file ossimTiffWriter.cpp.

References theTif.

Referenced by close(), open(), openTiff(), and ~ossimTiffWriter().

153 {
154  if (theTif)
155  {
156  XTIFFClose( (TIFF*)theTif );
157  theTif = NULL;
158  }
159  return true;
160 }
struct tiff TIFF

◆ dumpTileToFile()

void ossimTiffWriter::dumpTileToFile ( ossimRefPtr< ossimImageData t,
const ossimFilename f 
)
static

Will take an ossimIMageData tile and write it to disk as a general raster file.

Definition at line 1755 of file ossimTiffWriter.cpp.

References ossimRefPtr< T >::get(), OSSIM_UINT8, ossimTiffWriter(), and ossimMemoryImageSource::setImage().

1756 {
1758  tile->setImage(t);
1761  writer->connectMyInputTo(0, remapper.get());
1762  writer->setFilename(f);
1763  writer->setGeotiffFlag(false);
1764  writer->execute();
1765  writer=0;
1766  tile=0;
1767 }
void setImage(ossimRefPtr< ossimImageData > image)
8 bit unsigned integer

◆ getCompressionType()

ossimString ossimTiffWriter::getCompressionType ( ) const
virtual

Definition at line 1620 of file ossimTiffWriter.cpp.

References theCompressionType.

Referenced by getProperty().

1621 {
1622  return theCompressionType;
1623 }
ossimString theCompressionType

◆ getExtension()

ossimString ossimTiffWriter::getExtension ( ) const
virtual

Returns a 3-letter extension from the image type descriptor (theOutputImageType) that can be used for image file extensions.

Parameters
imageTypestring representing image type.
Returns
the 3-letter string extension.

Reimplemented from ossimImageFileWriter.

Definition at line 1656 of file ossimTiffWriter.cpp.

1657 {
1658  return ossimString("tif");
1659 }

◆ getGeotiffFlag()

bool ossimTiffWriter::getGeotiffFlag ( ) const
virtual

Definition at line 1625 of file ossimTiffWriter.cpp.

References theOutputGeotiffTagsFlag.

1626 {
1627  return theOutputGeotiffTagsFlag;
1628 }

◆ getImageTypeList()

void ossimTiffWriter::getImageTypeList ( std::vector< ossimString > &  imageTypeList) const
virtual

void getImageTypeList(std::vector<ossimString>& imageTypeList)const

Appends this writer image types to list "imageTypeList".

This writer has the following types: tiff_strip tiff_strip_band_separate tiff_tiled tiff_tiled_band_separate

Parameters
imageTypeListstl::vector<ossimString> list to append to.

Implements ossimImageFileWriter.

Definition at line 1648 of file ossimTiffWriter.cpp.

1649 {
1650  imageTypeList.push_back(ossimString("tiff_strip"));
1651  imageTypeList.push_back(ossimString("tiff_strip_band_separate"));
1652  imageTypeList.push_back(ossimString("tiff_tiled"));
1653  imageTypeList.push_back(ossimString("tiff_tiled_band_separate"));
1654 }

◆ getJpegQuality()

ossim_int32 ossimTiffWriter::getJpegQuality ( ) const
virtual
Returns
theJpegQuality

Definition at line 1609 of file ossimTiffWriter.cpp.

References theJpegQuality.

1610 {
1611 
1612  return theJpegQuality;
1613 }
ossim_int32 theJpegQuality

◆ getOutputTileSize()

ossimIpt ossimTiffWriter::getOutputTileSize ( ) const
virtual

Definition at line 1635 of file ossimTiffWriter.cpp.

References theOutputTileSize.

1636 {
1637  return theOutputTileSize;
1638 }
ossimIpt theOutputTileSize

◆ getPcsUnitType()

ossimTiffWriter::UnitType ossimTiffWriter::getPcsUnitType ( ossim_int32  pcsCode) const
protected

Definition at line 1730 of file ossimTiffWriter.cpp.

References ossimMapProjection::getProjectionUnits(), ossimEpsgProjectionDatabase::instance(), LINEAR_FOOT_US_SURVEY, LINEAR_METER, OSSIM_METERS, PTR_CAST, UNDEFINED, and ossimRefPtr< T >::valid().

Referenced by getUnitType().

1731 {
1732  UnitType pcsUnits = UNDEFINED;
1733 
1735  ossimEpsgProjectionDatabase::instance()->findProjection((ossim_uint32) pcsCode));
1736 
1737  if (proj.valid())
1738  {
1739  ossimUnitType type = proj->getProjectionUnits();
1740  if (type == OSSIM_METERS)
1741  {
1742  pcsUnits = LINEAR_METER;
1743  }
1744  else
1745  {
1746  pcsUnits = LINEAR_FOOT_US_SURVEY;
1747  }
1748  }
1749  return pcsUnits;
1750 }
ossimUnitType
bool valid() const
Definition: ossimRefPtr.h:75
static ossimEpsgProjectionDatabase * instance()
Instantiates singleton instance of this class:
unsigned int ossim_uint32
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
ossimUnitType getProjectionUnits() const
OSSIM considers all map projection coordinates (including false eastings and northings) to be in mete...

◆ getProperty()

ossimRefPtr< ossimProperty > ossimTiffWriter::getProperty ( const ossimString name) const
virtual
Parameters
nameName of property to return.
Returns
A pointer to a property object which matches "name". Returns NULL if no match is found.

Reimplemented from ossimImageFileWriter.

Definition at line 1471 of file ossimTiffWriter.cpp.

References ossimStringProperty::addConstraint(), ossimFilenameProperty::addFilter(), ossimKeywordNames::COMPRESSION_QUALITY_KW, ossimKeywordNames::COMPRESSION_TYPE_KW, ossimRefPtr< T >::get(), getCompressionType(), ossimImageFileWriter::getProperty(), ossimFilenameProperty::ossimFilenamePropertyIoType_INPUT, ossimNumericProperty::ossimNumericPropertyType_INT, ossimKeywordNames::OUTPUT_TILE_SIZE_KW, PTR_CAST, ossimNumericProperty::setNumericType(), theColorLutFlag, theForceBigTiffFlag, theJpegQuality, theLutFilename, theOutputTileSize, ossimString::toString(), ossimRefPtr< T >::valid(), and ossimIpt::x.

1472 {
1473  ossimRefPtr<ossimProperty> prop = 0;
1474 
1475  if (name == "Filename")
1476  {
1477  prop = ossimImageFileWriter::getProperty(name);
1478  if ( prop.valid() )
1479  {
1481  prop.get());
1482  if ( filenameProp.valid() )
1483  {
1484  filenameProp->addFilter("*.tif");
1485  }
1486  prop = filenameProp.get();
1487  }
1488  }
1490  {
1491  ossimRefPtr<ossimNumericProperty> numericProp =
1492  new ossimNumericProperty(name,
1494  1.0,
1495  100.0);
1497  prop = numericProp.get();
1498  }
1499  else if (name == ossimKeywordNames::COMPRESSION_TYPE_KW)
1500  {
1502  new ossimStringProperty(name,
1504  false); // editable flag
1505  stringProp->addConstraint(ossimString("none"));
1506  stringProp->addConstraint(ossimString("jpeg"));
1507  stringProp->addConstraint(ossimString("lzw"));
1508  stringProp->addConstraint(ossimString("packbits"));
1509  stringProp->addConstraint(ossimString("deflate"));
1510  stringProp->addConstraint(ossimString("zip"));
1511  prop = stringProp.get();
1512  }
1513  else if (name == "lut_file")
1514  {
1518 
1519  prop = property.get();
1520  }
1521  else if (name == "color_lut_flag")
1522  {
1523  prop = new ossimBooleanProperty(name, theColorLutFlag);
1524  }
1525  else if(name == "big_tiff_flag")
1526  {
1527  prop = new ossimBooleanProperty(name, theForceBigTiffFlag);
1528  }
1529  else if( name == ossimKeywordNames::OUTPUT_TILE_SIZE_KW )
1530  {
1532  new ossimStringProperty(name,
1534  false); // editable flag
1535  stringProp->addConstraint(ossimString("16"));
1536  stringProp->addConstraint(ossimString("32"));
1537  stringProp->addConstraint(ossimString("64"));
1538  stringProp->addConstraint(ossimString("128"));
1539  stringProp->addConstraint(ossimString("256"));
1540  stringProp->addConstraint(ossimString("512"));
1541  stringProp->addConstraint(ossimString("1024"));
1542  stringProp->addConstraint(ossimString("2048"));
1543  prop = stringProp.get();
1544  }
1545  else
1546  {
1547  prop = ossimImageFileWriter::getProperty(name);
1548  }
1549  return prop;
1550 }
ossimIpt theOutputTileSize
static const char * OUTPUT_TILE_SIZE_KW
bool valid() const
Definition: ossimRefPtr.h:75
static ossimString toString(bool aValue)
Numeric to string methods.
ossimFilename theLutFilename
void addConstraint(const ossimString &value)
ossim_int32 theJpegQuality
virtual ossimString getCompressionType() const
virtual void setNumericType(ossimNumericPropertyType type)
static const char * COMPRESSION_TYPE_KW
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
static const char * COMPRESSION_QUALITY_KW
ossim_int32 x
Definition: ossimIpt.h:141
void addFilter(const ossimString &filter)

◆ getPropertyNames()

void ossimTiffWriter::getPropertyNames ( std::vector< ossimString > &  propertyNames) const
virtual

Pushes this's names onto the list of property names.

Parameters
propertyNamesarray to add this's property names to.

Reimplemented from ossimImageFileWriter.

Definition at line 1552 of file ossimTiffWriter.cpp.

References ossimKeywordNames::COMPRESSION_QUALITY_KW, ossimKeywordNames::COMPRESSION_TYPE_KW, ossimImageFileWriter::getPropertyNames(), and ossimKeywordNames::OUTPUT_TILE_SIZE_KW.

1553 {
1554  propertyNames.push_back(ossimString(
1556  propertyNames.push_back(ossimString(
1558  propertyNames.push_back(ossimString("lut_file"));
1559  propertyNames.push_back(ossimString("color_lut_flag"));
1560  propertyNames.push_back(ossimString("big_tiff_flag"));
1561  propertyNames.push_back(ossimString(ossimKeywordNames::OUTPUT_TILE_SIZE_KW));
1562 
1564 }
static const char * OUTPUT_TILE_SIZE_KW
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
static const char * COMPRESSION_TYPE_KW
static const char * COMPRESSION_QUALITY_KW

◆ getUnitType()

ossimTiffWriter::UnitType ossimTiffWriter::getUnitType ( ossim_int32  pcsCode,
const ossimString projName 
) const
protected

Definition at line 1682 of file ossimTiffWriter.cpp.

References ANGULAR_DEGREES, getPcsUnitType(), LINEAR_FOOT, LINEAR_FOOT_US_SURVEY, LINEAR_METER, OSSIM_FEET, OSSIM_METERS, OSSIM_US_SURVEY_FEET, ossimImageFileWriter::theLinearUnits, and UNDEFINED.

1685 {
1686 
1687 
1688  if ( ( projName == "ossimCylEquAreaProjection" ) ||
1689  ( projName == "ossimEquDistCylProjection" ) ||
1690  ( projName == "ossimLlxyProjection" ) )
1691  {
1692  return ANGULAR_DEGREES;
1693  }
1694 
1695  UnitType pcsUnits = getPcsUnitType(pcsCode);
1696 
1697  UnitType type = UNDEFINED;
1698 
1699  switch (theLinearUnits)
1700  {
1701  case OSSIM_METERS:
1702  {
1703  type = LINEAR_METER;
1704  break;
1705  }
1706 
1707  case OSSIM_FEET:
1708  {
1709  type = LINEAR_FOOT;
1710  break;
1711  }
1712 
1713  case OSSIM_US_SURVEY_FEET:
1714  {
1715  type = LINEAR_FOOT_US_SURVEY;
1716  break;
1717  }
1718  default:
1719  {
1720  break;
1721  }
1722  }
1723  if (type == UNDEFINED)
1724  {
1725  return pcsUnits;
1726  }
1727  return type;
1728 }
ossimUnitType theLinearUnits
If not a geographic projection this allows the user to set the linear units of the output tag to be: ...
UnitType getPcsUnitType(ossim_int32 pcsCode) const

◆ hasImageType()

bool ossimTiffWriter::hasImageType ( const ossimString imageType) const
virtual

bool hasImageType(const ossimString& imageType) const

Parameters
imageTypestring representing image type.
Returns
true if "imageType" is supported by writer.

Reimplemented from ossimImageFileWriter.

Definition at line 1661 of file ossimTiffWriter.cpp.

References ossimImageFileWriter::hasImageType().

1662 {
1663  // check for non image type list types
1664  // We will support mime type
1665  //
1666  if((imageType == "image/tiff")||
1667  (imageType == "image/gtiff")||
1668  (imageType == "image/tif")||
1669  (imageType == "image/gtif"))
1670  {
1671  return true;
1672  }
1673 
1674  return ossimImageFileWriter::hasImageType(imageType);
1675 }
virtual bool hasImageType(const ossimString &imageType) const
bool hasImageType(const ossimString& imageType) const

◆ isLutEnabled()

bool ossimTiffWriter::isLutEnabled ( ) const
protected

Definition at line 1677 of file ossimTiffWriter.cpp.

References theColorLutFlag.

1678 {
1679  return (theColorLutFlag);
1680 }

◆ isOpen()

bool ossimTiffWriter::isOpen ( ) const
virtual

Implements ossimOutputSource.

Definition at line 1566 of file ossimTiffWriter.cpp.

References theTif.

Referenced by ~ossimTiffWriter().

1567 {
1568  return (theTif!=NULL);
1569 }

◆ isTiled()

bool ossimTiffWriter::isTiled ( ) const
protected
Returns
true if the output type is tiled, false if not.

Definition at line 847 of file ossimTiffWriter.cpp.

References ossimImageFileWriter::theOutputImageType.

Referenced by writeTiffTags().

848 {
849  return ( theOutputImageType == "tiff_tiled" ||
850  theOutputImageType == "image/tiff" ||
851  theOutputImageType == "image/tif" ||
852  theOutputImageType == "image/gtif" ||
853  theOutputImageType == "image/gtiff" ||
854  theOutputImageType == "tiff_tiled_band_separate" );
855 }

◆ loadState()

bool ossimTiffWriter::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

Method to the load (recreate) the state of an object from a keyword list.

Return true if ok or false on error.

Reimplemented from ossimImageFileWriter.

Definition at line 735 of file ossimTiffWriter.cpp.

References ossim::defaultTileSize(), and ossimKeywordlist::find().

737 {
738  const char *value;
739 
742 
743  value = kwl.find(prefix,
744  TIFF_WRITER_OUTPUT_TILE_SIZE_X_KW);
745  if(value)
746  {
748  if(theOutputTileSize.x<1)
749  {
751  }
752  }
753 
754  value = kwl.find(prefix,
755  TIFF_WRITER_OUTPUT_TILE_SIZE_Y_KW);
756  if(value)
757  {
759  if(theOutputTileSize.y<1)
760  {
762  }
763  }
764 
765 
766  value = kwl.find(prefix, ossimKeywordNames::COMPRESSION_TYPE_KW);
767  if(value)
768  {
770  }
771  else
772  {
773  theCompressionType = "none";
774  }
775 
776  value = kwl.find(prefix, ossimKeywordNames::COMPRESSION_QUALITY_KW);
777  if(value)
778  {
779  setJpegQuality(ossimString(value).toLong());
780  }
781 
782  value = kwl.find(prefix, ossimKeywordNames::PHOTOMETRIC_KW);
783  if(value)
784  {
786  }
787 
788  value = kwl.find(prefix, ossimKeywordNames::FILENAME_KW);
789  if(value)
790  {
791  setFilename(ossimFilename(value));
792  }
793 
794  const char* flag = kwl.find(prefix, "output_geotiff_flag");
795  if(flag)
796  {
798  }
799 
800  ossimString newPrefix = ossimString(prefix) + "lut.";
801 
802  const char* colorLutFlag = kwl.find(prefix, "color_lut_flag");
803  if(colorLutFlag)
804  {
805  theColorLutFlag = ossimString(colorLutFlag).toBool();
806  }
807  else
808  {
809  theColorLutFlag = false;
810  }
811  theLutFilename = ossimFilename(kwl.find(prefix, "lut_filename"));
812 
814  if(theLutFilename != "")
815  {
817  }
818  else
819  {
820  theColorLut->loadState(kwl, newPrefix.c_str());
821  }
822 
824  prefix))
825  {
826  if((theOutputImageType!="tiff_tiled") &&
827  (theOutputImageType!="tiff_tiled_band_separate") &&
828  (theOutputImageType!="tiff_strip") &&
829  (theOutputImageType!="tiff_strip_band_separate")&&
830  (theOutputImageType!="image/tiff")&&
831  (theOutputImageType!="image/tif")&&
832  (theOutputImageType!="image/gtif")&&
833  (theOutputImageType!="image/gtiff"))
834  {
835 
836  theOutputImageType = "tiff_tiled_band_separate";;
837  }
838  }
839  else
840  {
841  return false;
842  }
843 
844  return true;
845 }
static const char * PHOTOMETRIC_KW
virtual void setJpegQuality(ossim_int32 quality)
Ranges from 1 to 100 with 100 being the best.
ossimRefPtr< ossimNBandLutDataObject > theColorLut
ossimIpt theOutputTileSize
const char * find(const char *key) const
ossimString theCompressionType
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
ossimString thePhotoMetric
ossimFilename theLutFilename
bool toBool() const
String to numeric methods.
static const char * COMPRESSION_TYPE_KW
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
bool open(const ossimFilename &lutFile)
Reads in an external lut file.
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
virtual void setFilename(const ossimFilename &file)
long toLong() const
toLong&#39;s deprecated, please use the toInts...
ossim_int32 y
Definition: ossimIpt.h:142
static const char * COMPRESSION_QUALITY_KW
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
ossim_int32 x
Definition: ossimIpt.h:141
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Loads the state of the object by reading in the keywords listed in the save state.
static const char * FILENAME_KW

◆ open()

bool ossimTiffWriter::open ( )
virtual

Allows a generic interface to open a consumer for writing. If you are a display writer then you would probably show the window or init the device context for writing.

Implements ossimOutputSource.

Definition at line 1571 of file ossimTiffWriter.cpp.

References closeTiff(), openTiff(), and theTif.

1572 {
1573  if(theTif)
1574  {
1575  closeTiff();
1576  }
1577  return openTiff();
1578 }

◆ openTiff()

bool ossimTiffWriter::openTiff ( )
protected
Returns
true on success, false on error.

Definition at line 95 of file ossimTiffWriter.cpp.

References ossimString::c_str(), closeTiff(), ossimImageSourceSequencer::getBoundingRect(), ossimObject::getClassName(), ossimImageSource::getNumberOfOutputBands(), ossimImageSourceSequencer::getOutputScalarType(), ossimIrect::height(), ossimErrorCodes::OSSIM_ERROR, ossimSetError(), ossim::scalarSizeInBytes(), ossimErrorStatusInterface::setErrorStatus(), ossimString::size(), status, theBigTiffFlag, ossimImageFileWriter::theFilename, theForceBigTiffFlag, ossimImageFileWriter::theInputConnection, theTif, and ossimIrect::width().

Referenced by open().

96 {
97  static const char* MODULE = "ossimTiffWriter::openTiff()";
98 
99  bool status = false;
100 
101  // Close the existing file pointer.
102  closeTiff();
103 
104  // Check for empty file name.
105  if ( theFilename.size() )
106  {
107  //---
108  // On windows libtiff can treat class tiff offsets as signed(2GB limit) or
109  // unsigned(4GB) so if even close to 2GB (2.1.47 GB) limit make a big tiff.
110  //---
111  const ossim_uint64 BIGTIFF_THRESHOLD = 2000000000;
113  ossim_uint64 byteCheck =
114  (static_cast<ossim_uint64>(bounds.width())*
115  static_cast<ossim_uint64>(bounds.height())*
116  static_cast<ossim_uint64>(theInputConnection->getNumberOfOutputBands())*
117  static_cast<ossim_uint64>(ossim::scalarSizeInBytes(theInputConnection->getOutputScalarType())));
118 
119  if( byteCheck > BIGTIFF_THRESHOLD )
120  {
121  theBigTiffFlag = true;
122  }
123 
124  ossimString openMode = "w";
126  {
127  openMode += "8";
128  }
129 
130  // Open the new file.
131  theTif = XTIFFOpen( theFilename.c_str(), openMode.c_str() );
132  if ( theTif )
133  {
134  status = true;
135  }
136  else
137  {
138  setErrorStatus(); // base class
139  ossimSetError(getClassName().c_str(),
141  "File %s line %d Module %s Error:\n\
142 Error opening file: %s\n",
143 __FILE__,
144 __LINE__,
145 MODULE,
146 theFilename.c_str());
147  }
148  }
149  return status;
150 }
OSSIMDLLEXPORT void ossimSetError(const char *className, ossim_int32 error, const char *fmtString=0,...)
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
ossim_uint32 height() const
Definition: ossimIrect.h:487
static const ossimErrorCode OSSIM_ERROR
virtual ossimString getClassName() const
Definition: ossimObject.cpp:64
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
std::string::size_type size() const
Definition: ossimString.h:405
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
unsigned long long ossim_uint64
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
ossim_uint32 width() const
Definition: ossimIrect.h:500
return status
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

◆ saveState()

bool ossimTiffWriter::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

saves the state of the object.

Reimplemented from ossimImageFileWriter.

Definition at line 681 of file ossimTiffWriter.cpp.

References ossimKeywordlist::add(), and theOutputGeotiffTagsFlag.

683 {
684  kwl.add(prefix,
685  "output_geotiff_flag",
687  true);
688 
689  kwl.add(prefix,
690  TIFF_WRITER_OUTPUT_TILE_SIZE_X_KW,
692  true);
693 
694  kwl.add(prefix,
695  TIFF_WRITER_OUTPUT_TILE_SIZE_Y_KW,
697  true);
698 
699  kwl.add(prefix,
702  true);
703 
704  kwl.add(prefix,
707  true);
708 
709  kwl.add(prefix,
710  "color_lut_flag",
712  true);
713 
714  if(theColorLutFlag)
715  {
716  if(theLutFilename != "")
717  {
718  kwl.add(prefix,
719  "lut_filename",
721  true);
722  }
723  else
724  {
725  ossimString newPrefix = ossimString(prefix) + "lut.";
726  theColorLut->saveState(kwl, newPrefix.c_str());
727  }
728  }
729 
730 
732  prefix);
733 }
ossimRefPtr< ossimNBandLutDataObject > theColorLut
ossimIpt theOutputTileSize
ossimString theCompressionType
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
ossimFilename theLutFilename
ossim_int32 theJpegQuality
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static const char * COMPRESSION_TYPE_KW
unsigned int ossim_uint32
ossim_int32 y
Definition: ossimIpt.h:142
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
static const char * COMPRESSION_QUALITY_KW
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
ossim_int32 x
Definition: ossimIpt.h:141

◆ setCompressionType()

void ossimTiffWriter::setCompressionType ( const ossimString type)
virtual

compression type can be JPEG, PACKBITS, or ZIP/DEFLATE

Definition at line 1615 of file ossimTiffWriter.cpp.

References theCompressionType.

Referenced by setProperty().

1616 {
1617  theCompressionType = type;
1618 }
ossimString theCompressionType

◆ setGeotiffFlag()

void ossimTiffWriter::setGeotiffFlag ( bool  flag)
virtual

Definition at line 1630 of file ossimTiffWriter.cpp.

References theOutputGeotiffTagsFlag.

Referenced by writeRaster(), and ossimHlzTool::writeSlopeImage().

1631 {
1632  theOutputGeotiffTagsFlag = flag;
1633 }

◆ setJpegQuality()

void ossimTiffWriter::setJpegQuality ( ossim_int32  quality)
virtual

Ranges from 1 to 100 with 100 being the best.

This value is only used if the compression type is set to jpeg. (default = 75)

Parameters
qualityValue to set theJpegQuality to.
Note
If quality is out of range it will be set to DEFAULT_JPEG_QUALITY.

Definition at line 1585 of file ossimTiffWriter.cpp.

References theJpegQuality.

Referenced by setProperty().

1586 {
1587  // Range 1 to 100 with 100 being best.
1588  if (quality > 0 && quality < 101)
1589  {
1590  theJpegQuality = quality;
1591  }
1592  else
1593  {
1594  if (traceDebug())
1595  {
1597  << "ossimTiffWriter::setJpegQuality DEBUG:"
1598  << "\nquality out of range: " << quality
1599  << "\nquality has been set to default: "
1600  << DEFAULT_JPEG_QUALITY
1601  << "\nvalid range: 1 to 100 with 100 being best."
1602  << std::endl;
1603  }
1604 
1605  theJpegQuality = DEFAULT_JPEG_QUALITY;
1606  }
1607 }
ossim_int32 theJpegQuality
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ setLut()

void ossimTiffWriter::setLut ( const ossimNBandLutDataObject lut)

Definition at line 675 of file ossimTiffWriter.cpp.

References ossimNBandLutDataObject::dup(), theColorLut, and theColorLutFlag.

Referenced by checkColorLut().

676 {
677  theColorLutFlag = true;
679 }
ossimRefPtr< ossimNBandLutDataObject > theColorLut
class ossimNBandLutDataObject

◆ setProjectionInfo()

ossim_int32 ossimTiffWriter::setProjectionInfo ( const ossimMapProjectionInfo proj)
virtual

Definition at line 1640 of file ossimTiffWriter.cpp.

References ossimErrorCodes::OSSIM_OK, and theProjectionInfo.

1641 {
1643 
1645 }
static const ossimErrorCode OSSIM_OK
ossimRefPtr< ossimMapProjectionInfo > theProjectionInfo

◆ setProperty()

void ossimTiffWriter::setProperty ( ossimRefPtr< ossimProperty property)
virtual

Will set the property whose name matches the argument "property->getName()".

Parameters
propertyObject containing property to set.

Reimplemented from ossimImageFileWriter.

Definition at line 1420 of file ossimTiffWriter.cpp.

References ossimKeywordNames::COMPRESSION_QUALITY_KW, ossimKeywordNames::COMPRESSION_TYPE_KW, ossimRefPtr< T >::get(), ossimProperty::getName(), ossimNBandLutDataObject::open(), ossimKeywordNames::OUTPUT_TILE_SIZE_KW, PTR_CAST, setCompressionType(), setJpegQuality(), ossimImageFileWriter::setProperty(), theColorLut, theColorLutFlag, theForceBigTiffFlag, theLutFilename, theOutputTileSize, ossimProperty::valueToString(), ossimStringProperty::valueToString(), ossimIpt::x, and ossimIpt::y.

1421 {
1422  if(!property)
1423  {
1424  return;
1425  }
1426 
1428  {
1429  // ossimNumericProperty* numericProperty = PTR_CAST(ossimNumericProperty,
1430  // property.get());
1431  // if (numericProperty)
1432  // {
1433  setJpegQuality( property->valueToString().toInt32() );
1434  // }
1435  }
1436  else if (property->getName() == ossimKeywordNames::COMPRESSION_TYPE_KW)
1437  {
1439  property.get());
1440  if (stringProperty)
1441  {
1442  ossimString s;
1443  stringProperty->valueToString(s);
1444  setCompressionType(s);
1445  }
1446  }
1447  else if(property->getName() == "lut_file")
1448  {
1451  }
1452  else if(property->getName() == "color_lut_flag")
1453  {
1454  theColorLutFlag = property->valueToString().toBool();
1455  }
1456  else if(property->getName() == "big_tiff_flag")
1457  {
1458  theForceBigTiffFlag = property->valueToString().toBool();
1459  }
1460  else if(property->getName() == ossimKeywordNames::OUTPUT_TILE_SIZE_KW)
1461  {
1462  theOutputTileSize.x = property->valueToString().toInt32();
1464  }
1465  else
1466  {
1468  }
1469 }
virtual void valueToString(ossimString &valueResult) const =0
virtual void setJpegQuality(ossim_int32 quality)
Ranges from 1 to 100 with 100 being the best.
ossimRefPtr< ossimNBandLutDataObject > theColorLut
ossimIpt theOutputTileSize
static const char * OUTPUT_TILE_SIZE_KW
virtual void setCompressionType(const ossimString &type)
compression type can be JPEG, PACKBITS, or ZIP/DEFLATE
ossimFilename theLutFilename
static const char * COMPRESSION_TYPE_KW
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
bool open(const ossimFilename &lutFile)
Reads in an external lut file.
virtual void setProperty(ossimRefPtr< ossimProperty > property)
ossim_int32 y
Definition: ossimIpt.h:142
static const char * COMPRESSION_QUALITY_KW
ossim_int32 x
Definition: ossimIpt.h:141
const ossimString & getName() const
virtual void valueToString(ossimString &valueResult) const

◆ setTileSize()

void ossimTiffWriter::setTileSize ( const ossimIpt tileSize)
virtual

Sets the output image tiling size if supported by the writer.

If not supported this simply sets the sequencer(input) tile size.

Reimplemented from ossimImageFileWriter.

Definition at line 1337 of file ossimTiffWriter.cpp.

References ossimIpt::x, and ossimIpt::y.

1338 {
1339  if ( (tileSize.x % 16) || (tileSize.y % 16) )
1340  {
1341  if(traceDebug())
1342  {
1344  << "ossimTiffWriter::changeTileSize ERROR:"
1345  << "\nTile size must be a multiple of 32!"
1346  << "\nSize remains: " << theOutputTileSize
1347  << std::endl;
1348  }
1349  return;
1350  }
1351 
1352  theOutputTileSize = tileSize;
1353 }
ossimIpt theOutputTileSize
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ writeFile()

bool ossimTiffWriter::writeFile ( )
protectedvirtual

Write out the file.

Returns
true on success, false on error.

Implements ossimImageFileWriter.

Definition at line 464 of file ossimTiffWriter.cpp.

466 {
467  static const char MODULE[] = "ossimTiffWriter::writeFile";
468 
469  if (traceDebug()) CLOG << "Entered..." << std::endl;
470 
471  //checkColorLut();
472 
473  if(isLutEnabled())
474  {
482  }
483  else
484  {
486  }
487 
488  if (traceDebug() && theInputConnection.get())
489  {
491  << MODULE << "DEBUG:"
492  << "\nnull: " << theInputConnection->getNullPixelValue()
493  << "\nmin: " << theInputConnection->getMinPixelValue()
494  << "\nmax: " << theInputConnection->getMaxPixelValue()
495  << std::endl;
496  }
497 
498  if (isTiled())
499  {
500  if ( (theInputConnection->getTileWidth() !=
501  static_cast<ossim_uint32>(theOutputTileSize.x)) ||
503  static_cast<ossim_uint32>(theOutputTileSize.y)) )
504  {
506  }
507  }
508 
510  {
512 
514  {
517  }
518 
519  return true;
520  }
521 
522  open();
523 
524  if (!isOpen())
525  {
526  if (traceDebug())
527  {
528  CLOG << " ERROR: Could not open! Returning..." << std::endl;
529  }
530 
531  return false;
532  }
533 
534  if(!theInputConnection)
535  {
536  if (traceDebug())
537  {
538  CLOG << " ERROR: No input connection! Returning..." << std::endl;
539  }
540 
541  return false;
542  }
543 
544  // First write the tiff tags.
545  if (writeTiffTags() == false)
546  {
547  if(traceDebug())
548  {
550  << MODULE << " ERROR:"
551  << "\nError detected writing tiff tags. Returning..." << std::endl;
552  return false;
553  }
554  }
555 
556  // Write the geotiff tags.
558  {
559  if(theViewController.get()) // let this override
560  { // found in ossimImageWriter base
563  if(proj)
564  {
567  projectionInfo->setPixelType(thePixelType);
568 
569  if (writeGeotiffTags(projectionInfo) == false)
570  {
571  if(traceDebug())
572  {
574  << MODULE << " ERROR:"
575  << "\nError detected writing geotiff tags. Returning..."
576  << std::endl;
577  }
578  return false;
579  }
580  }
581  }
582  else if(theProjectionInfo.valid())
583  {
585  if (writeGeotiffTags(theProjectionInfo) == false)
586  {
587  if(traceDebug())
588  {
590  << MODULE << " ERROR:"
591  << "\nError detected writing geotiff tags. Returning..."
592  << std::endl;
593  }
594  return false;
595  }
596  }
597  else
598  {
599  // Fetch the map projection of the input image if it exists:
600  ossimMapProjection* mapProj = 0;
602  if ( imgGeom.valid() )
603  {
604  const ossimProjection* proj = imgGeom->getProjection();
605  mapProj = PTR_CAST(ossimMapProjection, proj);
606  }
607  if(mapProj)
608  {
611 
612  projectionInfo->setPixelType(thePixelType);
613  if (writeGeotiffTags(projectionInfo) == false)
614  {
615  if(traceDebug())
616  {
618  << MODULE << " ERROR:"
619  << "\nError detected writing geotiff tags. Returning..."
620  << std::endl;
621  }
622  return false;
623  }
624  }
625  }
626 
627  } // End of "if (theOutputGeotiffTagsFlag)"
628 
629  // Write the file with the image data.
630  bool status = false;
631  if(theOutputImageType == "tiff_strip")
632  {
633  status = writeToStrips();
634  }
635  else if(theOutputImageType == "tiff_strip_band_separate")
636  {
638  }
639  else if((theOutputImageType == "tiff_tiled")||
640  (ossimString::downcase(theOutputImageType) == "image/tiff")||
641  (ossimString::downcase(theOutputImageType) == "image/tif")||
642  (ossimString::downcase(theOutputImageType) == "image/gtif")||
643  (ossimString::downcase(theOutputImageType) == "image/gtiff"))
644  {
645  status = writeToTiles();
646  }
647  else if(theOutputImageType == "tiff_tiled_band_separate")
648  {
650  }
651  else
652  {
653  if(traceDebug())
654  {
656  << MODULE << " ERROR:"
657  << "\nUnsupported output type: " << theOutputImageType
658  << std::endl;
659  }
660  }
661 
662  close();
663 
664  if (traceDebug()) CLOG << " Exited..." << std::endl;
665 
667  {
670  }
671 
672  return status;
673 }
void setLut(ossimNBandLutDataObject &lut)
#define CLOG
Definition: ossimTrace.h:23
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
virtual ossimObject * getView()
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.
virtual void disconnect(ossimConnectableObject *object=0)
Will disconnect the object passed in.
bool writeTiffTags()
Writes tiff tags from ossimMapProjectionInfo to tiff file.
ossimRefPtr< ossimNBandLutDataObject > theColorLut
ossimIpt theOutputTileSize
ossimRefPtr< ossimNBandToIndexFilter > theNBandToIndexFilter
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimViewController > theViewController
ossimIrect theAreaOfInterest
bool writeToTiles()
Writes image data to a tiled tiff format.
void setPixelType(ossimPixelType type)
Sets the data member "thePixelType".
virtual bool open()
virtual bool isOpen() const
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
bool writeToStrips()
Writes image data to a strip tiff format.
ossimRefPtr< ossimMapProjectionInfo > theProjectionInfo
unsigned int ossim_uint32
bool writeToTilesBandSep()
Writes image data to a tiled tiff band separate format.
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
bool isTiled() const
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if not defined...
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
return status
ossimPixelType thePixelType
OSSIM_PIXEL_IS_POINT = 0, OSSIM_PIXEL_IS_AREA = 1.
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
bool writeGeotiffTags(ossimRefPtr< ossimMapProjectionInfo > projectionInfo)
Writes geotiff tags from ossimMapProjectionInfo to tiff file.
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
ossim_int32 y
Definition: ossimIpt.h:142
bool writeToStripsBandSep()
Writes image data to a strip tiff band separate format.
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
ossim_int32 x
Definition: ossimIpt.h:141
virtual void close()
virtual void setTileSize(const ossimIpt &tileSize)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossimString & downcase()
Downcases this string.
Definition: ossimString.cpp:81
bool isLutEnabled() const

◆ writeGeotiffTags()

bool ossimTiffWriter::writeGeotiffTags ( ossimRefPtr< ossimMapProjectionInfo projectionInfo)
protected

Writes geotiff tags from ossimMapProjectionInfo to tiff file.

Returns
true on success, false on error.

Definition at line 376 of file ossimTiffWriter.cpp.

References theTif, ossimRefPtr< T >::valid(), and ossimGeoTiff::writeTags().

377 {
378  TIFF* tiffPtr = (TIFF*)theTif;
379  bool result = false;
380  if ( tiffPtr )
381  {
382  if ( projectionInfo.valid() )
383  {
384  result = ossimGeoTiff::writeTags(tiffPtr, projectionInfo);
385  }
386  }
387  return result;
388 }
bool valid() const
Definition: ossimRefPtr.h:75
struct tiff TIFF
static bool writeTags(TIFF *tiffOut, const ossimRefPtr< ossimMapProjectionInfo > projectionInfo, bool imagineNad27Flag=false)

◆ writeMinMaxTags()

void ossimTiffWriter::writeMinMaxTags ( const vector< ossim_float64 > &  minBand,
const vector< ossim_float64 > &  maxBand 
)
protected

Definition at line 1355 of file ossimTiffWriter.cpp.

References theTif.

Referenced by writeTiffTags().

1357 {
1358  TIFF* tiffPtr = (TIFF*)theTif;
1359  if(minBand.size() && maxBand.size())
1360  {
1361  ossim_float64 minValue =
1362  *std::min_element(minBand.begin(), minBand.end());
1363  ossim_float64 maxValue =
1364  *std::max_element(maxBand.begin(), maxBand.end());
1365 
1366  if (traceDebug())
1367  {
1369  << "ossimTiffWriter::writeMinMaxTags DEBUG:"
1370  << "\nminValue: " << minValue
1371  << "\nmaxValue: " << maxValue
1372  << std::endl;
1373  }
1374 
1376  {
1377  case OSSIM_USHORT11:
1378  case OSSIM_USHORT12:
1379  case OSSIM_USHORT13:
1380  case OSSIM_USHORT14:
1381  case OSSIM_USHORT15:
1382  {
1383  TIFFSetField( tiffPtr, TIFFTAG_MINSAMPLEVALUE,
1384  static_cast<ossim_sint16>(0) );
1385  TIFFSetField( tiffPtr, TIFFTAG_MAXSAMPLEVALUE,
1386  static_cast<ossim_sint16>(2047) );
1387  break;
1388  }
1389  case OSSIM_UINT8:
1390  case OSSIM_UINT16:
1391  {
1392  TIFFSetField( tiffPtr, TIFFTAG_MINSAMPLEVALUE,
1393  static_cast<ossim_sint16>(minValue) );
1394  TIFFSetField( tiffPtr, TIFFTAG_MAXSAMPLEVALUE,
1395  static_cast<ossim_sint16>(maxValue) );
1396  break;
1397  }
1398 
1399  case OSSIM_SINT16:
1400  case OSSIM_UINT32:
1401  case OSSIM_FLOAT32:
1402  case OSSIM_FLOAT64:
1405  {
1406  TIFFSetField( tiffPtr, TIFFTAG_SMINSAMPLEVALUE,
1407  static_cast<ossim_float32>(minValue) );
1408  TIFFSetField( tiffPtr, TIFFTAG_SMAXSAMPLEVALUE,
1409  static_cast<ossim_float32>(maxValue) );
1410  break;
1411  }
1412  default:
1413  {
1414  break;
1415  }
1416  }
1417  }
1418 }
16 bit unsigned integer (15 bits used)
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
double ossim_float64
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
32 bit normalized floating point
struct tiff TIFF
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)

◆ writeTiffTags()

bool ossimTiffWriter::writeTiffTags ( )
protected

Writes tiff tags from ossimMapProjectionInfo to tiff file.

Returns
true on success, false on error.

Definition at line 162 of file ossimTiffWriter.cpp.

References ossim::COMPRESSION_NONE, ossimString::downcase(), ossimObject::getClassName(), ossimImageSourceSequencer::getMaxPixelValue(), ossimImageSourceSequencer::getMinPixelValue(), ossimNBandLutDataObject::getNumberOfEntries(), ossimImageSource::getNumberOfOutputBands(), ossimImageSourceSequencer::getOutputScalarType(), ossimIpt::hasNans(), ossimIrect::height(), isTiled(), ossimErrorCodes::OSSIM_ERROR, OSSIM_FLOAT32, OSSIM_FLOAT64, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SINT16, OSSIM_UCHAR, OSSIM_UINT16, OSSIM_UINT8, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, OSSIM_USHORT15, ossimSetError(), ossimErrorStatusInterface::setErrorStatus(), ossimImageWriter::theAreaOfInterest, theColorLut, theColorLutFlag, theCompressionType, ossimImageFileWriter::theInputConnection, theJpegQuality, ossimImageFileWriter::theOutputImageType, theOutputTileSize, thePhotoMetric, theTif, ossimIrect::width(), writeMinMaxTags(), ossimIpt::x, and ossimIpt::y.

163 {
164  static const char MODULE[] = "ossimTiffWriter::writeTiffTags";
165  TIFF* tiffPtr = (TIFF*)theTif;
166  if (!tiffPtr)
167  {
168  setErrorStatus(); // base class
169  ossimSetError(getClassName().c_str(),
171  "File %s line %d %s\nError: Tiff pointer is null!\n\
172 Call setFilename method.\n",
173 __FILE__,
174 __LINE__,
175 MODULE);
176  return false;
177  }
178 
179  //---
180  // NOTE:
181  // Since the tiff library uses the variable argument list function "va_arg"
182  // it is important to use the correct data type. If in doubt see the
183  // code for libtiff's _TIFFVSetField in "tif_dir.c" in the libtiff package.
184  //---
185 
186  int bitsPerSample = 0;
187  int sampleFormat = 0;
189  {
190  case OSSIM_UINT8:
191  bitsPerSample = 8;
192  sampleFormat = SAMPLEFORMAT_UINT;
193  break;
194 
195  case OSSIM_UINT16:
196  case OSSIM_USHORT11:
197  case OSSIM_USHORT12:
198  case OSSIM_USHORT13:
199  case OSSIM_USHORT14:
200  case OSSIM_USHORT15:
201  bitsPerSample = 16;
202  sampleFormat = SAMPLEFORMAT_UINT;
203  break;
204 
205  case OSSIM_SINT16:
206  bitsPerSample = 16;
207  sampleFormat = SAMPLEFORMAT_INT;
208  break;
209 
210  case OSSIM_FLOAT32:
212  bitsPerSample = 32;
213  sampleFormat = SAMPLEFORMAT_IEEEFP;
214  break;
215 
217  case OSSIM_FLOAT64:
218  bitsPerSample = 64;
219  sampleFormat = SAMPLEFORMAT_IEEEFP;
220  break;
221 
222  default:
223  return false;
224  }
225 
226  // Set the pixel type.
227  TIFFSetField( (TIFF*)tiffPtr, TIFFTAG_BITSPERSAMPLE, bitsPerSample );
228  TIFFSetField( (TIFF*)tiffPtr, TIFFTAG_SAMPLEFORMAT, sampleFormat );
229 
230  // Set the image dimensions.
233  TIFFSetField( tiffPtr, TIFFTAG_IMAGEWIDTH, width);
234  TIFFSetField( tiffPtr, TIFFTAG_IMAGELENGTH, height);
235  if (isTiled())
236  {
237  ossim_uint32 tileXSize = theOutputTileSize.x;
238  ossim_uint32 tileYSize = theOutputTileSize.y;
239  TIFFSetField(tiffPtr, TIFFTAG_TILEWIDTH, tileXSize);
240  TIFFSetField(tiffPtr, TIFFTAG_TILELENGTH, tileYSize);
241  }
242  else
243  {
244  // GP: Shouldn't this be theOutputTileSize.y ?
245  //TIFFSetField(tiffPtr, TIFFTAG_ROWSPERSTRIP, ossim_uint32(1));
247  {
248  TIFFSetField(tiffPtr, TIFFTAG_ROWSPERSTRIP, ossim_uint32(1));
249  }
250  else
251  {
252  TIFFSetField(tiffPtr, TIFFTAG_ROWSPERSTRIP, ossim_uint32(theOutputTileSize.y));
253  }
254  }
255 
257 
258  // Set the min/max values.
259  std::vector<ossim_float64> minBand(numberOfBands);
260  std::vector<ossim_float64> maxBand(numberOfBands);
261  for(ossim_uint32 idx = 0; idx < numberOfBands; ++idx)
262  {
263  maxBand[idx] = theInputConnection->getMaxPixelValue(idx);
264  minBand[idx] = theInputConnection->getMinPixelValue(idx);
265  }
266 
267  writeMinMaxTags(minBand, maxBand);
268 
269  // Set the planar configuration.
270  if ( (theOutputImageType == "tiff_strip") ||
271  (theOutputImageType == "tiff_tiled") ||
272  (theOutputImageType == "image/tiff") ||
273  (theOutputImageType == "image/tif") ||
274  (theOutputImageType == "image/gtif") ||
275  (theOutputImageType == "image/gtiff") )
276  {
277  TIFFSetField( tiffPtr, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
278  }
279  else
280  {
281  TIFFSetField( tiffPtr, TIFFTAG_PLANARCONFIG, PLANARCONFIG_SEPARATE);
282  }
283 
284  // Set the compression type:
285  uint16 tiffCompressType = COMPRESSION_NONE;
287  if( theCompressionType == "jpeg")
288  {
289  tiffCompressType = COMPRESSION_JPEG;
290  // Set the jpeg quality.
291  // note the compression type must be set before the quality or you will get an error
292  TIFFSetField( tiffPtr, TIFFTAG_COMPRESSION, tiffCompressType);
293  TIFFSetField( tiffPtr, TIFFTAG_JPEGQUALITY, theJpegQuality);
294  }
295  else if( theCompressionType == "lzw")
296  {
297  tiffCompressType = COMPRESSION_LZW;
298  TIFFSetField( tiffPtr, TIFFTAG_COMPRESSION, tiffCompressType);
299  }
300  else if(theCompressionType == "packbits")
301  {
302  tiffCompressType = COMPRESSION_PACKBITS;
303  TIFFSetField( tiffPtr, TIFFTAG_COMPRESSION, tiffCompressType);
304  }
305  else if((theCompressionType == "deflate") ||
306  (theCompressionType == "zip"))
307  {
308  tiffCompressType = COMPRESSION_DEFLATE;
309  TIFFSetField( tiffPtr, TIFFTAG_COMPRESSION, tiffCompressType);
310  }
311  TIFFSetField(tiffPtr, TIFFTAG_SAMPLESPERPIXEL, (int)theInputConnection->getNumberOfOutputBands());
312 
314  bool lutEnabled = (theColorLutFlag&&
315  ((scalarType == OSSIM_UINT8)||
316  (scalarType == OSSIM_UINT16)||
317  (scalarType == OSSIM_USHORT11)||
318  (scalarType == OSSIM_USHORT12)||
319  (scalarType == OSSIM_USHORT13)||
320  (scalarType == OSSIM_USHORT14)||
321  (scalarType == OSSIM_USHORT15))&&
324  if(lutEnabled)
325  {
326  TIFFSetField( tiffPtr, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE );
327  TIFFSetField( tiffPtr, TIFFTAG_INDEXED, (ossim_uint16)1);
328 
329  if(scalarType == OSSIM_UINT8)
330  {
331  ossim_uint16 r[256], g[256], b[256];
332 
333  memset(r, '\0', sizeof(ossim_uint16)*256);
334  memset(g, '\0', sizeof(ossim_uint16)*256);
335  memset(b, '\0', sizeof(ossim_uint16)*256);
336 
337  for(ossim_uint32 i = 0; i < theColorLut->getNumberOfEntries(); i++)
338  {
339  r[i] = (ossim_uint16) (((*theColorLut)[i][0]/255.0)*65535);
340  g[i] = (ossim_uint16) (((*theColorLut)[i][1]/255.0)*65535);
341  b[i] = (ossim_uint16) (((*theColorLut)[i][2]/255.0)*65535);
342  }
343  TIFFSetField(tiffPtr, TIFFTAG_COLORMAP, r, g ,b);
344  }
345  else
346  {
347  ossim_uint16 r[65536], g[65536], b[65536];
348  memset(r, '\0', sizeof(ossim_uint16)*65536);
349  memset(g, '\0', sizeof(ossim_uint16)*65536);
350  memset(b, '\0', sizeof(ossim_uint16)*65536);
351 
352  for(ossim_uint32 i = 0; i < theColorLut->getNumberOfEntries(); i++)
353  {
354  r[i] = (ossim_uint16) ((*theColorLut)[i][0]);
355  g[i] = (ossim_uint16) ((*theColorLut)[i][1]);
356  b[i] = (ossim_uint16) ((*theColorLut)[i][2]);
357  }
358  TIFFSetField(tiffPtr, TIFFTAG_COLORMAP, r, g ,b);
359  }
360  }
361  else if( (theInputConnection->getNumberOfOutputBands() == 3 ||
363  (thePhotoMetric == "rgb"))&&
364  (scalarType == OSSIM_UCHAR))
365  {
366  TIFFSetField( tiffPtr, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB );
367  }
368  else
369  {
370  TIFFSetField( tiffPtr, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK );
371  }
372 
373  return true;
374 }
OSSIMDLLEXPORT void ossimSetError(const char *className, ossim_int32 error, const char *fmtString=0,...)
16 bit unsigned integer (15 bits used)
64 bit floating point
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
16 bit unsigned integer
ossimRefPtr< ossimNBandLutDataObject > theColorLut
ossimIpt theOutputTileSize
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
ossimString theCompressionType
ossim_uint32 height() const
Definition: ossimIrect.h:487
ossimIrect theAreaOfInterest
16 bit signed integer
ossimString thePhotoMetric
16 bit unsigned integer (14 bits used)
static const ossimErrorCode OSSIM_ERROR
virtual ossimString getClassName() const
Definition: ossimObject.cpp:64
16 bit unsigned integer (13 bits used)
32 bit floating point
unsigned short ossim_uint16
ossim_int32 theJpegQuality
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
ossim_uint32 getNumberOfEntries() const
unsigned int ossim_uint32
32 bit normalized floating point
bool isTiled() const
struct tiff TIFF
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
ossim_uint32 width() const
Definition: ossimIrect.h:500
ossimScalarType
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
ossim_int32 y
Definition: ossimIpt.h:142
void writeMinMaxTags(const vector< ossim_float64 > &minBand, const vector< ossim_float64 > &maxBand)
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
ossim_int32 x
Definition: ossimIpt.h:141
8 bit unsigned integer
bool hasNans() const
Definition: ossimIpt.h:58
8 bit unsigned iteger
16 bit unsigned integer (12 bits used)

◆ writeToStrips()

bool ossimTiffWriter::writeToStrips ( )
protected

Writes image data to a strip tiff format.

Returns
true on success, false on error.

Definition at line 1102 of file ossimTiffWriter.cpp.

References theTif.

1103 {
1104  static const char* const MODULE = "ossimTiffWriter::writeToStrips";
1105  TIFF* tiffPtr = (TIFF*)theTif;
1106 
1107  if (traceDebug()) CLOG << " Entered." << std::endl;
1108 
1109  // Start the sequence at the first tile.
1111 
1118  ossim_uint32 bytesInLine =
1120  width * bands;
1121 
1122  //---
1123  // Buffer to hold one line x tileHeight
1124  //---
1125  ossim_uint32 bufferSizeInBytes = bytesInLine * tileHeight;
1126  unsigned char* buffer = new unsigned char[bufferSizeInBytes];
1127 
1128  int tileNumber = 0;
1129  vector<ossim_float64> minBands;
1130  vector<ossim_float64> maxBands;
1131  for(ossim_uint32 i = 0; ((i < tilesHigh)&&(!needsAborting())); ++i)
1132  {
1133  // Clear the buffer.
1134  memset(buffer, 0, bufferSizeInBytes);
1135 
1136  // Set the buffer rectangle.
1137  ossimIrect bufferRect(theAreaOfInterest.ul().x,
1138  theAreaOfInterest.ul().y + i * tileHeight,
1139  theAreaOfInterest.ul().x + width - 1,
1140  theAreaOfInterest.ul().y + i * tileHeight +
1141  tileHeight - 1);
1142 
1143  // Tile loop in the sample (width) direction.
1144  for(ossim_uint32 j = 0; ((j < tilesWide)&&(!needsAborting())); ++j)
1145  {
1146  // Get the tile and copy it to the buffer.
1148  if (!id)
1149  {
1151  << MODULE << " ERROR:"
1152  << "Error returned writing tiff tile: " << tileNumber
1153  << "\nNULL Tile encountered"
1154  << std::endl;
1155  delete [] buffer;
1156  return false;
1157  }
1158  id->unloadTile(buffer, bufferRect, OSSIM_BIP);
1160  {
1161  id->computeMinMaxPix(minBands, maxBands);
1162  }
1163  ++tileNumber;
1164  }
1165 
1166  // Get the number of lines to write from the buffer.
1167  ossim_uint32 linesToWrite = min(tileHeight, static_cast<ossim_uint32>(theAreaOfInterest.lr().y - bufferRect.ul().y + 1));
1168 
1169  // Write the buffer out to disk.
1170  ossim_uint32 row = static_cast<ossim_uint32>(bufferRect.ul().y -
1171  theAreaOfInterest.ul().y);
1172  ossim_uint8* buf = buffer;
1173  for (ossim_uint32 ii=0; ((ii<linesToWrite)&&(!needsAborting())); ++ii)
1174  {
1175  ossim_int32 status = TIFFWriteScanline(tiffPtr,
1176  buf,
1177  row,
1178  0);
1179  if (status == -1)
1180  {
1182  << MODULE << " ERROR:"
1183  << "Error returned writing tiff scanline: " << row
1184  << std::endl;
1185  setErrorStatus();
1186  delete [] buffer;
1187  return false;
1188  }
1189 
1190  ++row; // Increment the line number.
1191  buf += bytesInLine;
1192 
1193  } // End of loop to write lines from buffer to tiff file.
1194 
1195  double tile = tileNumber;
1196  double numTiles = numberOfTiles;
1197  setPercentComplete(tile / numTiles * 100);
1198  if(needsAborting())
1199  {
1200  setPercentComplete(100);
1201  }
1202 
1203  } // End of loop in the line (height) direction.
1204 
1205  if(!theColorLutFlag)
1206  {
1207  writeMinMaxTags(minBands, maxBands);
1208  }
1209 
1210  // Free the memory.
1211  delete [] buffer;
1212 
1213  if (traceDebug()) CLOG << " Exited." << std::endl;
1214 
1215  return true;
1216 }
#define CLOG
Definition: ossimTrace.h:23
ossim_uint32 tileNumber
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual ossimRefPtr< ossimImageData > getNextTile(ossim_uint32 resLevel=0)
ossimIrect theAreaOfInterest
const ossimIpt & ul() const
Definition: ossimIrect.h:274
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
unsigned int ossim_uint32
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
struct tiff TIFF
const ossimIpt & lr() const
Definition: ossimIrect.h:276
ossim_uint32 width() const
Definition: ossimIrect.h:500
return status
ossim_int64 getNumberOfTilesHorizontal() const
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
ossim_int32 y
Definition: ossimIpt.h:142
void writeMinMaxTags(const vector< ossim_float64 > &minBand, const vector< ossim_float64 > &maxBand)
ossim_int32 x
Definition: ossimIpt.h:141
virtual void setPercentComplete(double percentComplete)
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_int64 getNumberOfTilesVertical() const
#define min(a, b)
Definition: auxiliary.h:75
int ossim_int32

◆ writeToStripsBandSep()

bool ossimTiffWriter::writeToStripsBandSep ( )
protected

Writes image data to a strip tiff band separate format.

Returns
true on success, false on error.

Definition at line 1218 of file ossimTiffWriter.cpp.

References theTif.

1219 {
1220  static const char* const MODULE = "ossimTiffWriter::writeToStripsBandSep";
1221  TIFF* tiffPtr = (TIFF*)theTif;
1222 
1223  if (traceDebug()) CLOG << " Entered." << std::endl;
1224 
1225  // Start the sequence at the first tile.
1227 
1234  ossim_uint32 bytesInLine =
1236  width;
1237 
1238  //---
1239  // Buffer to hold one line x tileHeight
1240  //---
1241  ossim_uint32 bufferSizeInBytes = bytesInLine * tileHeight * bands;
1242 
1243  unsigned char* buffer = new unsigned char[bufferSizeInBytes];
1244 
1245  // Tile loop in height direction.
1247  vector<ossim_float64> minBands;
1248  vector<ossim_float64> maxBands;
1249  for(ossim_uint32 i = 0; ((i < tilesHigh)&&(!needsAborting())); ++i)
1250  {
1251  // Clear the buffer.
1252  memset(buffer, 0, bufferSizeInBytes);
1253 
1254  // Set the buffer rectangle.
1255  ossimIrect bufferRect(theAreaOfInterest.ul().x,
1256  theAreaOfInterest.ul().y + i * tileHeight,
1257  theAreaOfInterest.ul().x + width - 1,
1258  theAreaOfInterest.ul().y + i * tileHeight +
1259  tileHeight - 1);
1260 
1261  // Tile loop in the sample (width) direction.
1262  for(ossim_uint32 j = 0; ((j < tilesWide)&&(!needsAborting())); ++j)
1263  {
1264  // Get the tile and copy it to the buffer.
1266  if (!id)
1267  {
1269  << MODULE << " ERROR:"
1270  << "Error returned writing tiff tile: " << tileNumber
1271  << "\nNULL Tile encountered"
1272  << std::endl;
1273  delete [] buffer;
1274  return false;
1275  }
1276  id->unloadTile(buffer, bufferRect, OSSIM_BIL);
1277  if(!theColorLutFlag)
1278  {
1279  id->computeMinMaxPix(minBands, maxBands);
1280  }
1281  ++tileNumber;
1282  }
1283 
1284  // Get the number of lines to write from the buffer.
1285  ossim_uint32 linesToWrite = min(tileHeight, static_cast<ossim_uint32>(theAreaOfInterest.lr().y - bufferRect.ul().y + 1));
1286 
1287  // Write the buffer out to disk.
1288  ossim_uint32 row = static_cast<ossim_uint32>(bufferRect.ul().y -
1289  theAreaOfInterest.ul().y);
1290  ossim_uint8* buf = buffer;
1291  for (ossim_uint32 ii=0; ((ii<linesToWrite)&&(!needsAborting())); ++ii)
1292  {
1293  for (ossim_uint32 band =0; ((band<bands)&&(!needsAborting())); ++band)
1294  {
1295  ossim_int32 status = TIFFWriteScanline(tiffPtr,
1296  buf,
1297  row,
1298  band);
1299  if (status == -1)
1300  {
1302  << MODULE << " ERROR:"
1303  << "Error returned writing tiff scanline: " << row
1304  << std::endl;
1305  delete [] buffer;
1306  return false;
1307  }
1308  buf += bytesInLine;
1309  }
1310 
1311  ++row; // Increment the line number.
1312 
1313  } // End of loop to write lines from buffer to tiff file.
1314 
1315  double tile = tileNumber;
1316  double numTiles = numberOfTiles;
1317  setPercentComplete(tile / numTiles * 100);
1318  if(needsAborting())
1319  {
1320  setPercentComplete(100);
1321  }
1322  } // End of loop in the line (height) direction.
1323 
1324  if(!theColorLutFlag)
1325  {
1326  writeMinMaxTags(minBands, maxBands);
1327  }
1328 
1329  // Free the memory.
1330  delete [] buffer;
1331 
1332  if (traceDebug()) CLOG << " Exited." << std::endl;
1333 
1334  return true;
1335 }
#define CLOG
Definition: ossimTrace.h:23
ossim_uint32 tileNumber
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual ossimRefPtr< ossimImageData > getNextTile(ossim_uint32 resLevel=0)
ossimIrect theAreaOfInterest
const ossimIpt & ul() const
Definition: ossimIrect.h:274
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
unsigned int ossim_uint32
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
struct tiff TIFF
const ossimIpt & lr() const
Definition: ossimIrect.h:276
ossim_uint32 width() const
Definition: ossimIrect.h:500
return status
ossim_int64 getNumberOfTilesHorizontal() const
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
ossim_int32 y
Definition: ossimIpt.h:142
void writeMinMaxTags(const vector< ossim_float64 > &minBand, const vector< ossim_float64 > &maxBand)
ossim_int32 x
Definition: ossimIpt.h:141
virtual void setPercentComplete(double percentComplete)
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_int64 getNumberOfTilesVertical() const
#define min(a, b)
Definition: auxiliary.h:75
int ossim_int32

◆ writeToTiles()

bool ossimTiffWriter::writeToTiles ( )
protected

Writes image data to a tiled tiff format.

Returns
true on success, false on error.

Definition at line 857 of file ossimTiffWriter.cpp.

References theTif.

858 {
859  static const char* const MODULE = "ossimTiffWriter::writeToTiles";
860  TIFF* tiffPtr = (TIFF*)theTif;
861 
862  if (traceDebug()) CLOG << " Entered." << std::endl;
863 
864  // Start the sequence at the first tile.
866 
867  ossimRefPtr<ossimImageData> tempTile = 0;
868 
869  if(theColorLutFlag)
870  {
872  }
873  else
874  {
876  }
877  if(tempTile.valid())
878  {
879  tempTile->initialize();
880  }
886 
887  // Tile loop in the height direction.
889  vector<ossim_float64> minBands;
890  vector<ossim_float64> maxBands;
891  for(ossim_uint32 i = 0; ((i < tilesHigh)&&!needsAborting()); i++)
892  {
893  ossimIpt origin(0,0);
894  origin.y = i * tileHeight;
895 
896  // Tile loop in the sample (width) direction.
897  for(ossim_uint32 j = 0; ((j < tilesWide)&&!needsAborting()); j++)
898  {
899  origin.x = j * tileWidth;
900 
901  // Grab the tile.
903  if (!id)
904  {
906  << MODULE << " ERROR:"
907  << "Error returned writing tiff tile: " << tileNumber
908  << "\nNULL Tile encountered"
909  << std::endl;
910  return false;
911  }
912 
913  ossimDataObjectStatus tileStatus = id->getDataObjectStatus();
914  ossim_uint32 tileSizeInBytes = id->getSizeInBytes();
915  if (tileStatus != OSSIM_FULL)
916  {
917  // Clear out the buffer since it won't be filled all the way.
918  tempTile->setImageRectangle(id->getImageRectangle());
919  tempTile->makeBlank();
920  }
921 
922  if ((tileStatus == OSSIM_PARTIAL || tileStatus == OSSIM_FULL))
923  {
924  // Stuff the tile into the tileBuffer.
925  id->unloadTile(tempTile->getBuf(),
926  id->getImageRectangle(),
927  OSSIM_BIP);
928  tempTile->setDataObjectStatus(id->getDataObjectStatus());
930  {
931  id->computeMinMaxPix(minBands, maxBands);
932  }
933  }
934 
935  //---
936  // Write the tile to disk.
937  //---
938  ossim_uint32 bytesWritten = 0;
939  bytesWritten = TIFFWriteTile(tiffPtr,
940  tempTile->getBuf(),
941  origin.x,
942  origin.y,
943  0, // z
944  0); // s
945 
946  if (bytesWritten != tileSizeInBytes)
947  {
948  if(traceDebug())
949  {
951  << MODULE << " ERROR:"
952  << "Error returned writing tiff tile: " << i
953  << "\nExpected bytes written: " << tileSizeInBytes
954  << "\nBytes written: " << bytesWritten
955  << std::endl;
956  }
957  setErrorStatus();
958  return false;
959  }
960 
961  ++tileNumber;
962 
963  } // End of tile loop in the sample (width) direction.
964 
965  double tile = tileNumber;
966  double numTiles = numberOfTiles;
967  setPercentComplete(tile / numTiles * 100);
968 
969  } // End of tile loop in the line (height) direction.
970 
972  {
973  writeMinMaxTags(minBands, maxBands);
974  }
975 
976  if (traceDebug()) CLOG << " Exited." << std::endl;
977 
978  return true;
979 }
#define CLOG
Definition: ossimTrace.h:23
virtual void setImageRectangle(const ossimIrect &rect)
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.
ossim_uint32 tileNumber
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimRefPtr< ossimImageData > getNextTile(ossim_uint32 resLevel=0)
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual void initialize()
Initialize the data buffer.
static ossimImageDataFactory * instance()
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
unsigned int ossim_uint32
virtual ossimIrect getImageRectangle() const
struct tiff TIFF
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
virtual void makeBlank()
Initializes data to null pixel values.
ossim_int64 getNumberOfTilesHorizontal() const
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
virtual const void * getBuf() const
void writeMinMaxTags(const vector< ossim_float64 > &minBand, const vector< ossim_float64 > &maxBand)
virtual void setDataObjectStatus(ossimDataObjectStatus status) const
Full list found in ossimConstants.h.
ossimDataObjectStatus
Definitions for data object status.
virtual void setPercentComplete(double percentComplete)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_int64 getNumberOfTilesVertical() const

◆ writeToTilesBandSep()

bool ossimTiffWriter::writeToTilesBandSep ( )
protected

Writes image data to a tiled tiff band separate format.

Returns
true on success, false on error.

Definition at line 981 of file ossimTiffWriter.cpp.

References theTif.

982 {
983  static const char* const MODULE = "ossimTiffWriter::writeToTilesBandSep";
984  TIFF* tiffPtr = (TIFF*)theTif;
985  if (traceDebug()) CLOG << " Entered." << std::endl;
986 
987  // Start the sequence at the first tile.
989 
996 
997 #if 0
998  if(traceDebug())
999  {
1000  ossimIrect boundingRect = theInputConnection->getBoundingRect();
1002  << "Bounding rect = " << boundingRect
1003  << "\nBands = " << bands
1004  << "\ntilesWide = " << tilesWide
1005  << "\ntilesHigh = " << tilesHigh
1006  << "\ntileWidth = " << tileWidth
1007  << "\ntileHeight = " << tileHeight << std::endl;
1008  }
1009 #endif
1010 
1012  vector<ossim_float64> minBands;
1013  vector<ossim_float64> maxBands;
1014  for(ossim_uint32 i = 0; ((i < tilesHigh)&&!needsAborting()); ++i)
1015  {
1016  ossimIpt origin;
1017  origin.y = i * tileHeight;
1018 
1019  //---
1020  // Tile loop in the sample (width) direction.
1021  //---
1022  for(ossim_uint32 j = 0; ((j < tilesWide)&&!needsAborting()); ++j)
1023  {
1024  origin.x = j * tileWidth;
1025 
1027  if(!id)
1028  {
1030  << MODULE << " ERROR:"
1031  << "Error returned writing tiff tile: " << i
1032  << "\nNULL Tile encountered"
1033  << std::endl;
1034  return false;
1035  }
1036  ossim_int32 tileSizeInBytes = id->getSizePerBandInBytes();
1037 
1038  if(!theColorLutFlag)
1039  {
1040  id->computeMinMaxPix(minBands, maxBands);
1041  }
1042 
1043  //---
1044  // Band loop.
1045  //---
1046  for (ossim_uint32 band=0; ((band<bands)&&(!needsAborting())); ++band)
1047  {
1048  // Grab a pointer to the tile for the band.
1049  tdata_t* data = (tdata_t*)id->getBuf(band);
1050  // Write the tile.
1051  tsize_t bytesWritten = 0;
1052  if(data)
1053  {
1054  bytesWritten = TIFFWriteTile(tiffPtr,
1055  data,
1056  (ossim_uint32)origin.x,
1057  (ossim_uint32)origin.y,
1058  (ossim_uint32)0, // z
1059  (tsample_t)band); // sample
1060  }
1061  if ( ( bytesWritten != tileSizeInBytes ) && !needsAborting() )
1062  {
1063  if(traceDebug())
1064  {
1066  << MODULE << " ERROR:"
1067  << "Error returned writing tiff tile: " << i
1068  << "\nExpected bytes written: " << tileSizeInBytes
1069  << "\nBytes written: " << bytesWritten
1070  << std::endl;
1071  }
1072  setErrorStatus();
1073  return false;
1074  }
1075 
1076  } // End of band loop.
1077 
1078  ++tileNumber;
1079 
1080  } // End of tile loop in the sample (width) direction.
1081 
1082  double tile = tileNumber;
1083  double numTiles = numberOfTiles;
1084  setPercentComplete(tile / numTiles * 100);
1085  if(needsAborting())
1086  {
1087  setPercentComplete(100);
1088  }
1089 
1090  } // End of tile loop in the line (height) direction.
1091 
1093  {
1094  writeMinMaxTags(minBands, maxBands);
1095  }
1096 
1097  if (traceDebug()) CLOG << " Exited." << std::endl;
1098 
1099  return true;
1100 }
#define CLOG
Definition: ossimTrace.h:23
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.
ossim_uint32 tileNumber
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual ossimRefPtr< ossimImageData > getNextTile(ossim_uint32 resLevel=0)
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
unsigned int ossim_uint32
struct tiff TIFF
ossim_int64 getNumberOfTilesHorizontal() const
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
void writeMinMaxTags(const vector< ossim_float64 > &minBand, const vector< ossim_float64 > &maxBand)
ossim_int32 x
Definition: ossimIpt.h:141
virtual void setPercentComplete(double percentComplete)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_int64 getNumberOfTilesVertical() const
int ossim_int32

Member Data Documentation

◆ theBigTiffFlag

bool ossimTiffWriter::theBigTiffFlag
protected

Definition at line 228 of file ossimTiffWriter.h.

Referenced by openTiff().

◆ theColorLut

ossimRefPtr<ossimNBandLutDataObject> ossimTiffWriter::theColorLut
protected

Definition at line 225 of file ossimTiffWriter.h.

Referenced by setLut(), setProperty(), and writeTiffTags().

◆ theColorLutFlag

bool ossimTiffWriter::theColorLutFlag
protected

Definition at line 222 of file ossimTiffWriter.h.

Referenced by getProperty(), isLutEnabled(), setLut(), setProperty(), and writeTiffTags().

◆ theCompressionType

ossimString ossimTiffWriter::theCompressionType
protected

Definition at line 218 of file ossimTiffWriter.h.

Referenced by getCompressionType(), setCompressionType(), and writeTiffTags().

◆ theForceBigTiffFlag

bool ossimTiffWriter::theForceBigTiffFlag
protected

Definition at line 227 of file ossimTiffWriter.h.

Referenced by getProperty(), openTiff(), and setProperty().

◆ theJpegQuality

ossim_int32 ossimTiffWriter::theJpegQuality
protected

Definition at line 220 of file ossimTiffWriter.h.

Referenced by getJpegQuality(), getProperty(), setJpegQuality(), and writeTiffTags().

◆ theLutFilename

ossimFilename ossimTiffWriter::theLutFilename
protected

Definition at line 226 of file ossimTiffWriter.h.

Referenced by getProperty(), and setProperty().

◆ theNBandToIndexFilter

ossimRefPtr<ossimNBandToIndexFilter> ossimTiffWriter::theNBandToIndexFilter
mutableprotected

Definition at line 229 of file ossimTiffWriter.h.

◆ theOutputGeotiffTagsFlag

bool ossimTiffWriter::theOutputGeotiffTagsFlag
protected

Definition at line 221 of file ossimTiffWriter.h.

Referenced by getGeotiffFlag(), saveState(), and setGeotiffFlag().

◆ theOutputTileSize

ossimIpt ossimTiffWriter::theOutputTileSize
protected

Definition at line 224 of file ossimTiffWriter.h.

Referenced by getOutputTileSize(), getProperty(), setProperty(), and writeTiffTags().

◆ thePhotoMetric

ossimString ossimTiffWriter::thePhotoMetric
protected

Definition at line 219 of file ossimTiffWriter.h.

Referenced by writeTiffTags().

◆ theProjectionInfo

ossimRefPtr<ossimMapProjectionInfo> ossimTiffWriter::theProjectionInfo
protected

Definition at line 223 of file ossimTiffWriter.h.

Referenced by setProjectionInfo().

◆ theTif

void* ossimTiffWriter::theTif
protected

The documentation for this class was generated from the following files: