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

#include <ossimSubImageTool.h>

Inheritance diagram for ossimSubImageTool:
ossimChipProcTool ossimTool ossimProcessInterface ossimListenerManager ossimObject ossim::JsonInterface ossimReferenced

Public Types

enum  RpcGeomFormat { OGEOM, DG, JSON, XML }
 
- 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

 ossimSubImageTool ()
 
 ~ossimSubImageTool ()
 
virtual void setUsage (ossimArgumentParser &ap)
 Initializes the aurgument parser with expected parameters and options. More...
 
virtual bool initialize (ossimArgumentParser &ap)
 Initializes from command line arguments. More...
 
virtual void initialize (const ossimKeywordlist &kwl)
 Reads processing params from KWL and prepares for execute. More...
 
virtual bool execute ()
 Writes product to output file if applicable. More...
 
virtual ossimString getClassName () const
 
- Public Member Functions inherited from ossimChipProcTool
 ossimChipProcTool ()
 default constructor More...
 
virtual ~ossimChipProcTool ()
 virtual destructor More...
 
virtual void clear ()
 Disconnects and clears the dem and image layers. More...
 
virtual void abort ()
 
virtual bool isChipProcessor () const
 Overrides base class implementation to indicate this class supports getChip() calls. More...
 
virtual ossimListenerManagergetManager ()
 
virtual ossimObjectgetObject ()
 
virtual const ossimObjectgetObject () const
 
virtual ossimRefPtr< ossimImageDatagetChip (const ossimIrect &img_rect)
 The meat and potatos of this class. More...
 
virtual ossimRefPtr< ossimImageDatagetChip (const ossimGrect &gnd_rect)
 
ossimRefPtr< ossimImageDatagetChip (const ossimDrect &map_bounding_rect, const ossimDpt &gsd)
 
ossimRefPtr< ossimImageDatagetChip ()
 Get chip method that assumes pre-initialized state. More...
 
const ossimFilenamegetProductFilename () const
 
- Public Member Functions inherited from ossimTool
 ossimTool ()
 
virtual ~ossimTool ()
 
virtual void loadJSON (const Json::Value &json_request)
 Reads processing params from JSON object provided. More...
 
virtual void saveJSON (Json::Value &json) const
 Fetch product as JSON object when applicable Always returns true since using exception on error. More...
 
virtual const std::string & getResponse () const
 Fetch product as string (typically JSON) when applicable, otherwise passes back empty string. More...
 
virtual void getKwlTemplate (ossimKeywordlist &kwl)
 Assigns a template keywordlist to string for initializing derived classes. More...
 
void getAPI (std::string &out) const
 Outputs a JSON representation of the Utility's API. More...
 
std::string getAPI () const
 
void getBuildDate (std::string &s) const
 Gets build date. More...
 
void getRevision (std::string &s) const
 Gets revision. More...
 
void getVersion (std::string &s) const
 Gets version. More...
 
void setOutputStream (std::ostream *os)
 Redirects any console output to the supplied stream for logging or JNI application. More...
 
bool helpRequested () const
 Returns true when the initialization detects a "--help" option, so caller can avoid subsequent execute() call. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () 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 saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
virtual void accept (ossimVisitor &visitor)
 
- 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 ossim::JsonInterface
 JsonInterface ()
 
virtual ~JsonInterface ()
 
- Public Member Functions inherited from ossimProcessInterface
 ossimProcessInterface ()
 
virtual ~ossimProcessInterface ()
 
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 void setPercentComplete (double percentComplete)
 
void enableEvents ()
 
void disableEvents ()
 
void setCurrentMessage (const ossimString &message)
 
virtual std::ostream & print (std::ostream &out) const
 
- Public Member Functions inherited from ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool addListener (ossimListener *listener)
 
virtual bool removeListener (ossimListener *listener)
 
virtual bool findListener (ossimListener *listener)
 

