X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=include%2Fimagefile.h;h=7c6c84a93782d6aea4f2f96a24d30c3f901ba808;hb=08f34bf3ba14d4f436f4d2ef0ee5af1d6eb266ac;hp=3b1882f24e7d64e3ce06c404d32cfa31a740b66f;hpb=7ef485116d6859eb1e31753b3e3a89de44985272;p=ctsim.git diff --git a/include/imagefile.h b/include/imagefile.h index 3b1882f..7c6c84a 100644 --- a/include/imagefile.h +++ b/include/imagefile.h @@ -15,11 +15,6 @@ using namespace std; class Array2dFileLabel { -private: - void init (void); - Array2dFileLabel (const Array2dFileLabel&); - Array2dFileLabel& operator= (const Array2dFileLabel&); - public: kfloat64 m_calcTime; kuint16 m_labelType; @@ -60,6 +55,11 @@ public: { m_strLabel = str; return (m_strLabel); } const string& getDateString () const; + +private: + void init (void); + Array2dFileLabel (const Array2dFileLabel&); + Array2dFileLabel& operator= (const Array2dFileLabel&); }; @@ -68,14 +68,6 @@ class Array2dFile { private: void init (void); - kuint16 signature; - kuint16 num_labels; - kuint16 headersize; - string filename; - int file_id; - frnetorderstream *m_pFS; - bool bHeaderWritten; - bool bDataWritten; bool headerWrite (void); @@ -85,6 +77,19 @@ private: bool labelSeek (unsigned int label_num); + Array2dFile (const Array2dFile& rhs); // copy constructor + Array2dFile& operator= (const Array2dFile&); // assignment operator + + protected: + kuint16 signature; + kuint16 num_labels; + kuint16 headersize; + string filename; + int file_id; + frnetorderstream *m_pFS; + bool bHeaderWritten; + bool bDataWritten; + kuint16 mPixelSize; kuint16 axis_increment_known; kfloat64 mIncX, mIncY; @@ -95,8 +100,6 @@ private: kuint32 mNX; kuint32 mNY; - Array2dFile (const Array2dFile&); - Array2dFile& operator= (const Array2dFile&); public: @@ -148,6 +151,8 @@ public: void doPixelOffsetScale (double offset, double scale); + void printLabels (ostream& os); + T** getArray (void) const { return (array.getArray()); } @@ -618,6 +623,28 @@ Array2dFile::arrayDataClear (void) } } +template +void +Array2dFile::printLabels (ostream& os) +{ + int nlabels = getNumLabels(); + + for (int i = 0; i < nlabels; i++) { + Array2dFileLabel label; + labelRead (label, i); + + if (label.getLabelType() == Array2dFileLabel::L_HISTORY) { + os << "History: " << endl; + os << " " << label.getLabelString() << endl; + os << " calc time = " << label.getCalcTime() << " secs" << endl; + os << " Timestamp = " << label.getDateString() << endl; + } else if (label.getLabelType() == Array2dFileLabel::L_USER) { + os << "Note: " << label.getLabelString() << endl; + os << " Timestamp = %s" << label.getDateString() << endl; + } + os << endl; + } +} #ifdef HAVE_MPI #include @@ -648,6 +675,10 @@ public: MPI::Datatype getMPIDataType (void) const { return MPI::FLOAT; } #endif + + private: + F32Image (const F32Image& rhs); //copy constructor + F32Image& operator= (const F32Image& rhs); // assignment operator }; @@ -677,26 +708,55 @@ class F64Image : public Array2dFile MPI::Datatype getMPIDataType (void) const { return MPI::DOUBLE; } #endif + private: + F64Image (const F64Image& rhs); //copy constructor + F64Image& operator= (const F64Image& rhs); // assignment operator }; #undef IMAGEFILE_64_BITS #ifdef IMAGEFILE_64_BITS -typedef F64Image ImageFile; +typedef F64Image ImageFileBase; typedef kfloat64 ImageFileValue; typedef kfloat64* ImageFileColumn; typedef kfloat64** ImageFileArray; #else -typedef F32Image ImageFile; +typedef F32Image ImageFileBase; typedef kfloat32 ImageFileValue; typedef kfloat32* ImageFileColumn; typedef kfloat32** ImageFileArray; #endif -// imagefile.cpp -void image_filter_response (ImageFile& im, const char* const domainName, double bw, const char* const filterName, double filt_param, const int opt_trace); -int image_display (const ImageFile& im); -int image_display_scale (const ImageFile& im, const int scale, const double pmin, const double pmax); +class ImageFile : public ImageFileBase +{ + public: + ImageFile (const char* const fname, unsigned int nx, unsigned int ny) + : ImageFileBase (fname, nx, ny) + {} + + ImageFile (unsigned int nx, unsigned int ny) + : ImageFileBase (nx, ny) + {} + + ImageFile (const char* const fname) + : ImageFileBase (fname) + {} + + void filterResponse (const char* const domainName, double bw, const char* const filterName, double filt_param); + + void statistics (double& min, double& max, double& mean, double& mode, double& median, double& stddev) const; + + void printStatistics (ostream& os) const; + + bool comparativeStatistics (const ImageFile& imComp, double& d, double& r, double& e) const; + + bool printComparativeStatistics (const ImageFile& imComp, ostream& os) const; + + int display (void); + + int displayScaling (const int scaleFactor, ImageFileValue pmin, ImageFileValue pmax); + +}; #endif