USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::Image Class Reference

This represents a cube in a project-based GUI interface. More...

#include <Image.h>

Inheritance diagram for Isis::Image:
Inheritance graph
Collaboration diagram for Isis::Image:
Collaboration graph

Classes

class  XmlHandler
 

Public Slots

void updateFileName (Project *)
 Change the on-disk file name for this cube to be where the image ought to be in the given project.
 

Public Member Functions

 Image (QString imageFileName, QObject *parent=0)
 Create an image from a cube file on disk.
 
 Image (Cube *imageCube, QObject *parent=0)
 Create an image from a cube file on disk.
 
 Image (FileName imageFolder, XmlStackedHandlerReader *xmlReader, QObject *parent=0)
 Construct this image from XML.
 
 ~Image ()
 Clean up this image.
 
void fromPvl (const PvlObject &pvl)
 Read the image settings from a Pvl.
 
PvlObject toPvl () const
 Convert this Image to PVL.
 
bool isFootprintable () const
 Test to see if it's possible to create a footprint from this image.
 
Cubecube ()
 Get the Cube * associated with this display property.
 
void closeCube ()
 Cleans up the Cube *.
 
ImageDisplayPropertiesdisplayProperties ()
 Get the display (GUI) properties (information) associated with this image.
 
const ImageDisplayPropertiesdisplayProperties () const
 Get a non-mutable (const) the display (GUI) properties (information) associated with this image.
 
QString fileName () const
 Get the file name of the cube that this image represents.
 
geos::geom::MultiPolygon * footprint ()
 Get the footprint of this image (if available).
 
const geos::geom::MultiPolygon * footprint () const
 Get the non-mutable (const) footprint of this image (if available).
 
void setId (QString id)
 Override the automatically generated ID with the given ID.
 
bool initFootprint (QMutex *cameraMutex)
 Calculate a footprint for this image.
 
double aspectRatio () const
 Get the aspect ratio of this image, as calculated and attached by camstats.
 
QString id () const
 Get a unique, identifying string associated with this image.
 
double resolution () const
 Get the resolution of this image, as calculated and attached by camstats.
 
Angle emissionAngle () const
 Get the emission angle of this image, as calculated and attached by camstats.
 
Angle incidenceAngle () const
 Get the incidence angle of this image, as calculated and attached by camstats.
 
double lineResolution () const
 Get the line resolution of this image, as calculated and attached by camstats.
 
Distance localRadius () const
 Get the local radius of this image, as calculated and attached by camstats.
 
Angle northAzimuth () const
 Get the north azimuth of this image, as calculated and attached by camstats.
 
Angle phaseAngle () const
 Get the phase angle of this image, as calculated and attached by camstats.
 
double sampleResolution () const
 Get the sample resolution of this image, as calculated and attached by camstats.
 
void copyToNewProjectRoot (const Project *project, FileName newProjectRoot)
 Copy the cub/ecub files associated with this image into the new project.
 
void deleteFromDisk ()
 Delete the image data from disk.
 
void save (QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
 Output format:
 

Private Member Functions

geos::geom::MultiPolygon * createFootprint (QMutex *cameraMutex)
 Calculate a footprint for an Image using the camera or projection information.
 
void initCamStats ()
 
void initQuickFootprint ()
 
 Image (const Image &other)
 
Imageoperator= (const Image &rhs)
 

Private Attributes

Cubem_cube
 The cube associated with this Image.
 
ImageDisplayPropertiesm_displayProperties
 The GUI information for how this Image ought to be displayed.
 
QString m_fileName
 The on-disk file name of the cube associated with this Image.
 
geos::geom::MultiPolygon * m_footprint
 A 0-360 ocentric lon,lat degrees footprint of this Image.
 
QUuid * m_id
 A unique ID for this Image (useful for others to reference this Image when saving to disk).
 
double m_aspectRatio
 
double m_resolution
 
Angle m_emissionAngle
 
Angle m_incidenceAngle
 
double m_lineResolution
 
Distance m_localRadius
 
Angle m_northAzimuth
 
Angle m_phaseAngle
 
double m_sampleResolution
 

Detailed Description

This represents a cube in a project-based GUI interface.

The actual cube doesn't have to be open. This encapsulates ideas about an image such as it's footprint, it's cube, how it should be viewed, where it is on disk, etc. This class is designed to be semi-light weight - we should be able to have tens of thousands of these in memory without any issues (provided the Cube files aren't open - see closeCube()).