Static Public Attributes

static const char * DESCRIPTION
 Used by ossimUtilityFactory. More...
 

Protected Member Functions

virtual void initProcessingChain ()
 Derived classes initialize their custom chains here. More...
 
- Protected Member Functions inherited from ossimChipProcTool
void processRemainingArgs (ossimArgumentParser &ap)
 Intended to be called after derived class has picked off its own options from the parser, and arguments remain (such as input and output filenames). More...
 
virtual void finalizeChain ()
 Called after initProcessingChain() to append common items to the processing chain. More...
 
virtual void loadImageFiles ()
 Creates chains for image entries associated with specified keyword. More...
 
virtual void loadDemFiles ()
 Loads all DEM files specified in master KWL into the elev manager's database. More...
 
ossimRefPtr< ossimSingleImageChaincreateInputChain (const ossimFilename &image_file, ossim_uint32 entry_index=0)
 Creates the ossimSingleImageChain from image filename and populates the chain with resampler and product output projection on view-side of resampler's IVT. More...
 
void createOutputProjection ()
 Creates the output or view projection. More...
 
ossimRefPtr< ossimMapProjectionnewIdentityProjection ()
 Sets the single image chain for identity operations view to a ossimImageViewAffineTransform. More...
 
ossimRefPtr< ossimMapProjectionnewUtmProjection ()
 Convenience method to get a utm projection. More...
 
virtual void initializeProjectionGsd ()
 Initializes the projection gsd. More...
 
virtual void initializeAOI ()
 Initializes m_aoiViewRect with the output area of interest as specified in master KWL. More...
 
bool getProjectionOrigin (ossimGpt &gpt)
 Reads the KWL for origin latitude and central meridian. More...
 
ossimRefPtr< ossimImageFileWriternewWriter ()
 Creates a new writer. More...
 
void propagateGeometryToChains ()
 Loops through all chains and sets the output projection. More...
 
ossimRefPtr< ossimImageSourcecombineLayers (std::vector< ossimRefPtr< ossimSingleImageChain > > &layers) const
 When multiple input sources are present, this method instantiates a combiner and adds inputs. More...
 
void computeAdjustedViewFromGrect ()
 Initializes m_aoiViewRect given m_aoiGroundRect. More...
 
void setAoiToInputs ()
 Assigns the AOI to be the bounding rect of the union of all inputs. More...
 
void getBandList (ossim_uint32 image_idx, std::vector< ossim_uint32 > &bandList) const
 Gets the band list if BANDS keyword is set. More...
 
void setReaderProps (ossimImageHandler *ih) const
 Passes reader properties to single image handler if any. More...
 
 ossimChipProcTool (const ossimChipProcTool &obj)
 Hidden from use copy constructor. More...
 
const ossimChipProcTooloperator= (const ossimChipProcTool &)
 Hidden from use assignment operator. More...
 
ossimRefPtr< ossimGeoPolygoncreateClipPolygon () const
 
void findCenterGpt (ossimGpt &gpt)
 Tries to determine the AOI center point based on KWL entries, else returns NaNs in gpt. More...
 
ossimRefPtr< ossimImageSourcemosaicDemSources ()
 Some utilities need to work on DEMs as images. More...
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimListenerManager
 ossimListenerManager (const ossimListenerManager &rhs)
 

Protected Attributes

RpcGeomFormat m_geomFormat
 
- Protected Attributes inherited from ossimChipProcTool
ossimRefPtr< ossimImageGeometrym_geom
 
ossimIrect m_aoiViewRect
 
ossimGrect m_aoiGroundRect
 
std::vector< ossimRefPtr< ossimSingleImageChain > > m_imgLayers
 
std::vector< ossimFilenamem_demSources
 
ossimRefPtr< ossimImageFileWriterm_writer
 
ossimRefPtr< ossimImageChainm_procChain
 
