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

Class representing an Image as used by ossim-msp services. More...

#include <Image.h>

Inheritance diagram for ossim::Image:
ossim::JsonInterface

Public Member Functions

 Image (const std::string &imageId, const std::string &filename, const std::string &modelName="", unsigned int entryIndex=0, unsigned int band=1)
 
 Image (const Json::Value &image_json_node)
 
 ~Image ()
 
std::string getImageId () const
 
std::string getFilename () const
 
std::string getModelName () const
 
unsigned int getEntryIndex () const
 
unsigned int getActiveBand () const
 
void setImageId (const std::string &id)
 
void setFilename (const std::string &f)
 
void setEntryIndex (unsigned int i)
 
virtual void getAvailableModels (std::vector< pair< std::string, std::string > > &availableModels) const
 Returns all available sensor model plugins and model names for this image: More...
 
virtual void loadJSON (const Json::Value &json)
 Refer to 3DISA API document for JSON format used. More...
 
virtual void saveJSON (Json::Value &json) const
 Refer to 3DISA API document for JSON format used. More...
 
- Public Member Functions inherited from ossim::JsonInterface
 JsonInterface ()
 
virtual ~JsonInterface ()
 

Static Public Attributes

static unsigned int UNASSIGNED_PHOTOBLOCK_INDEX
 

Protected Attributes

std::string m_imageId
 
ossimFilename m_filename
 
unsigned int m_entryIndex
 
unsigned int m_activeBand
 
std::string m_modelName
 
std::vector< pair< std::string, std::string > > m_availableModel
 
ossimRefPtr< ossimSensorModelm_sensorModel
 

Detailed Description

Class representing an Image as used by ossim-msp services.

Definition at line 27 of file Image.h.

Constructor & Destructor Documentation

◆ Image() [1/2]

ossim::Image::Image ( const std::string &  imageId,
const std::string &  filename,
const std::string &  modelName = "",
unsigned int  entryIndex = 0,
unsigned int  band = 1 
)

Definition at line 18 of file Image.cpp.

23 : m_imageId (imageId),
24  m_filename (filename),
25  m_entryIndex (entryIndex),
26  m_activeBand (band),
27  m_modelName (modelName)
28 {
29 
30 }
ossimFilename m_filename
Definition: Image.h:73
std::string m_imageId
Definition: Image.h:72
unsigned int m_activeBand
Definition: Image.h:75
unsigned int m_entryIndex
Definition: Image.h:74
std::string m_modelName
Definition: Image.h:76

◆ Image() [2/2]

ossim::Image::Image ( const Json::Value &  image_json_node)

Definition at line 32 of file Image.cpp.

References loadJSON().

33 : m_entryIndex (0),
34  m_activeBand (1)
35 {
36  loadJSON(json_node);
37 }
virtual void loadJSON(const Json::Value &json)
Refer to 3DISA API document for JSON format used.
Definition: Image.cpp:55
unsigned int m_activeBand
Definition: Image.h:75
unsigned int m_entryIndex
Definition: Image.h:74

◆ ~Image()

ossim::Image::~Image ( )

Definition at line 39 of file Image.cpp.

40 {
41  //m_handler.reset();
42 }

Member Function Documentation

◆ getActiveBand()

unsigned int ossim::Image::getActiveBand ( ) const
inline

Definition at line 47 of file Image.h.

47 { return m_activeBand; }
unsigned int m_activeBand
Definition: Image.h:75

◆ getAvailableModels()

void ossim::Image::getAvailableModels ( std::vector< pair< std::string, std::string > > &  availableModels) const
virtual

Returns all available sensor model plugins and model names for this image:

Parameters
availableModelsList of <plugin-name, model-name> pairs.

Definition at line 44 of file Image.cpp.

References ossimObject::getLongName(), ossimProjectionFactoryRegistry::instance(), m_entryIndex, m_filename, and ossimString::string().

45 {
47  createProjection(m_filename, m_entryIndex);
48  if (proj)
49  {
50  availableModels.push_back(pair<string, string>("OSSIM", proj->getLongName().string()));
51  delete proj;
52  }
53 }
ossimFilename m_filename
Definition: Image.h:73
unsigned int m_entryIndex
Definition: Image.h:74
virtual ossimString getLongName() const
Definition: ossimObject.cpp:53
static ossimProjectionFactoryRegistry * instance()
const std::string & string() const
Definition: ossimString.h:414

◆ getEntryIndex()

unsigned int ossim::Image::getEntryIndex ( ) const
inline

Definition at line 46 of file Image.h.

46 { return m_entryIndex; }
unsigned int m_entryIndex
Definition: Image.h:74

◆ getFilename()

std::string ossim::Image::getFilename ( ) const
inline

Definition at line 44 of file Image.h.

44 { return m_filename; }
ossimFilename m_filename
Definition: Image.h:73

◆ getImageId()

std::string ossim::Image::getImageId ( ) const
inline

Definition at line 43 of file Image.h.

43 { return m_imageId; }
std::string m_imageId
Definition: Image.h:72

◆ getModelName()

std::string ossim::Image::getModelName ( ) const
inline

Definition at line 45 of file Image.h.

45 { return m_modelName; }
std::string m_modelName
Definition: Image.h:76

◆ loadJSON()

void ossim::Image::loadJSON ( const Json::Value &  json)
virtual

Refer to 3DISA API document for JSON format used.

Implements ossim::JsonInterface.

Definition at line 55 of file Image.cpp.

References ossimProjectionFactoryRegistry::createProjection(), ossimFilename::expand(), ossimProjectionFactoryRegistry::instance(), m_activeBand, m_entryIndex, m_filename, m_imageId, m_modelName, m_sensorModel, and ossimKeywordlist::parseString().