Author
2012-07-23 ???
History:

2011-05-11 Steven Lambright - Added accessors for data that is complicated to get or expensive (i.e. Camera statistics and the footprint).

2011-05-18 Steven Lambright - Fixed the second constructor

2012-10-02 Steven Lambright - Added support for camera statistics information that used to be in CubeDisplayProperties (a class that no longer exists).

2012-10-04 Jeannie Backer Changed references to TableField methods to lower camel case. Fixed history entry indentation. Added padding to control statements. References #1169.

Definition at line 74 of file Image.h.

Constructor & Destructor Documentation

Isis::Image::Image ( QString  imageFileName,
QObject parent = 0 
)
explicit

Create an image from a cube file on disk.

Parameters
imageFileNameThe name of a cube on disk - /work/users/.../blah.cub
parentThe Qt-relationship parent

Definition at line 37 of file Image.cpp.

References cube(), m_cube, m_displayProperties, m_fileName, m_footprint, m_id, and Isis::Null.

Isis::Image::Image ( Cube imageCube,
QObject parent = 0 
)
explicit

Create an image from a cube file on disk.

Parameters
imageFileNameThe name of a cube on disk - /work/users/.../blah.cub
parentThe Qt-relationship parent

Definition at line 72 of file Image.cpp.

References Isis::Cube::fileName(), m_cube, m_displayProperties, m_fileName, m_footprint, m_id, and Isis::Null.

Isis::Image::Image ( FileName  imageFolder,
XmlStackedHandlerReader xmlReader,
QObject parent = 0 
)

Construct this image from XML.

Parameters
imageFolderWhere this image XML resides - /work/.../projectRoot/images/import1
xmlReaderAn XML reader that's up to an <image> tag.
parentThe Qt-relationship parent

Definition at line 106 of file Image.cpp.

References m_cube, m_displayProperties, m_footprint, m_id, and Isis::Null.

Isis::Image::~Image ( )

Clean up this image.

If you haven't saved this image, all of its settings will be lost.

Definition at line 125 of file Image.cpp.

References m_cube, m_displayProperties, m_footprint, and m_id.

Member Function Documentation

double Isis::Image::aspectRatio ( ) const

Get the aspect ratio of this image, as calculated and attached by camstats.

Returns
The aspect ratio if available, otherwise Null

Definition at line 355 of file Image.cpp.

Referenced by Isis::ImageTreeWidgetItem::ImageTreeWidgetItem().

void Isis::Image::closeCube ( )

Cleans up the Cube *.

You want to call this once you're sure you are done with the Cube because the OS will limit how many of these we have open.

Definition at line 256 of file Image.cpp.

References m_cube.

Referenced by deleteFromDisk(), Isis::ImportImagesWorkOrder::importConfirmedImages(), Isis::ExportImagesWorkOrder::ProjectImageExportFunctor::operator()(), and updateFileName().

void Isis::Image::copyToNewProjectRoot ( const Project project,
FileName  newProjectRoot 
)

Copy the cub/ecub files associated with this image into the new project.

Definition at line 461 of file Image.cpp.

References Isis::Cube::externalCubeFileName(), Isis::Project::imageDataRoot(), m_fileName, Isis::FileName::path(), and Isis::Project::projectRoot().

geos::geom::MultiPolygon * Isis::Image::createFootprint ( QMutex *  cameraMutex)
private

Calculate a footprint for an Image using the camera or projection information.

Parameters
cameraMutexA mutex that guarantees us serial access to the camera/projection classes
Returns
The resulting footprint

Definition at line 612 of file Image.cpp.

References _FILEINFO_, Isis::ImagePolygon::Create(), cube(), displayProperties(), Isis::Cube::lineCount(), Isis::PolygonTools::MakeMultiPolygon(), Isis::ImagePolygon::Polys(), Isis::IException::print(), Isis::Cube::sampleCount(), and Isis::IException::User.

Referenced by initFootprint().

Cube * Isis::Image::cube ( )

Get the Cube * associated with this display property.

This will allocate the Cube * if one is not already present.

Definition at line 243 of file Image.cpp.

References m_cube, and m_fileName.

Referenced by createFootprint(), deleteFromDisk(), Isis::MosaicSceneItem::drawImage(), Isis::MosaicSceneItem::getPixelValue(), Isis::MosaicSceneItem::getStretch(), Image(), and Isis::ExportImagesWorkOrder::ProjectImageExportFunctor::operator()().

