Isis 3 Programmer Reference
|
This represents a cube in a project-based GUI interface. More...
#include <Image.h>
Classes | |
class | XmlHandler |
Process XML in a stack-oriented fashion. 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 (Cube *imageCube, geos::geom::MultiPolygon *footprint, QString id, QObject *parent=0) | |
Create an image from a cube file on disk including the footprint. 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 | observationNumber () |
Returns the observation number of the Cube. 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_observationNumber |
The observation number for this image. More... | |
QString | m_serialNumber |
The serial number for 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()).
|
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 42 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 77 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.
|
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 111 of file Image.cpp.
References Isis::Cube::fileName(), 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 | ( | 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 141 of file Image.cpp.
References m_aspectRatio, m_bodyCode, m_cube, m_displayProperties, m_footprint, m_id, m_lineResolution, m_resolution, m_sampleResolution, Isis::Null, and Isis::XmlStackedHandlerReader::pushContentHandler().
Isis::Image::~Image | ( | ) |
Clean up this image.
If you haven't saved this image, all of its settings will be lost.
Definition at line 161 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 436 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 307 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(), 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 534 of file Image.cpp.
References Isis::Cube::copy(), Isis::Cube::externalCubeFileName(), Isis::Project::imageDataRoot(), m_fileName, Isis::FileName::name(), Isis::Project::newProjectRoot(), Isis::FileName::path(), Isis::Project::projectRoot(), Isis::FileName::setExtension(), Isis::Cube::storesDnData(), and Isis::FileName::toString().
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 706 of file Image.cpp.
References 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 287 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(), 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 586 of file Image.cpp.
References closeCube(), cube(), Isis::FileName::expanded(), 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 320 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::ImageList::CopyImageDataFunctor::operator()(), 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 331 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 465 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 340 of file Image.cpp.
References m_fileName.
Referenced by Isis::BundleAdjust::BundleAdjust(), Isis::JigsawRunWidget::on_JigsawAcceptButton_clicked(), 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 374 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 393 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 194 of file Image.cpp.
References 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 445 of file Image.cpp.
References m_id.
Referenced by Isis::Project::addImagesToIdMap(), Isis::ImageFileListWidget::find(), Isis::Project::imagesReady(), 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 475 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 734 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 409 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 817 of file Image.cpp.
References cube(), m_footprint, Isis::PolygonTools::MakeMultiPolygon(), Isis::ImagePolygon::Polys(), and Isis::Cube::readFootprint().
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 253 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(), 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 485 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 495 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 505 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 349 of file Image.cpp.
References Isis::ObservationNumber::Compose(), cube(), and m_observationNumber.
Referenced by Isis::JigsawSetupDialog::on_applySettingsPushButton_clicked(), and Isis::JigsawSetupDialog::updateBundleObservationSolveSettings().
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 515 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 455 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 525 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 626 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 361 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 226 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 691 of file Image.cpp.
References closeCube(), Isis::FileName::dir(), Isis::FileName::expanded(), Isis::Project::imageDataRoot(), m_fileName, and Isis::FileName::name().
|
private |
Aspect ratio of the image.
Definition at line 247 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 206 of file Image.h.
Referenced by closeCube(), cube(), Image(), isFootprintable(), and ~Image().
|
private |
|
private |
Emmission angle of the image.
Definition at line 249 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 216 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 241 of file Image.h.
Referenced by footprint(), Image(), initFootprint(), initQuickFootprint(), isFootprintable(), save(), and ~Image().
|
private |
|
private |
Incidence angle of the image.
Definition at line 250 of file Image.h.
Referenced by incidenceAngle(), initCamStats(), and save().
|
private |
Instrument id associated with this Image.
Definition at line 221 of file Image.h.
Referenced by initCamStats(), and save().
|
private |
Line resolution of the image.
Definition at line 251 of file Image.h.
Referenced by Image(), initCamStats(), lineResolution(), and save().
|
private |
Local radius of the image.
Definition at line 253 of file Image.h.
Referenced by initCamStats(), localRadius(), and save().
|
private |
North Azimuth for the image.
Definition at line 254 of file Image.h.
Referenced by initCamStats(), northAzimuth(), and save().
|
private |
The observation number for this image.
Definition at line 226 of file Image.h.
Referenced by observationNumber().
|
private |
Phase angle for the image.
Definition at line 255 of file Image.h.
Referenced by initCamStats(), phaseAngle(), and save().
|
private |
Resolution of the image.
Definition at line 248 of file Image.h.
Referenced by Image(), initCamStats(), resolution(), and save().
|
private |
Sample resolution of the image.
Definition at line 252 of file Image.h.
Referenced by Image(), initCamStats(), sampleResolution(), and save().
|
private |
The serial number for this image.
Definition at line 231 of file Image.h.
Referenced by serialNumber().
|
private |
Spacecraft name associated with this Image.
Definition at line 236 of file Image.h.
Referenced by initCamStats(), and save().