r326: FFTW additions, filter image generation
[ctsim.git] / include / array2dfile.h
index 21023dc3c33f83e63646ec0f4c04717a1039aaf4..22e8b6173401fe6ed3d2dec6dccc4c2211e65af5 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: array2dfile.h,v 1.12 2000/12/16 06:12:47 kevin Exp $
+**  $Id: array2dfile.h,v 1.14 2001/01/01 10:14:34 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -125,12 +125,18 @@ public:
     PIXEL_FLOAT32 = 7,
     PIXEL_FLOAT64 = 8,
   };
-
-  Array2dFile (int nx, int ny, int pixelSize, int pixelFormat = PIXEL_INVALID);
+\r
+  enum {\r
+    DATA_TYPE_INVALID = 0,\r
+    DATA_TYPE_REAL,\r
+    DATA_TYPE_COMPLEX,\r
+  };\r
+
+  Array2dFile (int nx, int ny, int pixelSize, int pixelFormat = PIXEL_INVALID, int dataType = DATA_TYPE_REAL);
   Array2dFile (void);
   ~Array2dFile ();
 
-  void setArraySize (int nx, int ny, int pixelSize, int pixelFormat = PIXEL_INVALID);
+  void setArraySize (int nx, int ny, int pixelSize, int pixelFormat = PIXEL_INVALID, int dataType = DATA_TYPE_REAL);
 
   void setArraySize (int nx, int ny);
 
@@ -158,12 +164,27 @@ public:
 
   kuint32 ny (void) const
       { return m_ny; }
+\r
+  bool isComplex() const\r
+  { return m_dataType == DATA_TYPE_COMPLEX; }\r
+\r
+  bool isReal() const\r
+  { return m_dataType == DATA_TYPE_REAL; }\r
+\r
+  int dataType () const\r
+  { return static_cast<int>(m_dataType); }\r
+\r
+  void setDataType (int dataType)\r
+  { m_dataType = dataType; }\r
 
   void setAxisIncrement (double axisIncX, double axisIncY);
 
-  void setAxisExtent (double minX, double maxX, double minY, double maxY);
+  bool reallocRealToComplex ();\r
+\r
+  bool reallocComplexToReal ();\r
 
-  void getPixelValueRange (double& pvmin, double& pvmax) const;
+  void getPixelValueRange (double& pvmin, double& pvmax) const;\r
+  void setAxisExtent (double minX, double maxX, double minY, double maxY);
       
   void doPixelOffsetScale (double offset, double scale);
 
@@ -203,8 +224,10 @@ public:
   kuint32 m_ny;
   kuint32 m_arraySize;
   labelContainer m_labels;
-  kuint16 m_numFileLabels;
+  kuint16 m_numFileLabels;\r
+  kuint16 m_dataType;
   unsigned char** m_arrayData;
+  unsigned char** m_imaginaryArrayData;\r
 
 private:
   void init (void);
@@ -223,9 +246,11 @@ private:
 
   bool labelSeek (int label_num);
 
-  void allocArray (void);
-  
-  void freeArray (void);
+  void allocArrays ();
+  void freeArrays ();
+\r
+  void allocArray (unsigned char**& rppData);\r
+  void freeArray (unsigned char**& rppData);\r
 
   Array2dFile (const Array2dFile& rhs);        // copy constructor
   Array2dFile& operator= (const Array2dFile&); // assignment operator