Referenced by Image().

56 {
57  ostringstream xmsg;
58  xmsg<<__FILE__<<": loadJSON(JSON) -- ";
59 
60  // Parse JSON. Filename is required:
61  if (json_node.isMember("filename"))
62  {
63  ossimFilename imageFile = json_node["filename"].asString();
64  m_filename = imageFile.expand(); // allow embedded environment variables
65  }
66  else
67  {
68  xmsg<<"JSON node missing required field: \"filename\".";
69  throw ossimException(xmsg.str());
70  }
71 
72  // Entry index defaults to 0 if not present:
73  if (json_node["entryIndex"].isUInt())
74  m_entryIndex = json_node["entryIndex"].asUInt();
75 
76  // Band defaults to 1 if not present:
77  if (json_node["band"].isUInt())
78  m_activeBand = json_node["band"].asUInt();
79 
80  // Sensor model defaults to most accurate available if not provided (indicated by blank name):
81  if (json_node.isMember("sensorModel"))
82  m_modelName = json_node["sensorModel"].asString();
83 
84  // Sensor model defaults to most accurate available if not provided (indicated by blank name):
85  if (json_node.isMember("imageId"))
86  m_imageId = json_node["imageId"].asString();
87 
88  // Establish the sensor model. This also sets the official image ID, which will be overwritten
89  // if JSON field provided
90  string modelState = json_node["modelState"].asString();
91  ossimKeywordlist kwl;
92  kwl.parseString(modelState);
94  m_sensorModel = dynamic_cast<ossimSensorModel*>(proj);
95 }
ossimFilename m_filename
Definition: Image.h:73
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
Represents serializable keyword/value map.
ossimFilename expand() const
Method to do file name expansion.
std::string m_imageId
Definition: Image.h:72
ossimRefPtr< ossimSensorModel > m_sensorModel
Definition: Image.h:78
unsigned int m_activeBand
Definition: Image.h:75
unsigned int m_entryIndex
Definition: Image.h:74
ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
virtual bool parseString(const std::string &inString)
static ossimProjectionFactoryRegistry * instance()
std::string m_modelName
Definition: Image.h:76

◆ saveJSON()

void ossim::Image::saveJSON ( Json::Value &  json) const
virtual

Refer to 3DISA API document for JSON format used.

Implements ossim::JsonInterface.

Definition at line 97 of file Image.cpp.

References m_entryIndex, m_filename, m_imageId, m_modelName, m_sensorModel, ossimSensorModel::saveState(), ossimString::string(), ossimKeywordlist::toString(), and ossimRefPtr< T >::valid().

98 {
99  json_node.clear();
100  json_node["imageId"] = m_imageId;
101  json_node["filename"] = m_filename.string();
102  json_node["entryIndex"] = m_entryIndex;
103 
104  if (m_modelName.size())
105  json_node["sensorModel"] = m_modelName;
106 
107  if (m_sensorModel.valid())
108  {
109  ossimKeywordlist kwl;
110  m_sensorModel->saveState(kwl);
111  json_node["modelState"] = kwl.toString().string();
112  }
113 }
ossimFilename m_filename
Definition: Image.h:73
Represents serializable keyword/value map.
bool valid() const
Definition: ossimRefPtr.h:75
std::string m_imageId
Definition: Image.h:72
ossimRefPtr< ossimSensorModel > m_sensorModel
Definition: Image.h:78
unsigned int m_entryIndex
Definition: Image.h:74
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
virtual ossimString toString() const
std::string m_modelName
Definition: Image.h:76
const std::string & string() const
Definition: ossimString.h:414

◆ setEntryIndex()

void ossim::Image::setEntryIndex ( unsigned int  i)
inline

Definition at line 51 of file Image.h.

51 { m_entryIndex = i; }
unsigned int m_entryIndex
Definition: Image.h:74

◆ setFilename()

void ossim::Image::setFilename ( const std::string &  f)
inline

Definition at line 50 of file Image.h.

50 { m_filename = f; }
ossimFilename m_filename
Definition: Image.h:73

◆ setImageId()

void ossim::Image::setImageId ( const std::string &  id)
inline

Definition at line 49 of file Image.h.

49 { m_imageId = id; }
std::string m_imageId
Definition: Image.h:72

Member Data Documentation

◆ m_activeBand

unsigned int ossim::Image::m_activeBand
protected

Definition at line 75 of file Image.h.

Referenced by loadJSON().

◆ m_availableModel

std::vector< pair<std::string, std::string> > ossim::Image::m_availableModel
protected

Definition at line 77 of file Image.h.

◆ m_entryIndex

unsigned int ossim::Image::m_entryIndex
protected

Definition at line 74 of file Image.h.

Referenced by getAvailableModels(), loadJSON(), and saveJSON().

◆ m_filename

ossimFilename ossim::Image::m_filename
protected

Definition at line 73 of file Image.h.

Referenced by getAvailableModels(), loadJSON(), and saveJSON().

◆ m_imageId

std::string ossim::Image::m_imageId
protected

Definition at line 72 of file Image.h.

Referenced by loadJSON(), and saveJSON().

◆ m_modelName

std::string ossim::Image::m_modelName
protected

Definition at line 76 of file Image.h.

Referenced by loadJSON(), and saveJSON().

◆ m_sensorModel

ossimRefPtr<ossimSensorModel> ossim::Image::m_sensorModel
protected

Definition at line 78 of file Image.h.

Referenced by loadJSON(), and saveJSON().

◆ UNASSIGNED_PHOTOBLOCK_INDEX

unsigned int ossim::Image::UNASSIGNED_PHOTOBLOCK_INDEX
static

Definition at line 31 of file Image.h.


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