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 // This is needed for the QVariant macro
00027 #include <QMetaType>
00028 
00029 #include "Endian.h"
00030 #include "PixelType.h"
00031 
00032 class QFile;
00033 class QMutex;
00034 
00035 namespace Isis {
00036   class Blob;
00037   class Buffer;
00038   class Camera;
00039   class CubeCachingAlgorithm;
00040   class CubeIoHandler;
00041   class iString;
00042   class Projection;
00043   class Pvl;
00044   class PvlGroup;
00045   class Statistics;
00046   class Histogram;
00047 
00133   class Cube {
00134     public:
00135       Cube();
00136       virtual ~Cube();
00137 
00142       enum Format {
00163         Bsq,
00196         Tile
00197       };
00198 
00199       bool isOpen() const;
00200       bool isProjected() const;
00201       bool isReadOnly() const;
00202       bool isReadWrite() const;
00203       bool labelsAttached() const;
00204 
00205       void close(bool remove = false);
00206       void create(const iString &cfile);
00207       void open(const iString &cfile, iString access = "r");
00208       void reopen(iString access = "r");
00209 
00210       void read(Blob &blob) const;
00211       void read(Buffer &rbuf);
00212       void write(Blob &blob);
00213       void write(Buffer &wbuf);
00214 
00215       void setBaseMultiplier(double base, double mult);
00216       void setMinMax(double min, double max);
00217       void setByteOrder(ByteOrder byteOrder);
00218       void setDimensions(int ns, int nl, int nb);
00219       void setFormat(Format format);
00220       void setLabelsAttached(bool attached);
00221       void setLabelSize(int labelBytes);
00222       void setPixelType(PixelType pixelType);
00223       void setVirtualBands(const QList<iString> &vbands);
00224       void setVirtualBands(const std::vector<std::string> &vbands);
00225 
00226       int getBandCount() const;
00227       double getBase() const;
00228       ByteOrder getByteOrder() const;
00229       Camera *getCamera();
00230       iString getFilename() const;
00231       Format getFormat() const;
00232       Histogram *getHistogram(const int &band = 1,
00233                                iString msg = "Gathering histogram");
00234       Histogram *getHistogram(const int &band, const double &validMin,
00235                                const double &validMax,
00236                                iString msg = "Gathering histogram");
00237       Pvl *getLabel() const;
00238       int getLabelSize(bool actual = false) const;
00239       int getLineCount() const;
00240       double getMultiplier() const;
00241       PixelType getPixelType() const;
00242       int getPhysicalBand(const int &virtualBand) const;
00243       Projection *getProjection();
00244       int getSampleCount() const;
00245       Statistics *getStatistics(const int &band = 1,
00246                                  iString msg = "Gathering statistics");
00247       Statistics *getStatistics(const int &band, const double &validMin,
00248                                  const double &validMax,
00249                                  iString msg = "Gathering statistics");
00250 
00251       void addCachingAlgorithm(CubeCachingAlgorithm *);
00252       void clearIoCache();
00253       bool deleteBlob(iString BlobType, iString BlobName);
00254       void deleteGroup(const iString &group);
00255       PvlGroup &getGroup(const iString &group) const;
00256       bool hasGroup(const iString &group) const;
00257       bool hasTable(const iString &name);
00258       void putGroup(PvlGroup &group);
00259 
00260     private:
00261       void cleanUp(bool remove);
00262       QFile *getDataFile() const;
00263       void initialize();
00264       void openCheck();
00265       void reformatOldIsisLabel(const iString &oldCube);
00266       void writeLabels();
00267 
00268     private:
00277       QFile *m_labelFile;
00283       QFile *m_dataFile;
00284 
00289       CubeIoHandler *m_ioHandler;
00290 
00296       ByteOrder m_byteOrder;
00297 
00303       Format m_format;
00304 
00310       PixelType m_pixelType;
00311 
00313       QMutex *m_mutex;
00314 
00316       Camera *m_camera;
00317 
00319       Projection *m_projection;
00320 
00322       iString *m_labelFilename;
00323 
00325       iString *m_dataFilename;
00326 
00332       iString *m_tempCube;
00333 
00335       iString *m_formatTemplateFile;
00336 
00338       bool m_attached;
00339 
00341       Pvl *m_label;
00342 
00344       int m_labelBytes;
00345 
00347       int m_samples;
00348 
00350       int m_lines;
00351 
00353       int m_bands;
00354 
00359       double m_base;
00360 
00365       double m_multiplier;
00366 
00368       QList<int> *m_virtualBandList;
00369   };
00370 }
00371 
00372 Q_DECLARE_METATYPE(Isis::Cube *);
00373 
00374 #endif
00375