ossimRefPtr< ossimRectangleCutFilterm_cutRectFilter
 
bool m_projIsIdentity
 
ossimDpt m_gsd
 
bool m_geoScaled
 
ossimFilename m_productFilename
 
ossimScalarType m_productScalarType
 
bool m_needCutRect
 
- Protected Attributes inherited from ossimTool
ossimKeywordlist m_kwl
 
std::ostream * m_consoleStream
 
bool m_helpRequested
 
std::string m_response
 
- Protected Attributes inherited from ossimProcessInterface
double thePercentComplete
 
ossimProcessStatus theProcessStatus
 
ossimString theMessage
 
bool theEventFlag
 
- Protected Attributes inherited from ossimListenerManager
std::list< ossimListener * > theListenerList
 
bool theEnabledFlag
 
std::list< ossimListener * > theDelayedAdd
 
std::list< ossimListener * > theDelayedRemove
 
bool theFireEventFlag
 

Detailed Description

Tool class for extracting a subimage rectangle from a full image. The original sensor model is replaced with the subimage RPC representation. This is necessary as OSSIM does not support sub-image offset in the sensor models yet.

Definition at line 22 of file ossimSubImageTool.h.

Member Enumeration Documentation

◆ RpcGeomFormat

Constructor & Destructor Documentation

◆ ossimSubImageTool()

ossimSubImageTool::ossimSubImageTool ( )

Definition at line 28 of file ossimSubImageTool.cpp.

◆ ~ossimSubImageTool()

ossimSubImageTool::~ossimSubImageTool ( )

Definition at line 33 of file ossimSubImageTool.cpp.

34 {
35 }

Member Function Documentation

◆ execute()

bool ossimSubImageTool::execute ( )
virtual

Writes product to output file if applicable.

The product may also beAlways returns true since using exception on error.

Note
Throws ossimException on error.

Reimplemented from ossimChipProcTool.

Definition at line 192 of file ossimSubImageTool.cpp.

References DG, ossimChipProcTool::execute(), ossimXmlDocument::fromKwl(), ossimRefPtr< T >::get(), ossimImageChain::getImageGeometry(), ossimImageGeometry::getProjection(), ossimRpcSolver::getRpcModel(), JSON, ossimChipProcTool::m_aoiViewRect, ossimChipProcTool::m_geom, m_geomFormat, ossimChipProcTool::m_procChain, ossimChipProcTool::m_productFilename, OGEOM, ossimNotify(), ossimNotifyLevel_FATAL, ossimNotifyLevel_INFO, ossimImageGeometry::saveState(), ossimFilename::setExtension(), ossimRpcModel::setImageOffset(), ossimImageGeometry::setImageSize(), ossimIrect::size(), ossimRpcSolver::solve(), ossimString::string(), ossimRpcModel::toJSON(), ossimRpcModel::toRPB(), ossimIrect::ul(), ossimXmlDocument::write(), ossimKeywordlist::write(), and XML.

