Isis 3.0 Programmer Reference
Back | Home
Image.cpp
1 #include "Image.h"
2 
3 #include <QBuffer>
4 #include <QDataStream>
5 #include <QDir>
6 #include <QFileInfo>
7 #include <QMutexLocker>
8 #include <QScopedPointer>
9 #include <QString>
10 #include <QUuid>
11 #include <QXmlStreamWriter>
12 
13 #include <geos/geom/MultiPolygon.h>
14 #include <geos/io/WKTReader.h>
15 #include <geos/io/WKTWriter.h>
16 
17 #include "Angle.h"
18 #include "Cube.h"
19 #include "CubeAttribute.h"
20 #include "DisplayProperties.h"
21 #include "Distance.h"
22 #include "FileName.h"
23 #include "ImageDisplayProperties.h"
24 #include "ImagePolygon.h"
25 #include "IString.h"
26 #include "PolygonTools.h"
27 #include "Project.h"
28 #include "SerialNumber.h"
29 #include "Target.h"
30 #include "XmlStackedHandlerReader.h"
31 
32 
33 namespace Isis {
34 
40  Image::Image(QString imageFileName, QObject *parent) : QObject(parent) {
41  m_bodyCode = NULL;
42  m_cube = NULL;
43  m_displayProperties = NULL;
44  m_footprint = NULL;
45  m_id = NULL;
46 
51 
52  m_fileName = imageFileName;
53 
54  cube();
55 
56  initCamStats();
57 
58  try {
60  }
61  catch (IException &) {
62  }
63 
65 
66  m_id = new QUuid(QUuid::createUuid());
67  }
68 
69 
75  Image::Image(Cube *imageCube, QObject *parent) : QObject(parent) {
76  m_fileName = imageCube->fileName();
77 
78  m_bodyCode = NULL;
79  m_cube = imageCube;
80  m_displayProperties = NULL;
81  m_footprint = NULL;
82  m_id = NULL;
83 
88 
89  initCamStats();
90 
91  try {
93  }
94  catch (IException &e) {
95  }
96 
98 
99  m_id = new QUuid(QUuid::createUuid());
100  }
101 
102 
109  Image::Image(FileName imageFolder, XmlStackedHandlerReader *xmlReader, QObject *parent) :
110  QObject(parent) {
111  m_bodyCode = NULL;
112  m_cube = NULL;
113  m_displayProperties = NULL;
114  m_footprint = NULL;
115  m_id = NULL;
116 
118  m_resolution = Null;
121 
122  xmlReader->pushContentHandler(new XmlHandler(this, imageFolder));
123  }
124 
125 
130  delete m_bodyCode;
131  m_bodyCode = NULL;
132 
133  delete m_cube;
134  m_cube = NULL;
135 
136  delete m_footprint;
137  m_footprint = NULL;
138 
139  delete m_id;
140  m_id = NULL;
141 
142  // Image is a "Qt" parent of display properties, so the Image QObject
143  // destructor will take care of deleting the display props. See call to
144  // DisplayProperties' constructor.
145  m_displayProperties = NULL;
146  }
147 
148 
162  void Image::fromPvl(const PvlObject &pvl) {
163  QString pvlFileName = ((IString)pvl["FileName"][0]).ToQt();
164  if (m_fileName != pvlFileName) {
166  tr("Tried to load Image [%1] with properties/information from [%2].")
167  .arg(m_fileName).arg(pvlFileName),
168  _FILEINFO_);
169  }
170 
171  displayProperties()->fromPvl(pvl.findObject("DisplayProperties"));
172 
173  if (pvl.hasKeyword("ID")) {
174  QByteArray hexValues(pvl["ID"][0].toLatin1());
175  QDataStream valuesStream(QByteArray::fromHex(hexValues));
176  valuesStream >> *m_id;
177  }
178  }
179 
180 
195  PvlObject output("Image");
196 
197  output += PvlKeyword("FileName", m_fileName);
198 
199  // Do m_id
200  QBuffer dataBuffer;
201  dataBuffer.open(QIODevice::ReadWrite);
202 
203  QDataStream idStream(&dataBuffer);
204  idStream << *m_id;
205 
206  dataBuffer.seek(0);
207 
208  output += PvlKeyword("ID", QString(dataBuffer.data().toHex()));
209 
210  output += displayProperties()->toPvl();
211 
212  return output;
213  }
214 
215 
221  bool Image::isFootprintable() const {
222  bool result = false;
223 
224  if (m_footprint)
225  result = true;
226 
227  if (!result && m_cube) {
228  // TODO: Move this to Blob!
229  ImagePolygon example;
230 
231  QString blobType = example.Type();
232  QString blobName = example.Name();
233 
234  Pvl &labels = *m_cube->label();
235 
236  for (int i = 0; i < labels.objects(); i++) {
237  PvlObject &obj = labels.object(i);
238 
239  if (obj.isNamed(blobType) && obj.hasKeyword("Name") && obj["Name"][0] == blobName)
240  result = true;
241  }
242  }
243 
244  return result;
245  }
246 
247 
255  if (!m_cube) {
256  try {
257  m_cube = new Cube(m_fileName);
258  }
259  catch (IException &e) {
260  throw IException(e, IException::Programmer, "Cube cannot be created", _FILEINFO_);
261  }
262  }
263 
264  return m_cube;
265  }
266 
267 
273  if (m_cube) {
274  delete m_cube;
275  m_cube = NULL;
276  }
277  }
278 
279 
286  return m_displayProperties;
287  }
288 
289 
297  return m_displayProperties;
298  }
299 
300 
305  QString Image::fileName() const {
306  return m_fileName;
307  }
308 
309 
315  return SerialNumber::Compose(*(cube()));
316  }
317 
318 
324  geos::geom::MultiPolygon *Image::footprint() {
325  return m_footprint;
326  }
327 
328 
333  void Image::setId(QString id) {
334  *m_id = QUuid(QString("{%1}").arg(id));
335  }
336 
337 
343  const geos::geom::MultiPolygon *Image::footprint() const {
344  return m_footprint;
345  }
346 
347 
358  bool Image::initFootprint(QMutex *cameraMutex) {
359  if (!m_footprint) {
360  try {
362  }
363  catch (IException &e) {
364  try {
365  m_footprint = createFootprint(cameraMutex);
366  }
367  catch (IException &e) {
368  IString msg = "Could not read the footprint from cube [" +
369  displayProperties()->displayName() + "]. Please make "
370  "sure footprintinit has been run";
371  throw IException(e, IException::Io, msg, _FILEINFO_);
372  }
373  }
374  }
375 
376  // I'm not sure how this could ever be NULL. -SL
377  return (m_footprint != NULL);
378  }
379 
380 
385  double Image::aspectRatio() const {
386  return m_aspectRatio;
387  }
388 
389 
394  QString Image::id() const {
395  return m_id->toString().remove(QRegExp("[{}]"));
396  }
397 
398 
404  double Image::resolution() const {
405  return m_resolution;
406  }
407 
408 
415  return m_emissionAngle;
416  }
417 
418 
425  return m_incidenceAngle;
426  }
427 
428 
434  double Image::lineResolution() const {
435  return m_lineResolution;
436  }
437 
438 
445  return m_localRadius;
446  }
447 
448 
455  return m_northAzimuth;
456  }
457 
458 
465  return m_phaseAngle;
466  }
467 
468 
474  double Image::sampleResolution() const {
475  return m_sampleResolution;
476  }
477 
478 
483  void Image::copyToNewProjectRoot(const Project *project, FileName newProjectRoot) {
484  if (FileName(newProjectRoot) != FileName(project->projectRoot())) {
485  Cube origImage(m_fileName);
486 
487  FileName newExternalLabelFileName(Project::imageDataRoot(newProjectRoot.toString()) + "/" +
488  FileName(m_fileName).dir().dirName() + "/" + FileName(m_fileName).name());
489 
490  QScopedPointer<Cube> newExternalLabel(
491  origImage.copy(newExternalLabelFileName, CubeAttributeOutput("+External")));
492 
493  // If this is an ecub (it should be) and is pointing to a relative file name,
494  // then we want to copy the DN cube also.
495  if (!origImage.storesDnData() ) {
496  if (origImage.externalCubeFileName().path() == ".") {
497  Cube dnFile(
498  FileName(m_fileName).path() + "/" + origImage.externalCubeFileName().name());
499 
500  FileName newDnFileName = newExternalLabelFileName.setExtension("cub");
501 
502  QScopedPointer<Cube> newDnFile(dnFile.copy(newDnFileName, CubeAttributeOutput()));
503  newDnFile->close();
504  newExternalLabel->relocateDnData(newDnFileName.name());
505  }
506  else {
507  newExternalLabel->relocateDnData(origImage.externalCubeFileName());
508  }
509  }
510  }
511  }
512 
513 
520  bool deleteCubAlso = (cube()->externalCubeFileName().path() == ".");
521  closeCube();
522 
523  if (!QFile::remove(m_fileName)) {
525  tr("Could not remove file [%1]").arg(m_fileName),
526  _FILEINFO_);
527  }
528 
529  if (deleteCubAlso) {
530  FileName cubFile = FileName(m_fileName).setExtension("cub");
531  if (!QFile::remove(cubFile.expanded() ) ) {
533  tr("Could not remove file [%1]").arg(m_fileName),
534  _FILEINFO_);
535  }
536  }
537 
538  // If we're the last thing in the folder, remove the folder too.
539  QDir dir;
540  dir.rmdir(FileName(m_fileName).path());
541  }
542 
543 
559  void Image::save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot)
560  const {
561  stream.writeStartElement("image");
562 
563  stream.writeAttribute("id", m_id->toString());
564  stream.writeAttribute("fileName", FileName(m_fileName).name());
565  stream.writeAttribute("instrumentId", m_instrumentId);
566  stream.writeAttribute("spacecraftName", m_spacecraftName);
567 
568  if (!IsSpecial(m_aspectRatio) ) {
569  stream.writeAttribute("aspectRatio", IString(m_aspectRatio).ToQt());
570  }
571 
572  if (!IsSpecial(m_resolution) ) {
573  stream.writeAttribute("resolution", IString(m_resolution).ToQt());
574  }
575 
576  if (m_emissionAngle.isValid() ) {
577  stream.writeAttribute("emissionAngle", IString(m_emissionAngle.radians()).ToQt());
578  }
579 
580  if (m_incidenceAngle.isValid() ) {
581  stream.writeAttribute("incidenceAngle", IString(m_incidenceAngle.radians()).ToQt());
582  }
583 
584  if (!IsSpecial(m_lineResolution) ) {
585  stream.writeAttribute("lineResolution", IString(m_lineResolution).ToQt());
586  }
587 
588  if (m_localRadius.isValid() ) {
589  stream.writeAttribute("localRadius", IString(m_localRadius.meters()).ToQt());
590  }
591 
592  if (m_northAzimuth.isValid() ) {
593  stream.writeAttribute("northAzimuth", IString(m_northAzimuth.radians()).ToQt());
594  }
595 
596  if (m_phaseAngle.isValid() ) {
597  stream.writeAttribute("phaseAngle", IString(m_phaseAngle.radians()).ToQt());
598  }
599 
600  if (!IsSpecial(m_sampleResolution) ) {
601  stream.writeAttribute("sampleResolution", IString(m_sampleResolution).ToQt());
602  }
603 
604  if (m_footprint) {
605  stream.writeStartElement("footprint");
606 
607  geos::io::WKTWriter wktWriter;
608  stream.writeCharacters(QString::fromStdString(wktWriter.write(m_footprint)));
609 
610  stream.writeEndElement();
611  }
612 
613  m_displayProperties->save(stream, project, newProjectRoot);
614 
615  stream.writeEndElement();
616  }
617 
618 
625  closeCube();
626 
627  FileName original(m_fileName);
628  FileName newName(project->imageDataRoot() + "/" +
629  original.dir().dirName() + "/" + original.name());
630  m_fileName = newName.expanded();
631  }
632 
633 
639  geos::geom::MultiPolygon *Image::createFootprint(QMutex *cameraMutex) {
640  QMutexLocker lock(cameraMutex);
641 
642  // We need to walk the image to create the polygon...
643  ImagePolygon imgPoly;
644 
645  int sampleStepSize = cube()->sampleCount() / 10;
646  if (sampleStepSize <= 0) sampleStepSize = 1;
647 
648  int lineStepSize = cube()->lineCount() / 10;
649  if (lineStepSize <= 0) lineStepSize = 1;
650 
651  imgPoly.Create(*cube(), sampleStepSize, lineStepSize);
652 
654  tr("Warning: Polygon re-calculated for [%1] which can be very slow")
655  .arg(displayProperties()->displayName()),
656  _FILEINFO_);
657  e.print();
658 
659  return PolygonTools::MakeMultiPolygon(imgPoly.Polys()->clone());
660  }
661 
662 
668  bool hasCamStats = false;
669 
670  Pvl &label = *cube()->label();
671  for (int i = 0; !hasCamStats && i < label.objects(); i++) {
672  PvlObject &obj = label.object(i);
673 
674  try {
675  if (obj.name() == "Table") {
676  if (obj["Name"][0] == "CameraStatistics") {
677  hasCamStats = true;
678  }
679  }
680  }
681  catch (IException &) {
682  }
683  }
684 
685  if (hasCamStats) {
686  Table camStatsTable("CameraStatistics", m_fileName, label);
687 
688  int numRecords = camStatsTable.Records();
689  for (int recordIndex = 0; recordIndex < numRecords; recordIndex++) {
690  TableRecord &record = camStatsTable[recordIndex];
691 
692  // The TableField class gives us a std::string with NULL (\0) characters... be careful not
693  // to keep them when going to QString.
694  QString recordName((QString)record["Name"]);
695  double avgValue = (double)record["Average"];
696 
697  if (recordName == "AspectRatio") {
698  m_aspectRatio = avgValue;
699  }
700  else if (recordName == "Resolution") {
701  m_resolution = avgValue;
702  }
703  else if (recordName == "EmissionAngle") {
704  m_emissionAngle = Angle(avgValue, Angle::Degrees);
705  }
706  else if (recordName == "IncidenceAngle") {
708  }
709  else if (recordName == "LineResolution") {
710  m_lineResolution = avgValue;
711  }
712  else if (recordName == "LocalRadius") {
714  }
715  else if (recordName == "NorthAzimuth") {
716  m_northAzimuth = Angle(avgValue, Angle::Degrees);
717  }
718  else if (recordName == "PhaseAngle") {
719  m_phaseAngle = Angle(avgValue, Angle::Degrees);
720  }
721  else if (recordName == "SampleResolution") {
722  m_sampleResolution = avgValue;
723  }
724  }
725  }
726 
727  for (int i = 0; i < label.objects(); i++) {
728  PvlObject &obj = label.object(i);
729  try {
730  if (obj.hasGroup("Instrument")) {
731  PvlGroup instGroup = obj.findGroup("Instrument");
732 
733  if (instGroup.hasKeyword("SpacecraftName"))
734  m_spacecraftName = obj.findGroup("Instrument")["SpacecraftName"][0];
735 
736  if (instGroup.hasKeyword("InstrumentId"))
737  m_instrumentId = obj.findGroup("Instrument")["InstrumentId"][0];
738  }
739  }
740  catch (IException &) {
741  }
742  }
743  }
744 
745 
751  ImagePolygon poly;
752  cube()->read(poly);
754  }
755 
756 
764  m_image = image;
765  m_imageFolder = imageFolder;
766  }
767 
768 
769 
783  bool Image::XmlHandler::startElement(const QString &namespaceURI, const QString &localName,
784  const QString &qName, const QXmlAttributes &atts) {
785  m_characters = "";
786 
787  if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
788  if (localName == "image") {
789  QString id = atts.value("id");
790  QString fileName = atts.value("fileName");
791  QString instrumentId = atts.value("instrumentId");
792  QString spacecraftName = atts.value("spacecraftName");
793 
794  QString aspectRatioStr = atts.value("aspectRatio");
795  QString resolutionStr = atts.value("resolution");
796  QString emissionAngleStr = atts.value("emissionAngle");
797  QString incidenceAngleStr = atts.value("incidenceAngle");
798  QString lineResolutionStr = atts.value("lineResolution");
799  QString localRadiusStr = atts.value("localRadius");
800  QString northAzimuthStr = atts.value("northAzimuth");
801  QString phaseAngleStr = atts.value("phaseAngle");
802  QString sampleResolutionStr = atts.value("sampleResolution");
803 
804  if (!id.isEmpty()) {
805  delete m_image->m_id;
806  m_image->m_id = NULL;
807  m_image->m_id = new QUuid(id.toLatin1());
808  }
809 
810  if (!fileName.isEmpty()) {
811  m_image->m_fileName = m_imageFolder.expanded() + "/" + fileName;
812  }
813 
814  if (!instrumentId.isEmpty()) {
815  m_image->m_instrumentId = m_imageFolder.expanded() + "/" + instrumentId;
816  }
817 
818  if (!spacecraftName.isEmpty()) {
819  m_image->m_spacecraftName = m_imageFolder.expanded() + "/" + spacecraftName;
820  }
821 
822  if (!aspectRatioStr.isEmpty()) {
823  m_image->m_aspectRatio = aspectRatioStr.toDouble();
824  }
825 
826  if (!resolutionStr.isEmpty()) {
827  m_image->m_resolution = resolutionStr.toDouble();
828  }
829 
830  if (!emissionAngleStr.isEmpty()) {
831  m_image->m_emissionAngle = Angle(emissionAngleStr.toDouble(), Angle::Radians);
832  }
833 
834  if (!incidenceAngleStr.isEmpty()) {
835  m_image->m_incidenceAngle = Angle(incidenceAngleStr.toDouble(), Angle::Radians);
836  }
837 
838  if (!lineResolutionStr.isEmpty()) {
839  m_image->m_lineResolution = lineResolutionStr.toDouble();
840  }
841 
842  if (!localRadiusStr.isEmpty()) {
843  m_image->m_localRadius = Distance(localRadiusStr.toDouble(), Distance::Meters);
844  }
845 
846  if (!northAzimuthStr.isEmpty()) {
847  m_image->m_northAzimuth = Angle(northAzimuthStr.toDouble(), Angle::Radians);
848  }
849 
850  if (!phaseAngleStr.isEmpty()) {
851  m_image->m_phaseAngle = Angle(phaseAngleStr.toDouble(), Angle::Radians);
852  }
853 
854  if (!sampleResolutionStr.isEmpty()) {
855  m_image->m_sampleResolution = sampleResolutionStr.toDouble();
856  }
857  }
858  else if (localName == "displayProperties") {
859  m_image->m_displayProperties = new ImageDisplayProperties(reader());
860  }
861  }
862 
863  return true;
864  }
865 
866 
877  bool Image::XmlHandler::characters(const QString &ch) {
878  m_characters += ch;
879 
880  return XmlStackedHandler::characters(ch);
881  }
882 
883 
895  bool Image::XmlHandler::endElement(const QString &namespaceURI, const QString &localName,
896  const QString &qName) {
897  if (localName == "footprint" && !m_characters.isEmpty()) {
898  geos::io::WKTReader wktReader(&globalFactory);
899  m_image->m_footprint = PolygonTools::MakeMultiPolygon(
900  wktReader.read(m_characters.toStdString()));
901  }
902  else if (localName == "image" && !m_image->m_footprint) {
903  QMutex mutex;
904  m_image->initFootprint(&mutex);
905  m_image->closeCube();
906  }
907 
908  m_characters = "";
909  return XmlStackedHandler::endElement(namespaceURI, localName, qName);
910  }
911 }
912 
913 
PvlObject & object(const int index)
Return the object at the specified index.
Definition: PvlObject.cpp:460
PvlObject toPvl() const
Convert to Pvl for project files.
Angle incidenceAngle() const
Get the incidence angle of this image, as calculated and attached by camstats.
Definition: Image.cpp:424
int Records() const
Returns the number of records.
Definition: Table.cpp:224
void initQuickFootprint()
Creates a default ImagePolygon option which is read into the Cube.
Definition: Image.cpp:750
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:109
The main project for cnetsuite.
Definition: Project.h:105
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
QString id() const
Get a unique, identifying string associated with this image.
Definition: Image.cpp:394
Angle emissionAngle() const
Get the emission angle of this image, as calculated and attached by camstats.
Definition: Image.cpp:414
void updateFileName(Project *)
Change the on-disk file name for this cube to be where the image ought to be in the given project...
Definition: Image.cpp:624
File name manipulation and expansion.
Definition: FileName.h:111
FileName externalCubeFileName() const
If this is an external cube label file, this will give you the cube dn file that this label reference...
Definition: Cube.cpp:1132
~Image()
Clean up this image.
Definition: Image.cpp:129
QString m_instrumentId
Instrument id associated with this Image.
Definition: Image.h:200
void deleteFromDisk()
Delete the image data from disk.
Definition: Image.cpp:519
double radians() const
Convert an angle to a double.
Definition: Angle.h:239
QUuid * m_id
A unique ID for this Image (useful for others to reference this Image when saving to disk)...
Definition: Image.h:214
QString fileName() const
Get the file name of the cube that this image represents.
Definition: Image.cpp:305
bool isFootprintable() const
Test to see if it&#39;s possible to create a footprint from this image.
Definition: Image.cpp:221
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Definition: PvlObject.h:286
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1298
Distance m_localRadius
Local radius of the image.
Definition: Image.h:222
Image * m_image
Pointer to the Image.
Definition: Image.h:164
double sampleResolution() const
Get the sample resolution of this image, as calculated and attached by camstats.
Definition: Image.cpp:474
double lineResolution() const
Get the line resolution of this image, as calculated and attached by camstats.
Definition: Image.cpp:434
double m_resolution
Resolution of the image.
Definition: Image.h:217
void read(Blob &blob) const
This method will read data from the specified Blob object.
Definition: Cube.cpp:686
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:154
A type of error that occurred when performing an actual I/O operation.
Definition: IException.h:163
Angle m_northAzimuth
North Azimuth for the image.
Definition: Image.h:223
Distance measurement, usually in meters.
Definition: Distance.h:47
void Create(Cube &cube, int sinc=1, int linc=1, int ss=1, int sl=1, int ns=0, int nl=0, int band=1, bool increasePrecision=false)
Create a Polygon from given cube.
Distance localRadius() const
Get the local radius of this image, as calculated and attached by camstats.
Definition: Image.cpp:444
Angle m_emissionAngle
Emmission angle of the image.
Definition: Image.h:218
void setId(QString id)
Override the automatically generated ID with the given ID.
Definition: Image.cpp:333
double m_aspectRatio
Aspect ratio of the image.
Definition: Image.h:216
QString m_spacecraftName
Spacecraft name associated with this Image.
Definition: Image.h:205
Create cube polygons, read/write polygons to blobs.
Definition: ImagePolygon.h:167
Cube * m_cube
The cube associated with this Image.
Definition: Image.h:185
static QString Compose(Pvl &label, bool def2filename=false)
Compose a SerialNumber from a PVL.
bool hasKeyword(const QString &kname, FindOptions opts) const
See if a keyword is in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within ...
Definition: PvlObject.cpp:207
void copyToNewProjectRoot(const Project *project, FileName newProjectRoot)
Copy the cub/ecub files associated with this image into the new project.
Definition: Image.cpp:483
PvlObject toPvl() const
Convert this Image to PVL.
Definition: Image.cpp:194
SpiceInt * m_bodyCode
The NaifBodyCode value, if it exists in the labels.
Definition: Image.h:174
int sampleCount() const
Definition: Cube.cpp:1404
This is the GUI communication mechanism for cubes.
double meters() const
Get the distance in meters.
Definition: Distance.cpp:97
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
The XML reader invokes this method at the start of every element in the XML document.
Definition: Image.cpp:783
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
Definition: Angle.h:69
Angle m_phaseAngle
Phase angle for the image.
Definition: Image.h:224
Angle m_incidenceAngle
Incidence angle of the image.
Definition: Image.h:219
QString displayName() const
Returns the display name.
QString m_fileName
The on-disk file name of the cube associated with this Image.
Definition: Image.h:195
static geos::geom::MultiPolygon * MakeMultiPolygon(const geos::geom::Geometry *geom)
Make a geos::geom::MultiPolygon out of the components of the argument.
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:38
void print() const
Prints a string representation of this exception to stderr.
Definition: IException.cpp:461
bool isValid() const
Test if this distance has been initialized or not.
Definition: Distance.cpp:204
Image(QString imageFileName, QObject *parent=0)
Create an image from a cube file on disk.
Definition: Image.cpp:40
int objects() const
Returns the number of objects.
Definition: PvlObject.h:231
Manipulate and parse attributes of output cube filenames.
A type of error that could only have occurred due to a mistake on the user&#39;s part (e...
Definition: IException.h:134
A single keyword-value pair.
Definition: PvlKeyword.h:98
virtual bool characters(const QString &ch)
This implementation of a virtual function calls QXmlDefaultHandler::characters(QString &amp;ch) which in ...
Definition: Image.cpp:877
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:126
double aspectRatio() const
Get the aspect ratio of this image, as calculated and attached by camstats.
Definition: Image.cpp:385
QString Type() const
Accessor method that returns a string containing the Blob type.
Definition: Blob.cpp:140
double m_lineResolution
Line resolution of the image.
Definition: Image.h:220
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:199
This represents a cube in a project-based GUI interface.
Definition: Image.h:91
ImageDisplayProperties * displayProperties()
Get the display (GUI) properties (information) associated with this image.
Definition: Image.cpp:285
Container for cube-like labels.
Definition: Pvl.h:135
double resolution() const
Get the resolution of this image, as calculated and attached by camstats.
Definition: Image.cpp:404
bool isValid() const
This indicates whether we have a legitimate angle stored or are in an unset, or invalid, state.
Definition: Angle.cpp:110
ImageDisplayProperties * m_displayProperties
The GUI information for how this Image ought to be displayed.
Definition: Image.h:190
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
The XML reader invokes this method at the end of every element in the XML document.
Definition: Image.cpp:895
Angle northAzimuth() const
Get the north azimuth of this image, as calculated and attached by camstats.
Definition: Image.cpp:454
Defines an angle and provides unit conversions.
Definition: Angle.h:58
void initCamStats()
Checks to see if the Cube label contains Camera Statistics.
Definition: Image.cpp:667
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Write the Image properties out to an XML file.
Definition: Image.cpp:559
FileName m_imageFolder
The Name/path of the image.
Definition: Image.h:165
Class for storing Table blobs information.
Definition: Table.h:74
bool initFootprint(QMutex *cameraMutex)
Calculate a footprint for this image.
Definition: Image.cpp:358
QString Name() const
Accessor method that returns a string containing the Blob name.
Definition: Blob.cpp:149
double m_sampleResolution
Sample resolution of the image.
Definition: Image.h:221
XmlHandler(Image *image, FileName imageFolder)
Create an XML Handler (reader) that can populate the Image class data.
Definition: Image.cpp:763
QString serialNumber()
Returns the serial number of the Cube.
Definition: Image.cpp:314
Isis exception class.
Definition: IException.h:99
geos::geom::MultiPolygon * footprint()
Get the footprint of this image (if available).
Definition: Image.cpp:324
Adds specific functionality to C++ strings.
Definition: IString.h:179
Cube * cube()
Get the Cube pointer associated with this display property.
Definition: Image.cpp:254
Child class for XmlStackedHandler which is used to process XML in a stack-oriented way...
Definition: Image.h:151
bool isNamed(const QString &match) const
Returns whether the given string is equal to the container name or not.
Definition: PvlContainer.h:87
QString fileName() const
Returns the opened cube&#39;s filename.
Definition: Cube.cpp:1160
The distance is being specified in meters.
Definition: Distance.h:56
bool hasGroup(const QString &name) const
Returns a boolean value based on whether the object has the specified group or not.
Definition: PvlObject.h:222
Radians are generally used in mathematical equations, 0-2*PI is one circle, however these are more di...
Definition: Angle.h:76
static QString imageDataRoot(QString projectRoot)
Appends the root directory name &#39;images&#39; to the project .
Definition: Project.cpp:1260
geos::geom::MultiPolygon * Polys()
Return a geos Multipolygon.
Definition: ImagePolygon.h:221
void fromPvl(const PvlObject &pvl)
Read the image settings from a Pvl.
Definition: Image.cpp:162
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
int lineCount() const
Definition: Cube.cpp:1331
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Output format:
QString path() const
Returns the path.
Definition: FileName.cpp:88
his enables stack-based XML parsing of XML files.
QString projectRoot() const
Get the top-level folder of the project.
Definition: Project.cpp:1087
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Angle phaseAngle() const
Get the phase angle of this image, as calculated and attached by camstats.
Definition: Image.cpp:464
geos::geom::MultiPolygon * m_footprint
A 0-360 ocentric lon,lat degrees footprint of this Image.
Definition: Image.h:210
QString name() const
Returns the container name.
Definition: PvlContainer.h:78
void closeCube()
Cleans up the Cube pointer.
Definition: Image.cpp:272
QString imageDataRoot() const
Accessor for the root directory of the image data.
Definition: Project.cpp:1270
geos::geom::MultiPolygon * createFootprint(QMutex *cameraMutex)
Calculates a footprint for an Image using the camera or projection information.
Definition: Image.cpp:639
IO Handler for Isis Cubes.
Definition: Cube.h:158

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:19:57