void Isis::Image::deleteFromDisk ( )

Delete the image data from disk.

The cube() will no longer be accessible until you call updateFileName().

Definition at line 497 of file Image.cpp.

References _FILEINFO_, closeCube(), cube(), Isis::Cube::externalCubeFileName(), Isis::IException::Io, m_fileName, and Isis::FileName::path().

Referenced by Isis::ImageList::deleteFromDisk().

const ImageDisplayProperties * Isis::Image::displayProperties ( ) const

Get a non-mutable (const) the display (GUI) properties (information) associated with this image.

Returns
A non-mutable ImageDisplayProperties that describes how to view this image.

Definition at line 280 of file Image.cpp.

References m_displayProperties.

Angle Isis::Image::emissionAngle ( ) const

Get the emission angle of this image, as calculated and attached by camstats.

This is the image-wide average.

Returns
The emission angle if available, otherwise an invalid angle

Definition at line 387 of file Image.cpp.

Referenced by Isis::ImageTreeWidgetItem::ImageTreeWidgetItem().

QString Isis::Image::fileName ( ) const

Get the file name of the cube that this image represents.

Returns
A string containing the path to the cube data associated with this image.

Definition at line 290 of file Image.cpp.

References m_fileName.

Referenced by Isis::ExportImagesWorkOrder::ProjectImageExportFunctor::operator()(), and Isis::Image::XmlHandler::startElement().

geos::geom::MultiPolygon * Isis::Image::footprint ( )

Get the footprint of this image (if available).

Returns
A lat/lon footprint of this image, or NULL if unavailable.

Definition at line 300 of file Image.cpp.

References m_footprint.

const geos::geom::MultiPolygon * Isis::Image::footprint ( ) const

Get the non-mutable (const) footprint of this image (if available).

Returns
A non-mutable (const) lat/lon footprint of this image, or NULL if unavailable.

Definition at line 318 of file Image.cpp.

References m_footprint.

void Isis::Image::fromPvl ( const PvlObject pvl)

Read the image settings from a Pvl.

  Object = Image
    FileName = ...
    ID = ...
  EndObject
Parameters
pvlThe PvlObject that contains image information.

Definition at line 154 of file Image.cpp.

References _FILEINFO_, displayProperties(), Isis::PvlObject::findObject(), Isis::PvlObject::hasKeyword(), m_fileName, m_id, and Isis::IException::Unknown.

Referenced by Isis::ImageReader::VariantToImageFunctor::operator()().

QString Isis::Image::id ( ) const

Get a unique, identifying string associated with this image.

Returns
A unique ID for this image

Definition at line 365 of file Image.cpp.

References m_id.

Referenced by Isis::ImportImagesWorkOrder::importConfirmedImages().

Angle Isis::Image::incidenceAngle ( ) const

Get the incidence angle of this image, as calculated and attached by camstats.

This is the image-wide average.

Returns
The incidence angle if available, otherwise an invalid angle

Definition at line 398 of file Image.cpp.

Referenced by Isis::ImageTreeWidgetItem::ImageTreeWidgetItem().

bool Isis::Image::initFootprint ( QMutex *  cameraMutex)

Calculate a footprint for this image.

If the footprint is already stored inside the cube, that will be used instead. If no footprint can be found, this throws an exception.

Definition at line 327 of file Image.cpp.

References _FILEINFO_, createFootprint(), Isis::DisplayProperties::displayName(), displayProperties(), Isis::IException::Io, and m_footprint.

Referenced by Isis::ImageReader::VariantToImageFunctor::operator()().

bool Isis::Image::isFootprintable ( ) const

Test to see if it's possible to create a footprint from this image.

This may not give an accurate answer if the cube isn't open.

Definition at line 212 of file Image.cpp.

References Isis::PvlObject::hasKeyword(), Isis::PvlContainer::isNamed(), Isis::Cube::label(), m_cube, m_footprint, Isis::Blob::Name(), Isis::PvlObject::object(), Isis::PvlObject::objects(), and Isis::Blob::Type().

Referenced by Isis::Footprint2DViewWorkOrder::isExecutable(), and Isis::Footprint2DViewWorkOrder::syncRedo().

double Isis::Image::lineResolution ( ) const

Get the line resolution of this image, as calculated and attached by camstats.

This is the image-wide average.

Returns
The line resolution if available, otherwise Null

Definition at line 409 of file Image.cpp.

