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"
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
35namespace Isis {
36
42 Image::Image(QString imageFileName, QObject *parent) : QObject(parent) {
43 m_bodyCode = NULL;
44 m_cube = NULL;
46 m_footprint = NULL;
47 m_id = NULL;
48
53
54 m_fileName = imageFileName;
55
56 cube();
57
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;
83 m_footprint = NULL;
84 m_id = NULL;
85
90
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
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
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
254 bool result = false;
255
256 if (m_footprint) {
257 result = true;
258 }
259
260 if (!result && m_cube) {
261 Blob example = ImagePolygon().toBlob();
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
323
324
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
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
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().release());
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") {
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") {
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 = cube()->readFootprint();
819 m_footprint = PolygonTools::MakeMultiPolygon(poly.Polys()->clone().release());
820 }
821
822
830 m_image = image;
831 m_imageFolder = imageFolder;
832 }
833
834
835
851 bool Image::XmlHandler::startElement(const QString &namespaceURI, const QString &localName,
852 const QString &qName, const QXmlAttributes &atts) {
853 m_characters = "";
854
855 if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
856 if (localName == "image") {
857 QString id = atts.value("id");
858 QString fileName = atts.value("fileName");
859 QString instrumentId = atts.value("instrumentId");
860 QString spacecraftName = atts.value("spacecraftName");
861
862 QString aspectRatioStr = atts.value("aspectRatio");
863 QString resolutionStr = atts.value("resolution");
864 QString emissionAngleStr = atts.value("emissionAngle");
865 QString incidenceAngleStr = atts.value("incidenceAngle");
866 QString lineResolutionStr = atts.value("lineResolution");
867 QString localRadiusStr = atts.value("localRadius");
868 QString northAzimuthStr = atts.value("northAzimuth");
869 QString phaseAngleStr = atts.value("phaseAngle");
870 QString sampleResolutionStr = atts.value("sampleResolution");
871
872 if (!id.isEmpty()) {
873 delete m_image->m_id;
874 m_image->m_id = NULL;
875 m_image->m_id = new QUuid(id.toLatin1());
876 }
877
878 if (!fileName.isEmpty()) {
879 m_image->m_fileName = m_imageFolder.expanded() + "/" + fileName;
880 }
881
882 if (!instrumentId.isEmpty()) {
883 m_image->m_instrumentId = instrumentId;
884 }
885
886 if (!spacecraftName.isEmpty()) {
887 m_image->m_spacecraftName = spacecraftName;
888 }
889
890 if (!aspectRatioStr.isEmpty()) {
891 m_image->m_aspectRatio = aspectRatioStr.toDouble();
892 }
893
894 if (!resolutionStr.isEmpty()) {
895 m_image->m_resolution = resolutionStr.toDouble();
896 }
897
898 if (!emissionAngleStr.isEmpty()) {
899 m_image->m_emissionAngle = Angle(emissionAngleStr.toDouble(), Angle::Radians);
900 }
901
902 if (!incidenceAngleStr.isEmpty()) {
903 m_image->m_incidenceAngle = Angle(incidenceAngleStr.toDouble(), Angle::Radians);
904 }
905
906 if (!lineResolutionStr.isEmpty()) {
907 m_image->m_lineResolution = lineResolutionStr.toDouble();
908 }
909
910 if (!localRadiusStr.isEmpty()) {
911 m_image->m_localRadius = Distance(localRadiusStr.toDouble(), Distance::Meters);
912 }
913
914 if (!northAzimuthStr.isEmpty()) {
915 m_image->m_northAzimuth = Angle(northAzimuthStr.toDouble(), Angle::Radians);
916 }
917
918 if (!phaseAngleStr.isEmpty()) {
919 m_image->m_phaseAngle = Angle(phaseAngleStr.toDouble(), Angle::Radians);
920 }
921
922 if (!sampleResolutionStr.isEmpty()) {
923 m_image->m_sampleResolution = sampleResolutionStr.toDouble();
924 }
925 }
926 else if (localName == "displayProperties") {
927 m_image->m_displayProperties = new ImageDisplayProperties(reader());
928 }
929 }
930
931 return true;
932 }
933
934
945 bool Image::XmlHandler::characters(const QString &ch) {
946 m_characters += ch;
947
948 return XmlStackedHandler::characters(ch);
949 }
950
951
963 bool Image::XmlHandler::endElement(const QString &namespaceURI, const QString &localName,
964 const QString &qName) {
965 if (localName == "footprint" && !m_characters.isEmpty()) {
966 geos::io::WKTReader wktReader(*globalFactory);
967 m_image->m_footprint = PolygonTools::MakeMultiPolygon(
968 wktReader.read(m_characters.toStdString()).release());
969 }
970 else if (localName == "image" && !m_image->m_footprint) {
971 QMutex mutex;
972 m_image->initFootprint(&mutex);
973 m_image->closeCube();
974 }
975
976 m_characters = "";
977 return XmlStackedHandler::endElement(namespaceURI, localName, qName);
978 }
979}
Defines an angle and provides unit conversions.
Definition Angle.h:45
bool isValid() const
This indicates whether we have a legitimate angle stored or are in an unset, or invalid,...
Definition Angle.cpp:95
double radians() const
Convert an angle to a double.
Definition Angle.h:226
@ Degrees
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
Definition Angle.h:56
@ Radians
Radians are generally used in mathematical equations, 0-2*PI is one circle, however these are more di...
Definition Angle.h:63
QString Type() const
Accessor method that returns a string containing the Blob type.
Definition Blob.cpp:124
Manipulate and parse attributes of output cube filenames.
IO Handler for Isis Cubes.
Definition Cube.h:168
ImagePolygon readFootprint() const
Read the footprint polygon for the Cube.
Definition Cube.cpp:872
int lineCount() const
Definition Cube.cpp:1740
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:1541
int sampleCount() const
Definition Cube.cpp:1813
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition Cube.cpp:1707
QString displayName() const
Returns the display name.
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Output format:
PvlObject toPvl() const
Convert to Pvl for project files.
Distance measurement, usually in meters.
Definition Distance.h:34
bool isValid() const
Test if this distance has been initialized or not.
Definition Distance.cpp:192
@ Meters
The distance is being specified in meters.
Definition Distance.h:43
double meters() const
Get the distance in meters.
Definition Distance.cpp:85
File name manipulation and expansion.
Definition FileName.h:100
QString path() const
Returns the path of the file name.
Definition FileName.cpp:103
QDir dir() const
Returns the path of the file's parent directory as a QDir object.
Definition FileName.cpp:465
FileName setExtension(const QString &extension) const
Sets all current file extensions to a new extension in the file name.
Definition FileName.cpp:265
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
Definition FileName.cpp:162
QString toString() const
Returns a QString of the full file name including the file path, excluding the attributes with any Is...
Definition FileName.cpp:515
Isis exception class.
Definition IException.h:91
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition IException.h:118
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition IException.h:126
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition IException.h:146
@ Io
A type of error that occurred when performing an actual I/O operation.
Definition IException.h:155
Adds specific functionality to C++ strings.
Definition IString.h:165
QString ToQt() const
Retuns the object string as a QString.
Definition IString.cpp:869
Process XML in a stack-oriented fashion.
Definition Image.h:172
Image * m_image
Pointer to the Image.
Definition Image.h:185
virtual bool characters(const QString &ch)
This implementation of a virtual function calls QXmlDefaultHandler::characters(QString &ch) which in ...
Definition Image.cpp:945
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Read mage class attributes.
Definition Image.cpp:851
FileName m_imageFolder
The Name/path of the image.
Definition Image.h:186
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:963
XmlHandler(Image *image, FileName imageFolder)
Create an XML Handler (reader) that can populate the Image class data.
Definition Image.cpp:829
This is the GUI communication mechanism for cubes.
This represents a cube in a project-based GUI interface.
Definition Image.h:107
Cube * cube()
Get the Cube pointer associated with this display property.
Definition Image.cpp:287
Angle incidenceAngle() const
Get the incidence angle of this image, as calculated and attached by camstats.
Definition Image.cpp:475
double m_sampleResolution
Sample resolution of the image.
Definition Image.h:252
void copyToNewProjectRoot(const Project *project, FileName newProjectRoot)
Copy the cub/ecub files associated with this image into the new project.
Definition Image.cpp:534
void setId(QString id)
Override the automatically generated ID with the given ID.
Definition Image.cpp:383
Distance m_localRadius
Local radius of the image.
Definition Image.h:253
Angle phaseAngle() const
Get the phase angle of this image, as calculated and attached by camstats.
Definition Image.cpp:515
QString m_instrumentId
Instrument id associated with this Image.
Definition Image.h:221
void closeCube()
Cleans up the Cube pointer.
Definition Image.cpp:307
Distance localRadius() const
Get the local radius of this image, as calculated and attached by camstats.
Definition Image.cpp:495
geos::geom::MultiPolygon * footprint()
Get the footprint of this image (if available).
Definition Image.cpp:374
SpiceInt * m_bodyCode
The NaifBodyCode value, if it exists in the labels.
Definition Image.h:195
double m_lineResolution
Line resolution of the image.
Definition Image.h:251
QString serialNumber()
Returns the serial number of the Cube.
Definition Image.cpp:361
QUuid * m_id
A unique ID for this Image (useful for others to reference this Image when saving to disk).
Definition Image.h:245
~Image()
Clean up this image.
Definition Image.cpp:161
double m_aspectRatio
Aspect ratio of the image.
Definition Image.h:247
QString m_serialNumber
The serial number for this image.
Definition Image.h:231
Angle m_incidenceAngle
Incidence angle of the image.
Definition Image.h:250
Angle emissionAngle() const
Get the emission angle of this image, as calculated and attached by camstats.
Definition Image.cpp:465
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
double lineResolution() const
Get the line resolution of this image, as calculated and attached by camstats.
Definition Image.cpp:485
bool isFootprintable() const
Test to see if it's possible to create a footprint from this image.
Definition Image.cpp:253
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Write the Image properties out to an XML file.
Definition Image.cpp:626
Angle m_emissionAngle
Emmission angle of the image.
Definition Image.h:249
double aspectRatio() const
Get the aspect ratio of this image, as calculated and attached by camstats.
Definition Image.cpp:436
QString m_fileName
The on-disk file name of the cube associated with this Image.
Definition Image.h:216
PvlObject toPvl() const
Convert this Image to PVL.
Definition Image.cpp:226
Image(QString imageFileName, QObject *parent=0)
Create an image from a cube file on disk.
Definition Image.cpp:42
Angle m_phaseAngle
Phase angle for the image.
Definition Image.h:255
QString m_spacecraftName
Spacecraft name associated with this Image.
Definition Image.h:236
double m_resolution
Resolution of the image.
Definition Image.h:248
QString m_observationNumber
The observation number for this image.
Definition Image.h:226
Cube * m_cube
The cube associated with this Image.
Definition Image.h:206
ImageDisplayProperties * displayProperties()
Get the display (GUI) properties (information) associated with this image.
Definition Image.cpp:320
Angle northAzimuth() const
Get the north azimuth of this image, as calculated and attached by camstats.
Definition Image.cpp:505
QString observationNumber()
Returns the observation number of the Cube.
Definition Image.cpp:349
Angle m_northAzimuth
North Azimuth for the image.
Definition Image.h:254
QString fileName() const
Get the file name of the cube that this image represents.
Definition Image.cpp:340
void initCamStats()
Checks to see if the Cube label contains Camera Statistics.
Definition Image.cpp:734
QString id() const
Get a unique, identifying string associated with this image.
Definition Image.cpp:445
double resolution() const
Get the resolution of this image, as calculated and attached by camstats.
Definition Image.cpp:455
void fromPvl(const PvlObject &pvl)
Read the image settings from a Pvl.
Definition Image.cpp:194
bool initFootprint(QMutex *cameraMutex)
Calculate a footprint for this image.
Definition Image.cpp:409
void deleteFromDisk()
Delete the image data from disk.
Definition Image.cpp:586
geos::geom::MultiPolygon * createFootprint(QMutex *cameraMutex)
Calculates a footprint for an Image using the camera or projection information.
Definition Image.cpp:706
ImageDisplayProperties * m_displayProperties
The GUI information for how this Image ought to be displayed.
Definition Image.h:211
geos::geom::MultiPolygon * m_footprint
A 0-360 ocentric lon,lat degrees footprint of this Image.
Definition Image.h:241
void initQuickFootprint()
Creates a default ImagePolygon option which is read into the Cube.
Definition Image.cpp:817
double sampleResolution() const
Get the sample resolution of this image, as calculated and attached by camstats.
Definition Image.cpp:525
Create cube polygons, read/write polygons to blobs.
Blob toBlob() const
Serialize the ImagePolygon to a Blob.
static QString Compose(Pvl &label, bool def2filename=false)
Compose a ObservationNumber from a PVL.
static geos::geom::MultiPolygon * MakeMultiPolygon(const geos::geom::Geometry *geom)
Make a geos::geom::MultiPolygon out of the components of the argument.
The main project for ipce.
Definition Project.h:289
QString newProjectRoot() const
Get the top-level folder of the new project.
Definition Project.cpp:1674
QString imageDataRoot() const
Accessor for the root directory of the image data.
Definition Project.cpp:2076
QString projectRoot() const
Get the top-level folder of the project.
Definition Project.cpp:1665
static QString imageDataRoot(QString projectRoot)
Appends the root directory name 'images' to the project .
Definition Project.cpp:2066
Contains multiple PvlContainers.
Definition PvlGroup.h:41
Container for cube-like labels.
Definition Pvl.h:119
A single keyword-value pair.
Definition PvlKeyword.h:87
Contains Pvl Groups and Pvl Objects.
Definition PvlObject.h:61
int objects() const
Returns the number of objects.
Definition PvlObject.h:221
PvlObject & object(const int index)
Return the object at the specified index.
static QString Compose(Pvl &label, bool def2filename=false)
Compose a SerialNumber from a PVL.
Class for storing Table blobs information.
Definition Table.h:61
Manage a stack of content handlers for reading XML files.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
const double Null
Value for an Isis Null pixel.
bool IsSpecial(const double d)
Returns if the input pixel is special.