193 {
194  // Compute RPC representation of subimage:
196  if (!inputGeom || !inputGeom->getProjection())
197  {
198  ostringstream errMsg;
199  errMsg << " ERROR: ossimSubImageTool ["<<__LINE__<<"] Null projection returned for input "
200  "image!" << endl;
201  throw ossimException( errMsg.str() );
202  }
203 
204  ossimRefPtr<ossimProjection> inputProj = inputGeom->getProjection();
206  ossimRefPtr<ossimRpcSolver> solver = new ossimRpcSolver(false);
207  bool converged = false;
208 
209  // If the input projection itself is an RPC, just copy it. No solving required:
210  ossimRpcModel* inputRpc = dynamic_cast<ossimRpcModel*>(inputGeom->getProjection());
211  if (inputRpc)
212  rpc = inputRpc;
213  else
214  {
215  converged = solver->solve(m_aoiViewRect, inputGeom.get());
216  rpc = solver->getRpcModel();
217  }
218 
219  // The RPC needs to be shifted in image space so that it will work in the subimage coordinates:
221  m_geom = new ossimImageGeometry(nullptr, rpc.get());
223  ossimKeywordlist kwl;
224  m_geom->saveState(kwl);
225 
226  bool success = ossimChipProcTool::execute();
227  if (!success)
228  return false;
229 
230  // Need to save the subimage RPC data:
231  bool write_ok = false;
232  ossimFilename geomFile (m_productFilename);
233  if (m_geomFormat == OGEOM) // Default case if none specified
234  {
235  geomFile.setExtension("geom");
236  write_ok = kwl.write(geomFile);
237  }
238  else if (m_geomFormat == JSON)
239  {
240 #if OSSIM_HAS_JSONCPP
241  geomFile.setExtension("json");
242  ofstream jsonStream (geomFile.string());
243  if (!jsonStream.fail())
244  {
245  // Note that only the model/projection is saved here, not the full ossimImageGeometry that
246  // contains the subimage shift transform. So need to cheat and add the shift to the RPC
247  // line and sample offsets:
248  write_ok = rpc->toJSON(jsonStream);
249  jsonStream.close();
250  }
251 #else
252  ostringstream errMsg;
253  errMsg << " ERROR: ossimSubImageTool ["<<__LINE__<<"] JSON geometry output requested but JSON is not "
254  "available in this build! <" << endl;
255  throw ossimException( errMsg.str() );
256 #endif
257  }
258  else if (m_geomFormat == DG)
259  {
260  geomFile.setExtension("RPB");
261  ofstream rpbStream (geomFile.string());
262  if (!rpbStream.fail())
263  {
264  write_ok = rpc->toRPB(rpbStream);
265  rpbStream.close();
266  }
267  }
268  else if (m_geomFormat == XML)
269  {
270  geomFile.setExtension("xml");
271  ossimXmlDocument xmlDocument;
272  xmlDocument.fromKwl(kwl);
273  write_ok = xmlDocument.write(geomFile);
274  }
275 
276  if (write_ok)
277  ossimNotify(ossimNotifyLevel_INFO) << "Wrote geometry file to <"<<geomFile<<">.\n" << endl;
278  else
279  {
280  ossimNotify(ossimNotifyLevel_FATAL) << "Error encountered writing output RPC geometry file."
281  << std::endl;
282  return false;
283  }
284 
285  return true;
286 }
ossimRefPtr< ossimImageGeometry > m_geom
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
Represents serializable keyword/value map.
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if not defined...
bool write(const ossimFilename &file)
const ossimIpt & ul() const
Definition: ossimIrect.h:274
RpcGeomFormat m_geomFormat
void setImageSize(const ossimIpt &size)
virtual bool write(const char *file, const char *comment=0) const
Methods to dump the ossimKeywordlist to a file on disk.
ossimIpt size() const
Definition: ossimIrect.h:510
const ossimRefPtr< ossimRpcModel > getRpcModel() const
Fetches the solved-for RPC model.
ossimRefPtr< ossimImageChain > m_procChain
bool solve(const ossimDrect &aoiBounds, ossimImageGeometry *geom, const double &pixel_tolerance=0.5)
Similar to the other solve methods except that the final grid size is established iteratively so that...
ossimFilename m_productFilename
void fromKwl(const ossimKeywordlist &kwl)
void setImageOffset(const ossimDpt &offset_to_chip_ul)
Allows setting an offset to a subimage while using the coefficients of a full-image model...
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
bool toJSON(std::ostream &json) const
Serializes RPC to JSON format.
This currently only support Rational poilynomial B format.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Saves the transform (if any) and projection (if any) states to the KWL.
std::basic_ofstream< char > ofstream
Class for char output file streams.
Definition: ossimIosFwd.h:47
virtual bool execute()
Performs the actual product write.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
bool toRPB(std::ostream &out) const
Serialize to WorldView-style .RPB file to the stream provided.