Referenced by Isis::ImageTreeWidgetItem::ImageTreeWidgetItem().

Distance Isis::Image::localRadius ( ) const

Get the local radius of this image, as calculated and attached by camstats.

This is the image-wide average.

Returns
The local radius if available, otherwise an invalid Distance

Definition at line 420 of file Image.cpp.

Angle Isis::Image::northAzimuth ( ) const

Get the north azimuth of this image, as calculated and attached by camstats.

This is the image-wide average.

Returns
The north azimuth if available, otherwise an invalid angle

Definition at line 431 of file Image.cpp.

Referenced by Isis::ImageTreeWidgetItem::ImageTreeWidgetItem().

Angle Isis::Image::phaseAngle ( ) const

Get the phase angle of this image, as calculated and attached by camstats.

This is the image-wide average.

Returns
The phase angle if available, otherwise an invalid angle

Definition at line 442 of file Image.cpp.

Referenced by Isis::ImageTreeWidgetItem::ImageTreeWidgetItem().

double Isis::Image::resolution ( ) const

Get the resolution of this image, as calculated and attached by camstats.

This is the image-wide average.

Returns
The resolution if available, otherwise Null

Definition at line 376 of file Image.cpp.

Referenced by Isis::ImageTreeWidgetItem::ImageTreeWidgetItem().

double Isis::Image::sampleResolution ( ) const

Get the sample resolution of this image, as calculated and attached by camstats.

This is the image-wide average.

Returns
The sample resolution if available, otherwise Null

Definition at line 453 of file Image.cpp.

Referenced by Isis::ImageTreeWidgetItem::ImageTreeWidgetItem().

void Isis::Image::save ( QXmlStreamWriter &  stream,
const Project project,
FileName  newProjectRoot 
) const

Output format:

<image id="..." filename="..."> ... </image>

(fileName attribute is just the base name)

Definition at line 532 of file Image.cpp.

References Isis::IsSpecial(), Isis::Angle::isValid(), Isis::Distance::isValid(), m_displayProperties, m_fileName, m_footprint, m_id, Isis::Distance::meters(), Isis::Angle::radians(), and Isis::DisplayProperties::save().

Referenced by Isis::ImageList::save().

void Isis::Image::setId ( QString  id)

Override the automatically generated ID with the given ID.

Definition at line 308 of file Image.cpp.

References m_id.

Referenced by Isis::ImportImagesWorkOrder::importConfirmedImages().

PvlObject Isis::Image::toPvl ( ) const

Convert this Image to PVL.

The output looks like this:

  Object = Image
    FileName = ...
    ID = ...
  EndObject
Returns
A PvlObject that contains image information.

Definition at line 186 of file Image.cpp.

References displayProperties(), m_fileName, m_id, and Isis::DisplayProperties::toPvl().

void Isis::Image::updateFileName ( Project project)
slot

Change the on-disk file name for this cube to be where the image ought to be in the given project.

Parameters
projectThe project that this image is stored in

Definition at line 596 of file Image.cpp.

References closeCube(), Isis::Project::imageDataRoot(), and m_fileName.

Member Data Documentation

Cube* Isis::Image::m_cube
private

The cube associated with this Image.

This is usually NULL once the image is done initializing because no more than a thousand of these should ever be open at once.

Definition at line 153 of file Image.h.

Referenced by closeCube(), cube(), Image(), isFootprintable(), and ~Image().

ImageDisplayProperties* Isis::Image::m_displayProperties
private

The GUI information for how this Image ought to be displayed.

Definition at line 157 of file Image.h.

Referenced by displayProperties(), Image(), save(), and ~Image().

QString Isis::Image::m_fileName
private

The on-disk file name of the cube associated with this Image.

Definition at line 161 of file Image.h.

Referenced by copyToNewProjectRoot(), cube(), deleteFromDisk(), fileName(), fromPvl(), Image(), save(), toPvl(), and updateFileName().

geos::geom::MultiPolygon* Isis::Image::m_footprint
private

A 0-360 ocentric lon,lat degrees footprint of this Image.

Definition at line 165 of file Image.h.

Referenced by footprint(), Image(), initFootprint(), isFootprintable(), save(), and ~Image().

QUuid* Isis::Image::m_id
private

A unique ID for this Image (useful for others to reference this Image when saving to disk).

Definition at line 169 of file Image.h.

Referenced by fromPvl(), id(), Image(), save(), setId(), toPvl(), and ~Image().


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