Isis Developer Reference
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

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 (Cube *imageCube, geos::geom::MultiPolygon *footprint, QString id, QObject *parent=0)
 Create an image from a cube file on disk including the footprint.
 
 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 pointer associated with this display property.
 
void closeCube ()
 Cleans up the Cube pointer.
 
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.
 
QString observationNumber ()
 Returns the observation number of the Cube.
 
QString serialNumber ()
 Returns the serial number of the Cube.
 
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
 Write the Image properties out to an XML file.
 

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 ???

Constructor & Destructor Documentation

◆ Image() [1/4]

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

References cube(), and Isis::Null.

◆ Image() [2/4]

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

References Isis::Null.

◆ Image() [3/4]

Isis::Image::Image ( Cube * imageCube,
geos::geom::MultiPolygon * footprint,
QString id,
QObject * parent = 0 )
explicit

Create an image from a cube file on disk including the footprint.

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

References footprint(), Isis::Null, and setId().

◆ Image() [4/4]

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

References Isis::Null.

◆ ~Image()

Isis::Image::~Image ( )

Clean up this image.

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

Member Function Documentation

◆ aspectRatio()

double Isis::Image::aspectRatio ( ) const

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

Returns
double The aspect ratio if available, otherwise Null is returned.

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

◆ closeCube()

void Isis::Image::closeCube ( )

Cleans up the Cube pointer.

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

Referenced by deleteFromDisk(), Isis::ImageList::ImageList(), Isis::BundleAdjust::imageLists(), and updateFileName().

◆ copyToNewProjectRoot()

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

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

Parameters
newProjectRootThe root directory where the project is stored.

References Isis::Project::imageDataRoot(), Isis::FileName::name(), Isis::Project::newProjectRoot(), Isis::Project::projectRoot(), Isis::FileName::setExtension(), and Isis::FileName::toString().

◆ cube()

Cube * Isis::Image::cube ( )

Get the Cube pointer associated with this display property.

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

Exceptions
IException::Programmer"Cube cannot be created"
Returns
(Cube *) A pointer to the image cube.

References _FILEINFO_, and Isis::IException::Programmer.

Referenced by Isis::Workspace::addImages(), deleteFromDisk(), Image(), Isis::JigsawSetupDialog::JigsawSetupDialog(), observationNumber(), and serialNumber().

◆ deleteFromDisk()

void Isis::Image::deleteFromDisk ( )

Delete the image data from disk.

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

Exceptions
IException::Io"Could not remove file [$filename]"

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

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

◆ displayProperties() [1/2]

◆ displayProperties() [2/2]

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

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

Returns
(ImageDisplayProperties *) A pointer to a non-mutable ImageDisplayProperties object that describes how to view this image.

◆ emissionAngle()

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
Angle The emission angle if available, otherwise an invalid angle is returned.

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

◆ fileName()

QString Isis::Image::fileName ( ) const

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

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

Referenced by Isis::BundleAdjust::BundleAdjust(), and Isis::ProjectItem::setImage().

◆ footprint() [1/2]

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

Get the footprint of this image (if available).

Returns
(geos::geom::MultiPolygon *) A pointer to a lat/lon footprint of this image, or NULL if unavailable.

Referenced by Image().

◆ footprint() [2/2]

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

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

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

◆ fromPvl()

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

Read the image settings from a Pvl.

The Pvl file looks like this:

  Object = Image
    FileName = ...
    ID = ...
  EndObject
Parameters
pvlThe PvlObject that contains image information.
Exceptions
IException::Unknown"Tried to load Image with properties/information"

References _FILEINFO_, displayProperties(), Isis::DisplayProperties::fromPvl(), and Isis::IException::Unknown.

◆ id()

QString Isis::Image::id ( ) const

Get a unique, identifying string associated with this image.

Returns
QString A unique ID for this image.

Referenced by Isis::Project::addImagesToIdMap(), and Isis::CubeDnView::save().

◆ incidenceAngle()

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
Angle The incidence angle if available, otherwise an invalid angle is returned.

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

◆ initFootprint()

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.

Parameters
cameraMutexA pointer to the camera mutex to lock the camera resource while a footprint is created.
Exceptions
IException::Io"Could not read the footprint from cube [$cube]. Please make sure footprintinit has been run"
Returns
bool Returns True if there is a footprint stored in the Cube, False otherwise.

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

◆ isFootprintable()

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.

Returns
bool Returns True if it is possible, False if it is not.

References Isis::Cube::label(), Isis::PvlObject::object(), Isis::ImagePolygon::toBlob(), and Isis::Blob::Type().

Referenced by Isis::Footprint2DViewWorkOrder::isExecutable().

◆ lineResolution()

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
double The line resolution if available, otherwise Null.

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

◆ localRadius()

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.

◆ northAzimuth()

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
Angle The north azimuth if available, otherwise an invalid angle

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

◆ observationNumber()

QString Isis::Image::observationNumber ( )

Returns the observation number of the Cube.

Returns
QString A string representation of the observation number of the cube.

References Isis::ObservationNumber::Compose(), and cube().

Referenced by Isis::JigsawSetupDialog::JigsawSetupDialog().

◆ phaseAngle()

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
Angle The phase angle if available, otherwise an invalid angle is returned.

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

◆ resolution()

double Isis::Image::resolution ( ) const

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

This is the image-wide average.

Returns
double The resolution if available, otherwise Null is returned.

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

◆ sampleResolution()

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
double The sample resolution if available, otherwise Null is returned.

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

◆ save()

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

Write the Image properties out to an XML file.

Parameters
streamThe output data stream.
projectThe project this image is contained within.
newProjectRootThe path/filename we are writing to.

Output format:

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

(fileName attribute is just the base name)

References Isis::IsSpecial(), Isis::Angle::isValid(), Isis::Distance::isValid(), Isis::Distance::meters(), Isis::Angle::radians(), Isis::DisplayProperties::save(), and Isis::IString::ToQt().

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

◆ serialNumber()

QString Isis::Image::serialNumber ( )

Returns the serial number of the Cube.

Returns
QString A string representation of the serial number of the cube.

References Isis::SerialNumber::Compose(), and cube().

◆ setId()

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

Override the automatically generated ID with the given ID.

Parameters
idThe id tjat overrides the automatically generated id.

Referenced by Image().

◆ toPvl()

PvlObject Isis::Image::toPvl ( ) const

Convert this Image to PVL.

The output looks like this:

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

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

Referenced by Isis::MosaicController::saveProject().

◆ updateFileName

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.

References closeCube(), Isis::FileName::dir(), Isis::Project::imageDataRoot(), and Isis::FileName::name().


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