◆ getClassName()

virtual ossimString ossimSubImageTool::getClassName ( ) const
inlinevirtual

Reimplemented from ossimTool.

Definition at line 57 of file ossimSubImageTool.h.

57 { return "ossimSubImageTool"; }

◆ initialize() [1/2]

bool ossimSubImageTool::initialize ( ossimArgumentParser ap)
virtual

Initializes from command line arguments.

Returns
FALSE if –help option requested or no params provided, so that derived classes can
Note
Throws ossimException on error.

Reimplemented from ossimChipProcTool.

Definition at line 65 of file ossimSubImageTool.cpp.

References ossimKeywordlist::addPair(), BBOX_KW, DG, ossimKeywordNames::ENTRY_KW, ossimTool::initialize(), JSON, m_geomFormat, ossimTool::m_helpRequested, ossimTool::m_kwl, OGEOM, ossimChipProcTool::processRemainingArgs(), ossimArgumentParser::read(), ossimString::upcase(), and XML.

66 {
67  if (!ossimTool::initialize(ap))
68  return false;
69  if (m_helpRequested)
70  return true;
71 
72  string tempString1;
73  ossimArgumentParser::ossimParameter stringParam1(tempString1);
74  string tempString2;
75  ossimArgumentParser::ossimParameter stringParam2(tempString2);
76  string tempString3;
77  ossimArgumentParser::ossimParameter stringParam3(tempString3);
78  string tempString4;
79  ossimArgumentParser::ossimParameter stringParam4(tempString4);
80  double tempDouble1;
81  ossimArgumentParser::ossimParameter doubleParam1(tempDouble1);
82  double tempDouble2;
83  ossimArgumentParser::ossimParameter doubleParam2(tempDouble2);
84  vector<ossimString> paramList;
85 
86  ossim_uint32 readerPropIdx = 0;
87  ossim_uint32 writerPropIdx = 0;
88  ostringstream keys;
89 
90  if ( ap.read("--bbox", stringParam1, stringParam2, stringParam3, stringParam4))
91  {
92  ostringstream ostr;
93  ostr<<tempString1<<" "<<tempString2<<" "<<tempString3<<" "<<tempString4<<ends;
94  m_kwl.addPair( string(BBOX_KW), ostr.str() );
95  }
96  if ( ap.read("-e", stringParam1) || ap.read("--entry", stringParam1) )
97  m_kwl.addPair( string(ossimKeywordNames::ENTRY_KW), tempString1 );
98 
99  if ( ap.read("--geom", stringParam1))
100  {
101  ossimString formatStr (tempString1);
102  formatStr.upcase();
103  if (formatStr == "OGEOM")
105  else if (formatStr == "DG")
106  m_geomFormat = DG;
107  else if (formatStr == "JSON")
108  m_geomFormat = JSON;
109  else if (formatStr == "XML")
110  m_geomFormat = XML;
111  else
112  {
113  ostringstream errMsg;
114  errMsg << " ERROR: ossimSubImageTool ["<<__LINE__<<"] Unknown geometry format <"
115  <<formatStr<<"> specified. Aborting." << endl;
116  throw ossimException( errMsg.str() );
117  }
118  }
120 
121  return true;
122 }
const char * BBOX_KW
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
bool m_helpRequested
Definition: ossimTool.h:150
bool read(const std::string &str)
search for an occurance of a string in the argument list, on sucess remove that occurance from the li...
ossimKeywordlist m_kwl
Definition: ossimTool.h:148
void addPair(const std::string &key, const std::string &value, bool overwrite=true)
RpcGeomFormat m_geomFormat
unsigned int ossim_uint32
void processRemainingArgs(ossimArgumentParser &ap)
Intended to be called after derived class has picked off its own options from the parser...
virtual bool initialize(ossimArgumentParser &ap)
Initializes from command line arguments.
Definition: ossimTool.cpp:58
static const char * ENTRY_KW

