Isis 3 Programmer Reference
Image.cpp
1 #include "Image.h"
2 
3 #include <QBuffer>
4 #include <QDataStream>
5 #include <QDebug>
6 #include <QDir>
7 #include <QFileInfo>
8 #include <QMutexLocker>
9 #include <QScopedPointer>
10 #include <QString>
11 #include <QUuid>
12 #include <QXmlStreamWriter>
13 
14 #include <geos/geom/MultiPolygon.h>
15 #include <geos/io/WKTReader.h>
16 #include <geos/io/WKTWriter.h>
17 
18 #include "Angle.h"
19 #include "Cube.h"
20 #include "CubeAttribute.h"
21 #include "DisplayProperties.h"
22 #include "Distance.h"
23 #include "FileName.h"
24 #include "ImageDisplayProperties.h"
25 #include "ImagePolygon.h"
26 #include "IString.h"
27 #include "ObservationNumber.h"
28 #include "PolygonTools.h"
29 #include "Project.h"
30 #include "SerialNumber.h"
31 #include "Target.h"
32 #include "XmlStackedHandlerReader.h"
33 
34 
35 namespace Isis {
36 
42  Image::Image(QString imageFileName, QObject *parent) : QObject(parent) {
43  m_bodyCode = NULL;
44  m_cube = NULL;
45  m_displayProperties = NULL;
46  m_footprint = NULL;
47  m_id = NULL;
48 
53 
54  m_fileName = imageFileName;
55 
56  cube();
57 
58  initCamStats();
59 
60  try {
62  }
63  catch (IException &) {
64  }
65 
67 
68  m_id = new QUuid(QUuid::createUuid());
69  }
70 
71 
77  Image::Image(Cube *imageCube, QObject *parent) : QObject(parent) {
78  m_fileName = imageCube->fileName();
79 
80  m_bodyCode = NULL;
81  m_cube = imageCube;
82  m_displayProperties = NULL;
83  m_footprint = NULL;
84  m_id = NULL;
85 
90 
91  initCamStats();
92 
93  try {
95  }
96  catch (IException &e) {
97  }
98 
100 
101  m_id = new QUuid(QUuid::createUuid());
102  }
103 
104 
111  Image::Image(Cube *imageCube, geos::geom::MultiPolygon *footprint, QString id, QObject *parent) :
112  QObject(parent) {
113  m_fileName = imageCube->fileName();
114 
115  m_bodyCode = NULL;
116  m_cube = imageCube;
117  m_displayProperties = NULL;
118  m_id = NULL;
119 
121  m_resolution = Null;
124 
125  initCamStats();
126 
128 
130 
131  setId(id);
132  }
133 
134 
141  Image::Image(FileName imageFolder, XmlStackedHandlerReader *xmlReader, QObject *parent) :
142  QObject(parent) {
143  m_bodyCode = NULL;
144  m_cube = NULL;
145  m_displayProperties = NULL;
146  m_footprint = NULL;
147  m_id = NULL;
148 
150  m_resolution = Null;
153 
154  xmlReader->pushContentHandler(new XmlHandler(this, imageFolder));
155  }
156 
157 
162  delete m_bodyCode;
163  m_bodyCode = NULL;
164 
165  delete m_cube;
166  m_cube = NULL;
167 
168  delete m_footprint;
169  m_footprint = NULL;
170 
171  delete m_id;
172  m_id = NULL;
173 
174  // Image is a "Qt" parent of display properties, so the Image QObject
175  // destructor will take care of deleting the display props. See call to
176  // DisplayProperties' constructor.
177  m_displayProperties = NULL;
178  }
179 
180 
194  void Image::fromPvl(const PvlObject &pvl) {
195  QString pvlFileName = ((IString)pvl["FileName"][0]).ToQt();
196  if (m_fileName != pvlFileName) {
198  tr("Tried to load Image [%1] with properties/information from [%2].")
199  .arg(m_fileName).arg(pvlFileName),
200  _FILEINFO_);
201  }
202 
203  displayProperties()->fromPvl(pvl.findObject("DisplayProperties"));
204 
205  if (pvl.hasKeyword("ID")) {
206  QByteArray hexValues(pvl["ID"][0].toLatin1());
207  QDataStream valuesStream(QByteArray::fromHex(hexValues));
208  valuesStream >> *m_id;
209  }
210  }
211 
212 
227  PvlObject output("Image");
228 
229  output += PvlKeyword("FileName", m_fileName);
230 
231  // Do m_id
232  QBuffer dataBuffer;
233  dataBuffer.open(QIODevice::ReadWrite);
234 
235  QDataStream idStream(&dataBuffer);
236  idStream << *m_id;
237 
238  dataBuffer.seek(0);
239 
240  output += PvlKeyword("ID", QString(dataBuffer.data().toHex()));
241 
242  output += displayProperties()->toPvl();
243 
244  return output;
245  }
246 
247 
253  bool Image::isFootprintable() const {
254  bool result = false;
255 
256  if (m_footprint)
257  result = true;
258 
259  if (!result && m_cube) {
260  // TODO: Move this to Blob!
261  ImagePolygon example;
262 
263  QString blobType = example.Type();
264  QString blobName = example.Name();
265 
266  Pvl &labels = *m_cube->label();
267 
268  for (int i = 0; i < labels.objects(); i++) {
269  PvlObject &obj = labels.object(i);
270 
271  if (obj.isNamed(blobType) && obj.hasKeyword("Name") && obj["Name"][0] == blobName)
272  result = true;
273  }
274  }
275 
276  return result;
277  }
278 
279 
288  if (!m_cube) {
289  try {
290  m_cube = new Cube(m_fileName);
291  }
292  catch (IException &e) {
293  throw IException(e, IException::Programmer, "Cube cannot be created", _FILEINFO_);
294  }
295  }
296 
297  return m_cube;
298  }
299 
300 
308  if (m_cube) {
309  delete m_cube;
310  m_cube = NULL;
311  }
312  }
313 
314 
321  return m_displayProperties;
322  }
323 
324 
332  return m_displayProperties;
333  }
334 
335 
340  QString Image::fileName() const {
341  return m_fileName;
342  }
343 
344 
350  if (m_observationNumber.isEmpty()) {
352  }
353  return m_observationNumber;
354  }
355 
356 
362  if (m_serialNumber.isEmpty()) {
364  }
365  return m_serialNumber;
366  }
367 
368 
374  geos::geom::MultiPolygon *Image::footprint() {
375  return m_footprint;
376  }
377 
378 
383  void Image::setId(QString id) {
384  m_id = new QUuid(id);
385  }
386 
387 
393  const geos::geom::MultiPolygon *Image::footprint() const {
394  return m_footprint;
395  }
396 
397 
409  bool Image::initFootprint(QMutex *cameraMutex) {
410  if (!m_footprint) {
411  try {
413  }
414  catch (IException &e) {
415  try {
416  m_footprint = createFootprint(cameraMutex);
417  }
418  catch (IException &e) {
419  IString msg = "Could not read the footprint from cube [" +
420  displayProperties()->displayName() + "]. Please make "
421  "sure footprintinit has been run";
422  throw IException(e, IException::Io, msg, _FILEINFO_);
423  }
424  }
425  }
426 
427  // I'm not sure how this could ever be NULL. -SL
428  return (m_footprint != NULL);
429  }
430 
431 
436  double Image::aspectRatio() const {
437  return m_aspectRatio;
438  }
439 
440 
445  QString Image::id() const {
446  return m_id->toString().remove(QRegExp("[{}]"));
447  }
448 
449 
455  double Image::resolution() const {
456  return m_resolution;
457  }
458 
459 
466  return m_emissionAngle;
467  }
468 
469 
476  return m_incidenceAngle;
477  }
478 
479 
485  double Image::lineResolution() const {
486  return m_lineResolution;
487  }
488 
489 
496  return m_localRadius;
497  }
498 
499 
506  return m_northAzimuth;
507  }
508 
509 
516  return m_phaseAngle;
517  }
518 
519 
525  double Image::sampleResolution() const {
526  return m_sampleResolution;
527  }
528 
529 
534  void Image::copyToNewProjectRoot(const Project *project, FileName newProjectRoot) {
535  if (FileName(newProjectRoot) != FileName(project->projectRoot())) {
536  Cube origImage(m_fileName);
537 
538  // The imageDataRoot will either be PROJECTROOT/images or PROJECTROOT/results/bundle/timestamp/images,
539  // depending on how the newProjectRoot points to.
540  FileName newExternalLabelFileName(Project::imageDataRoot(newProjectRoot.toString()) + "/" +
541  FileName(m_fileName).dir().dirName() + "/" + FileName(m_fileName).name());
542 
543  if (m_fileName != newExternalLabelFileName.toString()) {
544  // This cube copy creates a filename w/ecub extension in the new project root, but looks to
545  // be a cube(internal vs external). It changes the DnFile pointer to the old ecub,
546  // /tmp/tsucharski_ipce/tmpProject/images/import1/AS15-.ecub, but doing a less on file
547  // immediately after the following call indicates it is a binary file.
548  QScopedPointer<Cube> newExternalLabel(
549  origImage.copy(newExternalLabelFileName, CubeAttributeOutput("+External")));
550 
551  // If this is an ecub (it should be) and is pointing to a relative file name,
552  // then we want to copy the DN cube also.
553  if (!origImage.storesDnData() ) {
554  if (origImage.externalCubeFileName().path() == ".") {
555  Cube dnFile(
556  FileName(m_fileName).path() + "/" + origImage.externalCubeFileName().name());
557  FileName newDnFileName = newExternalLabelFileName.setExtension("cub");
558  QScopedPointer<Cube> newDnFile(dnFile.copy(newDnFileName, CubeAttributeOutput()));
559  newDnFile->close();
560  // Changes the ecube's DnFile pointer in the labels.
561  newExternalLabel->relocateDnData(newDnFileName.name());
562  }
563  else {
564  // If the the ecub's external cube is pointing to the old project root, update to new
565  // project root.
566  if (origImage.externalCubeFileName().toString().contains(project->projectRoot())) {
567  QString newExternalCubeFileName = origImage.externalCubeFileName().toString();
568  newExternalCubeFileName.replace(project->projectRoot(), project->newProjectRoot());
569  newExternalLabel->relocateDnData(newExternalCubeFileName);
570  }
571  else {
572  newExternalLabel->relocateDnData(origImage.externalCubeFileName());
573  }
574  }
575  }
576  }
577  }
578  }
579 
580 
587  bool deleteCubAlso = (cube()->externalCubeFileName().path() == ".");
588  closeCube();
589 
590  if (!QFile::remove(m_fileName)) {
592  tr("Could not remove file [%1]").arg(m_fileName),
593  _FILEINFO_);
594  }
595 
596  if (deleteCubAlso) {
597  FileName cubFile = FileName(m_fileName).setExtension("cub");
598  if (!QFile::remove(cubFile.expanded() ) ) {
600  tr("Could not remove file [%1]").arg(m_fileName),
601  _FILEINFO_);
602  }
603  }
604 
605  // If we're the last thing in the folder, remove the folder too.
606  QDir dir;
607  dir.rmdir(FileName(m_fileName).path());
608  }
609 
610 
626  void Image::save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot)
627  const {
628  stream.writeStartElement("image");
629 
630  stream.writeAttribute("id", m_id->toString());
631  stream.writeAttribute("fileName", FileName(m_fileName).name());
632  stream.writeAttribute("instrumentId", m_instrumentId);
633  stream.writeAttribute("spacecraftName", m_spacecraftName);
634 
635  if (!IsSpecial(m_aspectRatio) ) {
636  stream.writeAttribute("aspectRatio", IString(m_aspectRatio).ToQt());
637  }
638 
639  if (!IsSpecial(m_resolution) ) {
640  stream.writeAttribute("resolution", IString(m_resolution).ToQt());
641  }
642 
643  if (m_emissionAngle.isValid() ) {
644  stream.writeAttribute("emissionAngle", IString(m_emissionAngle.radians()).ToQt());
645  }
646 
647  if (m_incidenceAngle.isValid() ) {
648  stream.writeAttribute("incidenceAngle", IString(m_incidenceAngle.radians()).ToQt());
649  }
650 
651  if (!IsSpecial(m_lineResolution) ) {
652  stream.writeAttribute("lineResolution", IString(m_lineResolution).ToQt());
653  }
654 
655  if (m_localRadius.isValid() ) {
656  stream.writeAttribute("localRadius", IString(m_localRadius.meters()).ToQt());
657  }
658 
659  if (m_northAzimuth.isValid() ) {
660  stream.writeAttribute("northAzimuth", IString(m_northAzimuth.radians()).ToQt());
661  }
662 
663  if (m_phaseAngle.isValid() ) {
664  stream.writeAttribute("phaseAngle", IString(m_phaseAngle.radians()).ToQt());
665  }
666 
667  if (!IsSpecial(m_sampleResolution) ) {
668  stream.writeAttribute("sampleResolution", IString(m_sampleResolution).ToQt());
669  }
670 
671  if (m_footprint) {
672  stream.writeStartElement("footprint");
673 
674  geos::io::WKTWriter wktWriter;
675  stream.writeCharacters(QString::fromStdString(wktWriter.write(m_footprint)));
676 
677  stream.writeEndElement();
678  }
679 
680  m_displayProperties->save(stream, project, newProjectRoot);
681 
682  stream.writeEndElement();
683  }
684 
685 
692  closeCube();
693 
694  FileName original(m_fileName);
695  FileName newName(project->imageDataRoot() + "/" +
696  original.dir().dirName() + "/" + original.name());
697  m_fileName = newName.expanded();
698  }
699 
700 
706  geos::geom::MultiPolygon *Image::createFootprint(QMutex *cameraMutex) {
707  QMutexLocker lock(cameraMutex);
708 
709  // We need to walk the image to create the polygon...
710  ImagePolygon imgPoly;
711 
712  int sampleStepSize = cube()->sampleCount() / 10;
713  if (sampleStepSize <= 0) sampleStepSize = 1;
714 
715  int lineStepSize = cube()->lineCount() / 10;
716  if (lineStepSize <= 0) lineStepSize = 1;
717 
718  imgPoly.Create(*cube(), sampleStepSize, lineStepSize);
719 
721  tr("Warning: Polygon re-calculated for [%1] which can be very slow")
722  .arg(displayProperties()->displayName()),
723  _FILEINFO_);
724  e.print();
725 
726  return PolygonTools::MakeMultiPolygon(imgPoly.Polys()->clone());
727  }
728 
729 
735  bool hasCamStats = false;
736 
737  Pvl &label = *cube()->label();
738  for (int i = 0; !hasCamStats && i < label.objects(); i++) {
739  PvlObject &obj = label.object(i);
740 
741  try {
742  if (obj.name() == "Table") {
743  if (obj["Name"][0] == "CameraStatistics") {
744  hasCamStats = true;
745  }
746  }
747  }
748  catch (IException &) {
749  }
750  }
751 
752  if (hasCamStats) {
753  Table camStatsTable("CameraStatistics", m_fileName, label);
754 
755  int numRecords = camStatsTable.Records();
756  for (int recordIndex = 0; recordIndex < numRecords; recordIndex++) {
757  TableRecord &record = camStatsTable[recordIndex];
758 
759  // The TableField class gives us a std::string with NULL (\0) characters... be careful not
760  // to keep them when going to QString.
761  QString recordName((QString)record["Name"]);
762  double avgValue = (double)record["Average"];
763 
764  if (recordName == "AspectRatio") {
765  m_aspectRatio = avgValue;
766  }
767  else if (recordName == "Resolution") {
768  m_resolution = avgValue;
769  }
770  else if (recordName == "EmissionAngle") {
771  m_emissionAngle = Angle(avgValue, Angle::Degrees);
772  }
773  else if (recordName == "IncidenceAngle") {
775  }
776  else if (recordName == "LineResolution") {
777  m_lineResolution = avgValue;
778  }
779  else if (recordName == "LocalRadius") {
781  }
782  else if (recordName == "NorthAzimuth") {
783  m_northAzimuth = Angle(avgValue, Angle::Degrees);
784  }
785  else if (recordName == "PhaseAngle") {
786  m_phaseAngle = Angle(avgValue, Angle::Degrees);
787  }
788  else if (recordName == "SampleResolution") {
789  m_sampleResolution = avgValue;
790  }
791  }
792  }
793 
794  for (int i = 0; i < label.objects(); i++) {
795  PvlObject &obj = label.object(i);
796  try {
797  if (obj.hasGroup("Instrument")) {
798  PvlGroup instGroup = obj.findGroup("Instrument");
799 
800  if (instGroup.hasKeyword("SpacecraftName"))
801  m_spacecraftName = obj.findGroup("Instrument")["SpacecraftName"][0];
802 
803  if (instGroup.hasKeyword("InstrumentId"))
804  m_instrumentId = obj.findGroup("Instrument")["InstrumentId"][0];
805  }
806  }
807  catch (IException &) {
808  }
809  }
810  }
811 
812 
818  ImagePolygon poly;
819  cube()->read(poly);
821  }
822 
823 
831  m_image = image;
832  m_imageFolder = imageFolder;
833  }
834 
835 
836 
852  bool Image::XmlHandler::startElement(const QString &namespaceURI, const QString &localName,
853  const QString &qName, const QXmlAttributes &atts) {
854  m_characters = "";
855 
856  if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
857  if (localName == "image") {
858  QString id = atts.value("id");
859  QString fileName = atts.value("fileName");
860  QString instrumentId = atts.value("instrumentId");
861  QString spacecraftName = atts.value("spacecraftName");
862 
863  QString aspectRatioStr = atts.value("aspectRatio");
864  QString resolutionStr = atts.value("resolution");
865  QString emissionAngleStr = atts.value("emissionAngle");
866  QString incidenceAngleStr = atts.value("incidenceAngle");
867  QString lineResolutionStr = atts.value("lineResolution");
868  QString localRadiusStr = atts.value("localRadius");
869  QString northAzimuthStr = atts.value("northAzimuth");
870  QString phaseAngleStr = atts.value("phaseAngle");
871  QString sampleResolutionStr = atts.value("sampleResolution");
872 
873  if (!id.isEmpty()) {
874  delete m_image->m_id;
875  m_image->m_id = NULL;
876  m_image->m_id = new QUuid(id.toLatin1());
877  }
878 
879  if (!fileName.isEmpty()) {
880  m_image->m_fileName = m_imageFolder.expanded() + "/" + fileName;
881  }
882 
883  if (!instrumentId.isEmpty()) {
884  m_image->m_instrumentId = instrumentId;
885  }
886 
887  if (!spacecraftName.isEmpty()) {
888  m_image->m_spacecraftName = spacecraftName;
889  }
890 
891  if (!aspectRatioStr.isEmpty()) {
892  m_image->m_aspectRatio = aspectRatioStr.toDouble();
893  }
894 
895  if (!resolutionStr.isEmpty()) {
896  m_image->m_resolution = resolutionStr.toDouble();
897  }
898 
899  if (!emissionAngleStr.isEmpty()) {
900  m_image->m_emissionAngle = Angle(emissionAngleStr.toDouble(), Angle::Radians);
901  }
902 
903  if (!incidenceAngleStr.isEmpty()) {
904  m_image->m_incidenceAngle = Angle(incidenceAngleStr.toDouble(), Angle::Radians);
905  }
906 
907  if (!lineResolutionStr.isEmpty()) {
908  m_image->m_lineResolution = lineResolutionStr.toDouble();
909  }
910 
911  if (!localRadiusStr.isEmpty()) {
912  m_image->m_localRadius = Distance(localRadiusStr.toDouble(), Distance::Meters);
913  }
914 
915  if (!northAzimuthStr.isEmpty()) {
916  m_image->m_northAzimuth = Angle(northAzimuthStr.toDouble(), Angle::Radians);
917  }
918 
919  if (!phaseAngleStr.isEmpty()) {
920  m_image->m_phaseAngle = Angle(phaseAngleStr.toDouble(), Angle::Radians);
921  }
922 
923  if (!sampleResolutionStr.isEmpty()) {
924  m_image->m_sampleResolution = sampleResolutionStr.toDouble();
925  }
926  }
927  else if (localName == "displayProperties") {
928  m_image->m_displayProperties = new ImageDisplayProperties(reader());
929  }
930  }
931 
932  return true;
933  }
934 
935 
946  bool Image::XmlHandler::characters(const QString &ch) {
947  m_characters += ch;
948 
949  return XmlStackedHandler::characters(ch);
950  }
951 
952 
964  bool Image::XmlHandler::endElement(const QString &namespaceURI, const QString &localName,
965  const QString &qName) {
966  if (localName == "footprint" && !m_characters.isEmpty()) {
967  geos::io::WKTReader wktReader(&globalFactory);
968  m_image->m_footprint = PolygonTools::MakeMultiPolygon(
969  wktReader.read(m_characters.toStdString()));
970  }
971  else if (localName == "image" && !m_image->m_footprint) {
972  QMutex mutex;
973  m_image->initFootprint(&mutex);
974  m_image->closeCube();
975  }
976 
977  m_characters = "";
978  return XmlStackedHandler::endElement(namespaceURI, localName, qName);
979  }
980 }
PvlObject & object(const int index)
Return the object at the specified index.
Definition: PvlObject.cpp:460
int Records() const
Returns the number of records.
Definition: Table.cpp:224
QString path() const
Returns the path of the file name.
Definition: FileName.cpp:119
double meters() const
Get the distance in meters.
Definition: Distance.cpp:97
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
void initQuickFootprint()
Creates a default ImagePolygon option which is read into the Cube.
Definition: Image.cpp:817
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:110
The main project for ipce.
Definition: Project.h:289
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
bool storesDnData() const
This method returns a boolean value.
Definition: Cube.cpp:1549
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:691
File name manipulation and expansion.
Definition: FileName.h:116
~Image()
Clean up this image.
Definition: Image.cpp:161
QString m_instrumentId
Instrument id associated with this Image.
Definition: Image.h:221
void deleteFromDisk()
Delete the image data from disk.
Definition: Image.cpp:586
int objects() const
Returns the number of objects.
Definition: PvlObject.h:231
QUuid * m_id
A unique ID for this Image (useful for others to reference this Image when saving to disk)...
Definition: Image.h:245
PvlObject toPvl() const
Convert to Pvl for project files.
double radians() const
Convert an angle to a double.
Definition: Angle.h:243
PvlObject toPvl() const
Convert this Image to PVL.
Definition: Image.cpp:226
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
int sampleCount() const
Definition: Cube.cpp:1452
Distance m_localRadius
Local radius of the image.
Definition: Image.h:253
Image * m_image
Pointer to the Image.
Definition: Image.h:185
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
Definition: FileName.cpp:178
QString displayName() const
Returns the display name.
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
Angle emissionAngle() const
Get the emission angle of this image, as calculated and attached by camstats.
Definition: Image.cpp:465
double m_resolution
Resolution of the image.
Definition: Image.h:248
QString imageDataRoot() const
Accessor for the root directory of the image data.
Definition: Project.cpp:2077
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:162
A type of error that occurred when performing an actual I/O operation.
Definition: IException.h:171
Angle m_northAzimuth
North Azimuth for the image.
Definition: Image.h:254
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.
Angle m_emissionAngle
Emmission angle of the image.
Definition: Image.h:249
void setId(QString id)
Override the automatically generated ID with the given ID.
Definition: Image.cpp:383
double m_aspectRatio
Aspect ratio of the image.
Definition: Image.h:247
QString m_spacecraftName
Spacecraft name associated with this Image.
Definition: Image.h:236
Create cube polygons, read/write polygons to blobs.
Definition: ImagePolygon.h:167
Cube * m_cube
The cube associated with this Image.
Definition: Image.h:206
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
static QString Compose(Pvl &label, bool def2filename=false)
Compose a SerialNumber from a PVL.
Angle phaseAngle() const
Get the phase angle of this image, as calculated and attached by camstats.
Definition: Image.cpp:515
QString name() const
Returns the container name.
Definition: PvlContainer.h:77
void copyToNewProjectRoot(const Project *project, FileName newProjectRoot)
Copy the cub/ecub files associated with this image into the new project.
Definition: Image.cpp:534
SpiceInt * m_bodyCode
The NaifBodyCode value, if it exists in the labels.
Definition: Image.h:195
This is the GUI communication mechanism for cubes.
static QString Compose(Pvl &label, bool def2filename=false)
Compose a ObservationNumber from a PVL.
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Read mage class attributes.
Definition: Image.cpp:852
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
Definition: Angle.h:73
Angle m_phaseAngle
Phase angle for the image.
Definition: Image.h:255
Angle m_incidenceAngle
Incidence angle of the image.
Definition: Image.h:250
double sampleResolution() const
Get the sample resolution of this image, as calculated and attached by camstats.
Definition: Image.cpp:525
QString m_fileName
The on-disk file name of the cube associated with this Image.
Definition: Image.h:216
double lineResolution() const
Get the line resolution of this image, as calculated and attached by camstats.
Definition: Image.cpp:485
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
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Output format:
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
Image(QString imageFileName, QObject *parent=0)
Create an image from a cube file on disk.
Definition: Image.cpp:42
QString m_serialNumber
The serial number for this image.
Definition: Image.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:142
A single keyword-value pair.
Definition: PvlKeyword.h:98
virtual void pushContentHandler(XmlStackedHandler *newHandler)
Push a contentHandler and maybe continue parsing...
virtual bool characters(const QString &ch)
This implementation of a virtual function calls QXmlDefaultHandler::characters(QString &ch) which in ...
Definition: Image.cpp:946
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:134
void read(Blob &blob) const
This method will read data from the specified Blob object.
Definition: Cube.cpp:724
double m_lineResolution
Line resolution of the image.
Definition: Image.h:251
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:212
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:212
This represents a cube in a project-based GUI interface.
Definition: Image.h:107
Cube * copy(FileName newFile, const CubeAttributeOutput &newFileAttributes)
Copies the cube to the new fileName.
Definition: Cube.cpp:193
bool isValid() const
Test if this distance has been initialized or not.
Definition: Distance.cpp:204
ImageDisplayProperties * displayProperties()
Get the display (GUI) properties (information) associated with this image.
Definition: Image.cpp:320
QString projectRoot() const
Get the top-level folder of the project.
Definition: Project.cpp:1666
QDir dir() const
Returns the path of the file&#39;s parent directory as a QDir object.
Definition: FileName.cpp:481
Container for cube-like labels.
Definition: Pvl.h:135
QString newProjectRoot() const
Get the top-level folder of the new project.
Definition: Project.cpp:1675
ImageDisplayProperties * m_displayProperties
The GUI information for how this Image ought to be displayed.
Definition: Image.h:211
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:964
QString observationNumber()
Returns the observation number of the Cube.
Definition: Image.cpp:349
Defines an angle and provides unit conversions.
Definition: Angle.h:62
bool isNamed(const QString &match) const
Returns whether the given string is equal to the container name or not.
Definition: PvlContainer.h:86
bool isFootprintable() const
Test to see if it&#39;s possible to create a footprint from this image.
Definition: Image.cpp:253
Angle northAzimuth() const
Get the north azimuth of this image, as calculated and attached by camstats.
Definition: Image.cpp:505
void print() const
Prints a string representation of this exception to stderr.
Definition: IException.cpp:461
void initCamStats()
Checks to see if the Cube label contains Camera Statistics.
Definition: Image.cpp:734
QString Name() const
Accessor method that returns a string containing the Blob name.
Definition: Blob.cpp:149
QString toString() const
Returns a QString of the full file name including the file path, excluding the attributes with any Is...
Definition: FileName.cpp:531
FileName m_imageFolder
The Name/path of the image.
Definition: Image.h:186
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1346
Class for storing Table blobs information.
Definition: Table.h:77
bool initFootprint(QMutex *cameraMutex)
Calculate a footprint for this image.
Definition: Image.cpp:409
double resolution() const
Get the resolution of this image, as calculated and attached by camstats.
Definition: Image.cpp:455
double m_sampleResolution
Sample resolution of the image.
Definition: Image.h:252
virtual QString fileName() const
Returns the opened cube&#39;s filename.
Definition: Cube.cpp:1208
Distance localRadius() const
Get the local radius of this image, as calculated and attached by camstats.
Definition: Image.cpp:495
QString id() const
Get a unique, identifying string associated with this image.
Definition: Image.cpp:445
XmlHandler(Image *image, FileName imageFolder)
Create an XML Handler (reader) that can populate the Image class data.
Definition: Image.cpp:830
int lineCount() const
Definition: Cube.cpp:1379
QString serialNumber()
Returns the serial number of the Cube.
Definition: Image.cpp:361
Isis exception class.
Definition: IException.h:107
FileName setExtension(const QString &extension) const
Sets all current file extensions to a new extension in the file name.
Definition: FileName.cpp:281
geos::geom::MultiPolygon * footprint()
Get the footprint of this image (if available).
Definition: Image.cpp:374
Adds specific functionality to C++ strings.
Definition: IString.h:181
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Cube * cube()
Get the Cube pointer associated with this display property.
Definition: Image.cpp:287
Process XML in a stack-oriented fashion.
Definition: Image.h:172
QString m_observationNumber
The observation number for this image.
Definition: Image.h:226
The distance is being specified in meters.
Definition: Distance.h:56
bool isValid() const
This indicates whether we have a legitimate angle stored or are in an unset, or invalid, state.
Definition: Angle.cpp:110
Radians are generally used in mathematical equations, 0-2*PI is one circle, however these are more di...
Definition: Angle.h:80
double aspectRatio() const
Get the aspect ratio of this image, as calculated and attached by camstats.
Definition: Image.cpp:436
static QString imageDataRoot(QString projectRoot)
Appends the root directory name &#39;images&#39; to the project .
Definition: Project.cpp:2067
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:194
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
Angle incidenceAngle() const
Get the incidence angle of this image, as calculated and attached by camstats.
Definition: Image.cpp:475
Manage a stack of content handlers for reading XML files.
QString Type() const
Accessor method that returns a string containing the Blob type.
Definition: Blob.cpp:140
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Write the Image properties out to an XML file.
Definition: Image.cpp:626
geos::geom::MultiPolygon * m_footprint
A 0-360 ocentric lon,lat degrees footprint of this Image.
Definition: Image.h:241
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:1180
void closeCube()
Cleans up the Cube pointer.
Definition: Image.cpp:307
QString fileName() const
Get the file name of the cube that this image represents.
Definition: Image.cpp:340
geos::geom::MultiPolygon * createFootprint(QMutex *cameraMutex)
Calculates a footprint for an Image using the camera or projection information.
Definition: Image.cpp:706
IO Handler for Isis Cubes.
Definition: Cube.h:170