Isis 3 Programmer Reference
|
This represents a cube in a project-based GUI interface. More...
#include <Image.h>
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 () | |
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. | |
Cube * | cube () |
Get the Cube pointer associated with this display property. | |
void | closeCube () |
Cleans up the Cube pointer. | |
ImageDisplayProperties * | displayProperties () |
Get the display (GUI) properties (information) associated with this image. | |
const ImageDisplayProperties * | displayProperties () 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. | |
Private Member Functions | |
geos::geom::MultiPolygon * | createFootprint (QMutex *cameraMutex) |
Calculates a footprint for an Image using the camera or projection information. | |
void | initCamStats () |
Checks to see if the Cube label contains Camera Statistics. | |
void | initQuickFootprint () |
Creates a default ImagePolygon option which is read into the Cube. | |
Image (const Image &other) | |
Image & | operator= (const Image &rhs) |
Private Attributes | |
SpiceInt * | m_bodyCode |
The NaifBodyCode value, if it exists in the labels. | |
Cube * | m_cube |
The cube associated with this Image. | |
ImageDisplayProperties * | m_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. | |
QString | m_instrumentId |
Instrument id associated with this Image. | |
QString | m_observationNumber |
The observation number for this image. | |
QString | m_serialNumber |
The serial number for this image. | |
QString | m_spacecraftName |
Spacecraft name 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 |
Aspect ratio of the image. | |
double | m_resolution |
Resolution of the image. | |
Angle | m_emissionAngle |
Emmission angle of the image. | |
Angle | m_incidenceAngle |
Incidence angle of the image. | |
double | m_lineResolution |
Line resolution of the image. | |
double | m_sampleResolution |
Sample resolution of the image. | |
Distance | m_localRadius |
Local radius of the image. | |
Angle | m_northAzimuth |
North Azimuth for the image. | |
Angle | m_phaseAngle |
Phase angle for the image. | |
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()).
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.
2015-10-14 Jeffrey Covington - Declared Image * as a Qt metatype for use with QVariant.
2014-09-05 Kimberly Oyama - Added the serialNumber() function which returns the cube's serial number.
2015-09-05 Kenneth Edmundson - Added preliminary target body information (re: the member variables QString m_instrumentId (the instrument ID of the image), SpiceInt * m_bodyCode (the NaifBodyCode value if it exists in the labels), and QString m_spacecraftName (the Spacecraft name associated with this image).
2016-06-22 Tyler Wilson - Added documentation to member functions/variables. Fixes #3950.
2017-10-11 Summer Stapleton - Removed path to instrumentId and spacecraftName in the startElement method. Fixes #5179.
2017-11-01 Tracie Sucharski - Changed copyToNewProjectRoot to handle Images that are located outside of the import image directories such as the updated Images from a bundle run. To improve efficiency, return from method if the project root has not changed. Fixes #4849.
2018-06-30 Ian Humphrey - Added observationNumber() method so anything that grabs an Image ProjectItem can easily get both the serial number and observation number now. References #497.
2018-07-02 Ian Humphrey - Changed serialNumber() implementation to follow how observationNumber() is implemented. This ensures that any calls after the first call to these methods are O(1) and are not bottlenecekd by any file I/O that occurs in the Compose() methods. References #497.
2018-10-03 Tracie Sucharski - Added constructor which takes cube and a calculated footprint. This was done for ipce imported shapes which do not contain a footprint. References #5504.
|
explicit |
Create an image from a cube file on disk.
imageFileName | The name of a cube on disk - /work/users/.../blah.cub |
parent | The Qt-relationship parent |
Definition at line 40 of file Image.cpp.
References cube(), initCamStats(), initQuickFootprint(), m_aspectRatio, m_bodyCode, m_cube, m_displayProperties, m_fileName, m_footprint, m_id, m_lineResolution, m_resolution, m_sampleResolution, and Isis::Null.
Create an image from a cube file on disk.
imageFileName | The name of a cube on disk - /work/users/.../blah.cub |
parent | The Qt-relationship parent |
Definition at line 75 of file Image.cpp.
References initCamStats(), initQuickFootprint(), m_aspectRatio, m_bodyCode, m_cube, m_displayProperties, m_fileName, m_footprint, m_id, m_lineResolution, m_resolution, m_sampleResolution, and Isis::Null.
|
explicit |
Create an image from a cube file on disk including the footprint.
imageFileName | The name of a cube on disk - /work/users/.../blah.cub |
footprint | The calculated footprint |
parent | The Qt-relationship parent |
Definition at line 109 of file Image.cpp.
References footprint(), initCamStats(), m_aspectRatio, m_bodyCode, m_cube, m_displayProperties, m_fileName, m_footprint, m_id, m_lineResolution, m_resolution, m_sampleResolution, Isis::Null, and setId().
Isis::Image::~Image | ( | ) |
Clean up this image.
If you haven't saved this image, all of its settings will be lost.
Definition at line 136 of file Image.cpp.
References m_bodyCode, m_cube, m_displayProperties, m_footprint, and m_id.
double Isis::Image::aspectRatio | ( | ) | const |
Get the aspect ratio of this image, as calculated and attached by camstats.
Definition at line 411 of file Image.cpp.
References m_aspectRatio.
Referenced by Isis::ImageTreeWidgetItem::ImageTreeWidgetItem().
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.
Definition at line 282 of file Image.cpp.
References m_cube.
Referenced by deleteFromDisk(), Isis::ImageList::ImageList(), Isis::BundleAdjust::imageLists(), Isis::Project::imagesReady(), Isis::ImportImagesWorkOrder::importConfirmedImages(), Isis::JigsawRunWidget::on_JigsawAcceptButton_clicked(), and updateFileName().
Copy the cub/ecub files associated with this image into the new project.
newProjectRoot | The root directory where the project is stored. |
Definition at line 509 of file Image.cpp.
References Isis::Project::imageDataRoot(), m_fileName, Isis::FileName::name(), Isis::Project::newProjectRoot(), Isis::Project::projectRoot(), Isis::FileName::setExtension(), and Isis::FileName::toString().
|
private |
Calculates a footprint for an Image using the camera or projection information.
cameraMutex | A mutex that guarantees us serial access to the camera/projection classes |
Definition at line 681 of file Image.cpp.
References cube(), displayProperties(), Isis::Cube::lineCount(), Isis::PolygonTools::MakeMultiPolygon(), Isis::Cube::sampleCount(), and Isis::IException::User.
Referenced by initFootprint().
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.
IException::Programmer | "Cube cannot be created" |
Definition at line 262 of file Image.cpp.
References m_cube, m_fileName, and Isis::IException::Programmer.
Referenced by Isis::Workspace::addImages(), createFootprint(), deleteFromDisk(), Isis::MosaicSceneItem::drawImage(), Isis::MosaicSceneItem::getPixelValue(), Isis::MosaicSceneItem::getStretch(), Image(), initCamStats(), initQuickFootprint(), observationNumber(), Isis::CubeDnView::onItemAdded(), serialNumber(), and Isis::CubeDnView::setWorkspaceActiveCube().
void Isis::Image::deleteFromDisk | ( | ) |
Delete the image data from disk.
The cube() will no longer be accessible until you call updateFileName().
IException::Io | "Could not remove file [$filename]" |
Definition at line 561 of file Image.cpp.
References closeCube(), cube(), Isis::Cube::externalCubeFileName(), Isis::IException::Io, m_fileName, Isis::FileName::path(), and Isis::FileName::setExtension().
Referenced by Isis::ImageList::deleteFromDisk().
ImageDisplayProperties * Isis::Image::displayProperties | ( | ) |
Get the display (GUI) properties (information) associated with this image.
Definition at line 295 of file Image.cpp.
References m_displayProperties.
Referenced by Isis::ImageList::allSupport(), Isis::MosaicSceneItem::contextMenuEvent(), createFootprint(), Isis::MosaicSceneItem::cubeDisplayChanged(), Isis::MosaicControlNetTool::displayConnectivity(), fromPvl(), Isis::ImageListActionWorkOrder::ImageListActionWorkOrder(), Isis::ImageTreeWidgetItem::ImageTreeWidgetItem(), Isis::ImportImagesWorkOrder::importConfirmedImages(), initFootprint(), Isis::MosaicSceneItem::MosaicSceneItem(), Isis::ProjectItemModel::onSelectionChanged(), Isis::MosaicSceneItem::paint(), Isis::MosaicSceneItem::reproject(), Isis::ImageList::saveAndApplyAlpha(), Isis::ImageList::saveAndApplyColor(), Isis::ImageList::saveAndApplyRandomColor(), Isis::ImageList::saveAndToggleShowDNs(), Isis::ImageList::saveAndToggleShowFill(), Isis::ImageList::saveAndToggleShowLabel(), Isis::ImageList::saveAndToggleShowOutline(), Isis::ImageListActionWorkOrder::setData(), Isis::ImageList::showRandomColor(), Isis::ImageList::supportedActions(), toPvl(), Isis::MosaicSceneItem::updateChildren(), and Isis::MosaicSceneItem::updateSelection().
const ImageDisplayProperties * Isis::Image::displayProperties | ( | ) | const |
Get a non-mutable (const) the display (GUI) properties (information) associated with this image.
Definition at line 306 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.
Definition at line 440 of file Image.cpp.
References m_emissionAngle.
Referenced by Isis::ImageTreeWidgetItem::ImageTreeWidgetItem().
QString Isis::Image::fileName | ( | ) | const |
Get the file name of the cube that this image represents.
Definition at line 315 of file Image.cpp.
References m_fileName.
Referenced by Isis::BundleAdjust::BundleAdjust(), Isis::JigsawRunWidget::on_JigsawAcceptButton_clicked(), and Isis::ProjectItem::setImage().
geos::geom::MultiPolygon * Isis::Image::footprint | ( | ) |
Get the footprint of this image (if available).
Definition at line 349 of file Image.cpp.
References m_footprint.
Referenced by Image().
const geos::geom::MultiPolygon * Isis::Image::footprint | ( | ) | const |
Get the non-mutable (const) footprint of this image (if available).
Definition at line 368 of file Image.cpp.
References m_footprint.
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
pvl | The PvlObject that contains image information. |
IException::Unknown | "Tried to load Image with properties/information" |
Definition at line 169 of file Image.cpp.
References displayProperties(), 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.
Definition at line 420 of file Image.cpp.
References m_id.
Referenced by Isis::Project::addImagesToIdMap(), Isis::ImageFileListWidget::find(), Isis::Project::imagesReady(), Isis::ImportImagesWorkOrder::importConfirmedImages(), and Isis::WorkOrder::listenForImageDestruction().
Angle Isis::Image::incidenceAngle | ( | ) | const |
Get the incidence angle of this image, as calculated and attached by camstats.
This is the image-wide average.
Definition at line 450 of file Image.cpp.
References m_incidenceAngle.
Referenced by Isis::ImageTreeWidgetItem::ImageTreeWidgetItem().
|
private |
Checks to see if the Cube label contains Camera Statistics.
If it does, then we attempt to grab data from the label to populate the private members variables.
Definition at line 709 of file Image.cpp.
References cube(), Isis::Angle::Degrees, Isis::Cube::label(), m_aspectRatio, m_emissionAngle, m_fileName, m_incidenceAngle, m_instrumentId, m_lineResolution, m_localRadius, m_northAzimuth, m_phaseAngle, m_resolution, m_sampleResolution, m_spacecraftName, Isis::Distance::Meters, Isis::PvlObject::object(), and Isis::PvlObject::objects().
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.
cameraMutex | A pointer to the camera mutex to lock the camera resource while a footprint is created. |
IException::Io | "Could not read the footprint from cube [$cube]. Please make sure footprintinit has been run" |
Definition at line 384 of file Image.cpp.
References createFootprint(), Isis::DisplayProperties::displayName(), displayProperties(), initQuickFootprint(), Isis::IException::Io, and m_footprint.
Referenced by Isis::ImageReader::VariantToImageFunctor::operator()().
|
private |
Creates a default ImagePolygon option which is read into the Cube.
Definition at line 792 of file Image.cpp.
References cube(), m_footprint, Isis::PolygonTools::MakeMultiPolygon(), and Isis::Cube::readFootprint().
Referenced by Image(), Image(), and initFootprint().
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 228 of file Image.cpp.
References Isis::Cube::label(), m_cube, m_footprint, Isis::PvlObject::object(), Isis::ImagePolygon::toBlob(), and Isis::Blob::Type().
Referenced by Isis::Footprint2DViewWorkOrder::isExecutable().
double Isis::Image::lineResolution | ( | ) | const |
Get the line resolution of this image, as calculated and attached by camstats.
This is the image-wide average.
Definition at line 460 of file Image.cpp.
References m_lineResolution.
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.
Definition at line 470 of file Image.cpp.
References m_localRadius.
Angle Isis::Image::northAzimuth | ( | ) | const |
Get the north azimuth of this image, as calculated and attached by camstats.
This is the image-wide average.
Definition at line 480 of file Image.cpp.
References m_northAzimuth.
Referenced by Isis::ImageTreeWidgetItem::ImageTreeWidgetItem().
QString Isis::Image::observationNumber | ( | ) |
Returns the observation number of the Cube.
Definition at line 324 of file Image.cpp.
References Isis::ObservationNumber::Compose(), cube(), and m_observationNumber.
Angle Isis::Image::phaseAngle | ( | ) | const |
Get the phase angle of this image, as calculated and attached by camstats.
This is the image-wide average.
Definition at line 490 of file Image.cpp.
References m_phaseAngle.
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.
Definition at line 430 of file Image.cpp.
References m_resolution.
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.
Definition at line 500 of file Image.cpp.
References m_sampleResolution.
Referenced by Isis::ImageTreeWidgetItem::ImageTreeWidgetItem().
void Isis::Image::save | ( | QXmlStreamWriter & | stream, |
const Project * | project, | ||
FileName | newProjectRoot ) const |
Write the Image properties out to an XML file.
stream | The output data stream. |
project | The project this image is contained within. |
newProjectRoot | The path/filename we are writing to. |
Output format:
<image id="..." fileName="..."> ... </image>
(fileName attribute is just the base name)
Definition at line 601 of file Image.cpp.
References Isis::IsSpecial(), Isis::Angle::isValid(), Isis::Distance::isValid(), m_aspectRatio, m_displayProperties, m_emissionAngle, m_fileName, m_footprint, m_id, m_incidenceAngle, m_instrumentId, m_lineResolution, m_localRadius, m_northAzimuth, m_phaseAngle, m_resolution, m_sampleResolution, m_spacecraftName, Isis::Distance::meters(), Isis::Angle::radians(), Isis::DisplayProperties::save(), and Isis::IString::ToQt().
Referenced by Isis::ImageList::save().
QString Isis::Image::serialNumber | ( | ) |
Returns the serial number of the Cube.
Definition at line 336 of file Image.cpp.
References Isis::SerialNumber::Compose(), cube(), and m_serialNumber.
Referenced by Isis::ControlHealthMonitorView::openImageEditor().
void Isis::Image::setId | ( | QString | id | ) |
PvlObject Isis::Image::toPvl | ( | ) | const |
Convert this Image to PVL.
The output looks like this:
Object = Image FileName = ... ID = ... EndObject
Definition at line 201 of file Image.cpp.
References displayProperties(), m_fileName, m_id, and Isis::DisplayProperties::toPvl().
|
slot |
Change the on-disk file name for this cube to be where the image ought to be in the given project.
project | The project that this image is stored in. |
Definition at line 666 of file Image.cpp.
References closeCube(), Isis::FileName::dir(), Isis::Project::imageDataRoot(), m_fileName, and Isis::FileName::name().
|
private |
Aspect ratio of the image.
Definition at line 210 of file Image.h.
Referenced by aspectRatio(), Image(), Image(), Image(), initCamStats(), and save().
|
private |
|
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 169 of file Image.h.
Referenced by closeCube(), cube(), Image(), Image(), Image(), isFootprintable(), and ~Image().
|
private |
The GUI information for how this Image ought to be displayed.
Definition at line 174 of file Image.h.
Referenced by displayProperties(), displayProperties(), Image(), Image(), Image(), save(), and ~Image().
|
private |
Emmission angle of the image.
Definition at line 212 of file Image.h.
Referenced by emissionAngle(), initCamStats(), and save().
|
private |
The on-disk file name of the cube associated with this Image.
Definition at line 179 of file Image.h.
Referenced by copyToNewProjectRoot(), cube(), deleteFromDisk(), fileName(), fromPvl(), Image(), Image(), Image(), initCamStats(), save(), toPvl(), and updateFileName().
|
private |
A 0-360 ocentric lon,lat degrees footprint of this Image.
Definition at line 204 of file Image.h.
Referenced by footprint(), footprint(), Image(), Image(), Image(), initFootprint(), initQuickFootprint(), isFootprintable(), save(), and ~Image().
|
private |
|
private |
Incidence angle of the image.
Definition at line 213 of file Image.h.
Referenced by incidenceAngle(), initCamStats(), and save().
|
private |
Instrument id associated with this Image.
Definition at line 184 of file Image.h.
Referenced by initCamStats(), and save().
|
private |
Line resolution of the image.
Definition at line 214 of file Image.h.
Referenced by Image(), Image(), Image(), initCamStats(), lineResolution(), and save().
|
private |
Local radius of the image.
Definition at line 216 of file Image.h.
Referenced by initCamStats(), localRadius(), and save().
|
private |
North Azimuth for the image.
Definition at line 217 of file Image.h.
Referenced by initCamStats(), northAzimuth(), and save().
|
private |
The observation number for this image.
Definition at line 189 of file Image.h.
Referenced by observationNumber().
|
private |
Phase angle for the image.
Definition at line 218 of file Image.h.
Referenced by initCamStats(), phaseAngle(), and save().
|
private |
Resolution of the image.
Definition at line 211 of file Image.h.
Referenced by Image(), Image(), Image(), initCamStats(), resolution(), and save().
|
private |
Sample resolution of the image.
Definition at line 215 of file Image.h.
Referenced by Image(), Image(), Image(), initCamStats(), sampleResolution(), and save().
|
private |
The serial number for this image.
Definition at line 194 of file Image.h.
Referenced by serialNumber().
|
private |
Spacecraft name associated with this Image.
Definition at line 199 of file Image.h.
Referenced by initCamStats(), and save().