◆ initialize() [2/2]

void ossimSubImageTool::initialize ( const ossimKeywordlist kwl)
virtual

Reads processing params from KWL and prepares for execute.

Returns TRUE if successful.

Note
Throws ossimException on error.

Reimplemented from ossimChipProcTool.

Definition at line 124 of file ossimSubImageTool.cpp.

References ossimImageChain::add(), BBOX_KW, ossimKeywordNames::ENTRY_KW, ossimChipProcTool::finalizeChain(), ossimKeywordlist::find(), ossimKeywordlist::findKey(), ossimRefPtr< T >::get(), ossimKeywordNames::IMAGE_FILE_KW, ossimImageHandlerRegistry::instance(), ossimChipProcTool::m_aoiViewRect, ossimTool::m_kwl, ossimChipProcTool::m_needCutRect, ossimChipProcTool::m_procChain, ossimChipProcTool::m_productFilename, ossimImageHandlerRegistry::open(), ossimKeywordNames::OUTPUT_FILE_KW, ossimIrect::set_lr(), ossimIrect::set_ul(), ossimImageHandler::setCurrentEntry(), ossimString::split(), ossimString::toUInt32(), and ossimString::trim().

125 {
127 
128  // Init chain with handler:
129  ostringstream key;
131  ossimFilename fname = m_kwl.findKey(key.str());
133  ossimImageHandlerRegistry::instance()->open(fname, true, false);
134  if (!handler)
135  {
136  ostringstream errMsg;
137  errMsg<<"ERROR: ossimSubImageTool ["<<__LINE__<<"] Could not open <"<<fname<<">"<<ends;
138  throw ossimException(errMsg.str());
139  }
140 
141  // Look for the entry keyand set it:
142  ossim_uint32 entryIndex = 0;
144  if (os)
145  entryIndex = os.toUInt32();
146  if (!handler->setCurrentEntry( entryIndex ))
147  {
148  ostringstream errMsg;
149  errMsg << " ERROR: ossimSubImageTool ["<<__LINE__<<"] Entry " << entryIndex << " out of range!" << endl;
150  throw ossimException( errMsg.str() );
151  }
152  m_procChain->add(handler.get());
153 
154  // And finally the bounding rect:
155  ossimString lookup = m_kwl.find(BBOX_KW);
156  lookup.trim();
157  vector<ossimString> substrings = lookup.split(", ", true);
158  if (substrings.size() != 4)
159  {
160  ostringstream errMsg;
161  errMsg << "ossimSubImageTool ["<<__LINE__<<"] Incorrect number of values specified for bbox!";
162  throw( ossimException(errMsg.str()) );
163  }
164 
165  int ulx = substrings[0].toInt32();
166  int uly = substrings[1].toInt32();
167  int lrx = substrings[2].toInt32();
168  int lry = substrings[3].toInt32();
169 
170  // Check for swap:
171  if ( ulx > lrx )
172  {
173  int tmpF = ulx;
174  ulx = lrx;
175  lrx = tmpF;
176  }
177  if ( uly > lry )
178  {
179  int tmpF = uly;
180  uly = lry;
181  lry = tmpF;
182  }
183 
184  // Use of view rect here is same as image space since there is no renderer:
185  m_aoiViewRect.set_ul(ossimIpt(ulx, uly));
186  m_aoiViewRect.set_lr(ossimIpt(lrx, lry));
187  m_needCutRect = true;
188 
189  finalizeChain();
190 }
const char * BBOX_KW
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
static const char * OUTPUT_FILE_KW
virtual ossimImageHandler * open(const ossimFilename &fileName, bool trySuffixFirst=true, bool openOverview=true) const
open that takes a filename.
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
const char * find(const char *key) const
ossimKeywordlist m_kwl
Definition: ossimTool.h:148
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
ossim_uint32 toUInt32() const
ossimRefPtr< ossimImageChain > m_procChain
void set_ul(const ossimIpt &pt)
Definition: ossimIrect.h:589
ossimFilename m_productFilename
virtual void finalizeChain()
Called after initProcessingChain() to append common items to the processing chain.
unsigned int ossim_uint32
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
virtual bool add(ossimConnectableObject *source)
Will return true or false if an image source was added to the chain.
static const char * ENTRY_KW
void set_lr(const ossimIpt &pt)
Definition: ossimIrect.h:623
static ossimImageHandlerRegistry * instance()
static const char * IMAGE_FILE_KW
virtual bool setCurrentEntry(ossim_uint32 entryIdx)

