This represents a cube in a project-based GUI interface. More...
#include <Image.h>
Classes | |
class | XmlHandler |
Child class for XmlStackedHandler which is used to process XML in a stack-oriented way. More... | |
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. More... | |
Public Member Functions | |
Image (QString imageFileName, QObject *parent=0) | |
Create an image from a cube file on disk. More... | |
Image (Cube *imageCube, QObject *parent=0) | |
Create an image from a cube file on disk. More... | |
Image (FileName imageFolder, XmlStackedHandlerReader *xmlReader, QObject *parent=0) | |
Construct this image from XML. More... | |
~Image () | |
Clean up this image. More... | |
void | fromPvl (const PvlObject &pvl) |
Read the image settings from a Pvl. More... | |
PvlObject | toPvl () const |
Convert this Image to PVL. More... | |
bool | isFootprintable () const |
Test to see if it's possible to create a footprint from this image. More... | |
Cube * | cube () |
Get the Cube pointer associated with this display property. More... | |
void | closeCube () |
Cleans up the Cube pointer. More... | |
ImageDisplayProperties * | displayProperties () |
Get the display (GUI) properties (information) associated with this image. More... | |
const ImageDisplayProperties * | displayProperties () const |
Get a non-mutable (const) the display (GUI) properties (information) associated with this image. More... | |
QString | fileName () const |
Get the file name of the cube that this image represents. More... | |
QString | serialNumber () |
Returns the serial number of the Cube. More... | |
geos::geom::MultiPolygon * | footprint () |
Get the footprint of this image (if available). More... | |
const geos::geom::MultiPolygon * | footprint () const |
Get the non-mutable (const) footprint of this image (if available). More... | |
void | setId (QString id) |
Override the automatically generated ID with the given ID. More... | |
bool | initFootprint (QMutex *cameraMutex) |
Calculate a footprint for this image. More... | |
double | aspectRatio () const |
Get the aspect ratio of this image, as calculated and attached by camstats. More... | |
QString | id () const |
Get a unique, identifying string associated with this image. More... | |
double | resolution () const |
Get the resolution of this image, as calculated and attached by camstats. More... | |
Angle | emissionAngle () const |
Get the emission angle of this image, as calculated and attached by camstats. More... | |
Angle | incidenceAngle () const |
Get the incidence angle of this image, as calculated and attached by camstats. More... | |
double | lineResolution () const |
Get the line resolution of this image, as calculated and attached by camstats. More... | |
Distance | localRadius () const |
Get the local radius of this image, as calculated and attached by camstats. More... | |
Angle | northAzimuth () const |
Get the north azimuth of this image, as calculated and attached by camstats. More... | |
Angle | phaseAngle () const |
Get the phase angle of this image, as calculated and attached by camstats. More... | |
double | sampleResolution () const |
Get the sample resolution of this image, as calculated and attached by camstats. More... | |
void | copyToNewProjectRoot (const Project *project, FileName newProjectRoot) |
Copy the cub/ecub files associated with this image into the new project. More... | |
void | deleteFromDisk () |
Delete the image data from disk. More... | |
void | save (QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const |
Write the Image properties out to an XML file. More... | |
Private Member Functions | |
geos::geom::MultiPolygon * | createFootprint (QMutex *cameraMutex) |
Calculates a footprint for an Image using the camera or projection information. More... | |
void | initCamStats () |
Checks to see if the Cube label contains Camera Statistics. More... | |
void | initQuickFootprint () |
Creates a default ImagePolygon option which is read into the Cube. More... | |
Image (const Image &other) | |
Image & | operator= (const Image &rhs) |
Private Attributes | |
SpiceInt * | m_bodyCode |
The NaifBodyCode value, if it exists in the labels. More... | |
Cube * | m_cube |
The cube associated with this Image. More... | |
ImageDisplayProperties * | m_displayProperties |
The GUI information for how this Image ought to be displayed. More... | |
QString | m_fileName |
The on-disk file name of the cube associated with this Image. More... | |
QString | m_instrumentId |
Instrument id associated with this Image. More... | |
QString | m_spacecraftName |
Spacecraft name associated with this Image. More... | |
geos::geom::MultiPolygon * | m_footprint |
A 0-360 ocentric lon,lat degrees footprint of this Image. More... | |
QUuid * | m_id |
A unique ID for this Image (useful for others to reference this Image when saving to disk). More... | |
double | m_aspectRatio |
Aspect ratio of the image. More... | |
double | m_resolution |
Resolution of the image. More... | |
Angle | m_emissionAngle |
Emmission angle of the image. More... | |
Angle | m_incidenceAngle |
Incidence angle of the image. More... | |
double | m_lineResolution |
Line resolution of the image. More... | |
double | m_sampleResolution |
Sample resolution of the image. More... | |
Distance | m_localRadius |
Local radius of the image. More... | |
Angle | m_northAzimuth |
North Azimuth for the image. More... | |
Angle | m_phaseAngle |
Phase angle for the image. More... | |
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.
|
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 Isis::Cube::fileName(), 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.
Isis::Image::Image | ( | FileName | imageFolder, |
XmlStackedHandlerReader * | xmlReader, | ||
QObject * | parent = 0 |
||
) |
Construct this image from XML.
imageFolder | Where this image XML resides - /work/.../projectRoot/images/import1 |
xmlReader | An XML reader that's up to an <image> tag. |
parent | The Qt-relationship parent |
Definition at line 109 of file Image.cpp.
References m_aspectRatio, m_bodyCode, m_cube, m_displayProperties, m_footprint, m_id, m_lineResolution, m_resolution, m_sampleResolution, 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 129 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 385 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 272 of file Image.cpp.
References m_cube.
Referenced by deleteFromDisk(), Isis::ImportImagesWorkOrder::importConfirmedImages(), Isis::ExportImagesWorkOrder::ProjectImageExportFunctor::operator()(), 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 483 of file Image.cpp.
References Isis::Cube::externalCubeFileName(), Isis::Project::imageDataRoot(), m_fileName, Isis::FileName::path(), and Isis::Project::projectRoot().
Referenced by Isis::ImageList::CopyImageDataFunctor::operator()().
|
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 639 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 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 254 of file Image.cpp.
References _FILEINFO_, m_cube, m_fileName, and Isis::IException::Programmer.
Referenced by createFootprint(), deleteFromDisk(), Isis::MosaicSceneItem::drawImage(), Isis::MosaicSceneItem::getPixelValue(), Isis::MosaicSceneItem::getStretch(), Image(), initCamStats(), initQuickFootprint(), Isis::CubeDnView::onItemAdded(), Isis::ExportImagesWorkOrder::ProjectImageExportFunctor::operator()(), 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 519 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().
ImageDisplayProperties * Isis::Image::displayProperties | ( | ) |
Get the display (GUI) properties (information) associated with this image.
Definition at line 285 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::MosaicSceneWidget::reprojectItems(), 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 296 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 414 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 305 of file Image.cpp.
References m_fileName.
Referenced by Isis::BundleAdjust::BundleAdjust(), Isis::ExportImagesWorkOrder::ProjectImageExportFunctor::operator()(), Isis::ImageFileListWidget::saveList(), Isis::ProjectItem::setImage(), and Isis::Image::XmlHandler::startElement().
geos::geom::MultiPolygon * Isis::Image::footprint | ( | ) |
Get the footprint of this image (if available).
Definition at line 324 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).
Definition at line 343 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 162 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.
Definition at line 394 of file Image.cpp.
References m_id.
Referenced by Isis::ImageFileListWidget::find(), Isis::ImportImagesWorkOrder::importConfirmedImages(), Isis::WorkOrder::listenForImageDestruction(), Isis::ImageFileListWidget::save(), and Isis::ImageFileListWidget::toPvl().
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 424 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 667 of file Image.cpp.
References cube(), Isis::Angle::Degrees, Isis::PvlObject::findGroup(), Isis::PvlObject::hasGroup(), Isis::PvlContainer::hasKeyword(), 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::PvlContainer::name(), Isis::PvlObject::object(), Isis::PvlObject::objects(), and Isis::Table::Records().
Referenced by Image().
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 358 of file Image.cpp.
References _FILEINFO_, 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 750 of file Image.cpp.
References cube(), m_footprint, Isis::PolygonTools::MakeMultiPolygon(), Isis::ImagePolygon::Polys(), and Isis::Cube::read().
Referenced by 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 221 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().
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 434 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 444 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 454 of file Image.cpp.
References m_northAzimuth.
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.
Definition at line 464 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 404 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 474 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 559 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(), and Isis::DisplayProperties::save().
Referenced by Isis::ImageList::save().
QString Isis::Image::serialNumber | ( | ) |
Returns the serial number of the Cube.
Definition at line 314 of file Image.cpp.
References Isis::SerialNumber::Compose(), and cube().
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 194 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 624 of file Image.cpp.
References closeCube(), Isis::Project::imageDataRoot(), and m_fileName.
|
private |
Aspect ratio of the image.
Definition at line 216 of file Image.h.
Referenced by aspectRatio(), 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 185 of file Image.h.
Referenced by closeCube(), cube(), Image(), isFootprintable(), and ~Image().
|
private |
|
private |
Emmission angle of the image.
Definition at line 218 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 195 of file Image.h.
Referenced by copyToNewProjectRoot(), cube(), deleteFromDisk(), fileName(), fromPvl(), Image(), initCamStats(), save(), toPvl(), and updateFileName().
|
private |
A 0-360 ocentric lon,lat degrees footprint of this Image.
Definition at line 210 of file Image.h.
Referenced by footprint(), Image(), initFootprint(), initQuickFootprint(), isFootprintable(), save(), and ~Image().
|
private |
|
private |
Incidence angle of the image.
Definition at line 219 of file Image.h.
Referenced by incidenceAngle(), initCamStats(), and save().
|
private |
Instrument id associated with this Image.
Definition at line 200 of file Image.h.
Referenced by initCamStats(), and save().
|
private |
Line resolution of the image.
Definition at line 220 of file Image.h.
Referenced by Image(), initCamStats(), lineResolution(), and save().
|
private |
Local radius of the image.
Definition at line 222 of file Image.h.
Referenced by initCamStats(), localRadius(), and save().
|
private |
North Azimuth for the image.
Definition at line 223 of file Image.h.
Referenced by initCamStats(), northAzimuth(), and save().
|
private |
Phase angle for the image.
Definition at line 224 of file Image.h.
Referenced by initCamStats(), phaseAngle(), and save().
|
private |
Resolution of the image.
Definition at line 217 of file Image.h.
Referenced by Image(), initCamStats(), resolution(), and save().
|
private |
Sample resolution of the image.
Definition at line 221 of file Image.h.
Referenced by Image(), initCamStats(), sampleResolution(), and save().
|
private |
Spacecraft name associated with this Image.
Definition at line 205 of file Image.h.
Referenced by initCamStats(), and save().
U.S. Department of the Interior | U.S. Geological Survey ISIS | Privacy & Disclaimers | Astrogeology Research Program To contact us, please post comments and questions on the ISIS Support Center File Modified: 07/12/2023 23:53:48 |