USGS

Isis 3.0 Developer's Reference (API)

Home

Cube.h

Go to the documentation of this file.
00001 #ifndef Cube_h
00002 #define Cube_h
00003 
00026 #include <vector>
00027 
00028 // This is needed for the QVariant macro
00029 #include <QMetaType>
00030 
00031 #include "Endian.h"
00032 #include "PixelType.h"
00033 
00034 class QFile;
00035 class QMutex;
00036 class QString;
00037 
00038 namespace Isis {
00039   class Blob;
00040   class Buffer;
00041   class Camera;
00042   class CubeAttributeOutput;
00043   class CubeCachingAlgorithm;
00044   class CubeIoHandler;
00045   class FileName;
00046   class Projection;
00047   class Pvl;
00048   class PvlGroup;
00049   class Statistics;
00050   class Histogram;
00051 
00137   class Cube {
00138     public:
00139       Cube();
00140       virtual ~Cube();
00141 
00146       enum Format {
00167         Bsq,
00200         Tile
00201       };
00202 
00203       bool isOpen() const;
00204       bool isProjected() const;
00205       bool isReadOnly() const;
00206       bool isReadWrite() const;
00207       bool labelsAttached() const;
00208 
00209       void close(bool remove = false);
00210       Cube *copy(FileName newFile, const CubeAttributeOutput &newFileAttributes) const;
00211       void create(const QString &cfile);
00212       void create(const QString &cfile, const CubeAttributeOutput &att);
00213       void open(const QString &cfile, QString access = "r");
00214       void reopen(QString access = "r");
00215 
00216       void read(Blob &blob) const;
00217       void read(Buffer &rbuf) const;
00218       void write(Blob &blob);
00219       void write(Buffer &wbuf);
00220 
00221       void setBaseMultiplier(double base, double mult);
00222       void setMinMax(double min, double max);
00223       void setByteOrder(ByteOrder byteOrder);
00224       void setDimensions(int ns, int nl, int nb);
00225       void setExternalDnData(FileName cubeFileWithDnData);
00226       void setFormat(Format format);
00227       void setLabelsAttached(bool attached);
00228       void setLabelSize(int labelBytes);
00229       void setPixelType(PixelType pixelType);
00230       void setVirtualBands(const QList<QString> &vbands);
00231       void setVirtualBands(const std::vector<QString> &vbands);
00232 
00233       int bandCount() const;
00234       double base() const;
00235       ByteOrder byteOrder() const;
00236       Camera *camera();
00237       QString fileName() const;
00238       Format format() const;
00239       Histogram *histogram(const int &band = 1,
00240                            QString msg = "Gathering histogram");
00241       Histogram *histogram(const int &band, const double &validMin,
00242                            const double &validMax,
00243                            QString msg = "Gathering histogram");
00244       Pvl *label() const;
00245       int labelSize(bool actual = false) const;
00246       int lineCount() const;
00247       double multiplier() const;
00248       PixelType pixelType() const;
00249       int physicalBand(const int &virtualBand) const;
00250       Projection *projection();
00251       int sampleCount() const;
00252       Statistics *statistics(const int &band = 1,
00253                              QString msg = "Gathering statistics");
00254       Statistics *statistics(const int &band, const double &validMin,
00255                              const double &validMax,
00256                              QString msg = "Gathering statistics");
00257       bool storesDnData() const;
00258 
00259       void addCachingAlgorithm(CubeCachingAlgorithm *);
00260       void clearIoCache();
00261       bool deleteBlob(QString BlobType, QString BlobName);
00262       void deleteGroup(const QString &group);
00263       PvlGroup &group(const QString &group) const;
00264       bool hasGroup(const QString &group) const;
00265       bool hasTable(const QString &name);
00266       void putGroup(const PvlGroup &group);
00267 
00268     private:
00269       void applyVirtualBandsToLabel();
00270       void cleanUp(bool remove);
00271       QFile *dataFile() const;
00272       FileName realDataFileName() const;
00273       void initialize();
00274       void initCoreFromLabel(const Pvl &label);
00275       void initLabelFromFile(FileName labelFileName, bool readWrite);
00276       void openCheck();
00277       Pvl realDataFileLabel() const;
00278       void reformatOldIsisLabel(const QString &oldCube);
00279       void writeLabels();
00280 
00281     private:
00290       QFile *m_labelFile;
00296       QFile *m_dataFile;
00297 
00302       CubeIoHandler *m_ioHandler;
00303 
00309       ByteOrder m_byteOrder;
00310 
00316       Format m_format;
00317 
00323       PixelType m_pixelType;
00324 
00326       QMutex *m_mutex;
00327 
00329       Camera *m_camera;
00330 
00332       Projection *m_projection;
00333 
00335       FileName *m_labelFileName;
00336 
00338       FileName *m_dataFileName;
00339 
00345       FileName *m_tempCube;
00346 
00348       FileName *m_formatTemplateFile;
00349 
00351       bool m_attached;
00352 
00358       bool m_storesDnData;
00359 
00361       Pvl *m_label;
00362 
00364       int m_labelBytes;
00365 
00367       int m_samples;
00368 
00370       int m_lines;
00371 
00373       int m_bands;
00374 
00379       double m_base;
00380 
00385       double m_multiplier;
00386 
00388       QList<int> *m_virtualBandList;
00389   };
00390 }
00391 
00393 Q_DECLARE_METATYPE(Isis::Cube *);
00394 
00395 #endif
00396