◆ initProcessingChain()

virtual void ossimSubImageTool::initProcessingChain ( )
inlineprotectedvirtual

Derived classes initialize their custom chains here.

Implements ossimChipProcTool.

Definition at line 63 of file ossimSubImageTool.h.

63 {}

◆ setUsage()

void ossimSubImageTool::setUsage ( ossimArgumentParser ap)
virtual

Initializes the aurgument parser with expected parameters and options.

It does not output anything. To see the usage, the caller will need to do something like:

ap.getApplicationUsage()->write(<ostream>);

Reimplemented from ossimChipProcTool.

Definition at line 37 of file ossimSubImageTool.cpp.

References ossimApplicationUsage::addCommandLineOption(), DESCRIPTION, ossimArgumentParser::getApplicationName(), ossimArgumentParser::getApplicationUsage(), ossimApplicationUsage::setCommandLineUsage(), ossimApplicationUsage::setDescription(), and ossimTool::setUsage().

38 {
39  // Add options.
41  ossimString usageString = ap.getApplicationName();
42  usageString += " subimage [options] <input-image> <output-image>";
43  au->setCommandLineUsage(usageString);
44 
45  // Set the command line options:
47 
48  // Base class has its own. Skip the ossimChipProcTool usage as that adds a lot of view-space
49  // specific stuff not used in this tool:
51 
53  "--bbox <ulx> <uly> <lrx> <lry>",
54  "Specify upper-left and lower-right bounds the image rect (in pixels).");
56  "-e | --entry <N> ",
57  "For multi image entries which entry do you wish to extract. For list "
58  "of entries use: \"ossim-info -i <your_image>\" ");
60  "--geom <format>", "Specifies format of the subimage RPC geometry file."
61  " Possible values are: \"OGEOM\" (OSSIM geometry, default), \"DG\" (DigitalGlobe WV/QB "
62  ".RPB format), \"JSON\" (MSP-style JSON), or \"XML\". Case insensitive.");
63 }
std::string getApplicationName() const
return the application name, as specified by argv[0]
void addCommandLineOption(const ossimString &option, const ossimString &explanation)
void setCommandLineUsage(const ossimString &explanation)
ossimApplicationUsage * getApplicationUsage()
virtual void setUsage(ossimArgumentParser &ap)
Initializes the aurgument parser with expected parameters and options.
Definition: ossimTool.cpp:41
static const char * DESCRIPTION
Used by ossimUtilityFactory.
void setDescription(const ossimString &desc)

Member Data Documentation

◆ DESCRIPTION

const char * ossimSubImageTool::DESCRIPTION
static
Initial value:
= "Tool for extracting a sub-image from a full image."
" No reprojection is done. Presently, the subimage geometry is represented by an RPC "
"replacement model until generic models can support subimage chipping."

Used by ossimUtilityFactory.

Definition at line 60 of file ossimSubImageTool.h.

Referenced by ossimToolFactory::getCapabilities(), and setUsage().

◆ m_geomFormat

RpcGeomFormat ossimSubImageTool::m_geomFormat
protected

Definition at line 65 of file ossimSubImageTool.h.

Referenced by execute(), and initialize().


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