casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QtWCBox.h
Go to the documentation of this file.
1 //# QtWCBox.h: Class to define a box shaped WC region
2 //# Copyright (C) 1998,1999,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //# $Id: QtWCBox.h 20567 2009-04-09 23:12:39Z gervandiepen $
26 
27 
28 
29 #ifndef QT_WCBOX_H
30 #define QT_WCBOX_H
31 
32 //# Includes
33 #include <casa/aips.h>
37 #include <casa/Arrays/Vector.h>
38 #include <casa/Quanta/Quantum.h>
39 
40 namespace casacore{
41 
42  class LCRegion;
43  class TableRecord;
44  class IPosition;
45 }
46 
47 namespace casa { //# NAMESPACE CASA - BEGIN
48 
49 //# Forward Declarations
50 
51 
52  class QtWCBox : public casacore::WCRegion {
53  public:
54  QtWCBox();
55 
56  // Construct from vectors of world coordinates
57  // defining the box corners. It is assumed that the
58  // order of the values is in the order of the pixel axes
59  // in the given coordinate system.
60  // <group>
63  const DisplayCoordinateSystem& cSys,
64  const casacore::Vector<casacore::Int>& absRel);
65  // </group>
66 
67  // Construct from vectors of world coordinates
68  // defining the box corners. You specify the pixel
69  // axis order of the world values.
70  // <group>
73  const casacore::IPosition& pixelAxes,
74  const DisplayCoordinateSystem& cSys,
75  const casacore::Vector<casacore::Int>& absRel);
76  // </group>
77 
78  // Construct from the bounding box of an <src>casacore::LCRegion</src>.
79  QtWCBox(const casacore::LCRegion& region,
80  const DisplayCoordinateSystem& cSys);
81 
82  // Copy constructor (reference semantics [except for <src>DisplayCoordinateSystem</src>])
83  QtWCBox (const QtWCBox& other);
84 
85  // Destructor
86  virtual ~QtWCBox();
87 
88  // Assignment (copy semantics)
89  QtWCBox& operator= (const QtWCBox& other);
90 
91  // Comparison
92  virtual casacore::Bool operator==(const casacore::WCRegion& other) const;
93 
94  // Clone a QtWCBox object.
95  virtual casacore::WCRegion* cloneRegion() const;
96 
97  // QtWCBox can extend a region.
98  virtual casacore::Bool canExtend() const;
99 
100  // Make a new box from the given axesin this box.
101  QtWCBox splitBox (const casacore::IPosition& axes) const;
102 
103  // Convert to an casacore::LCRegion using the supplied <src>DisplayCoordinateSystem</src>
104  // and shape.
106  const casacore::IPosition& latticeShape,
107  const casacore::IPosition& pixelAxesMap,
108  const casacore::IPosition& outOrder) const;
109 
110  // Convert the QtWCBox object to a record.
111  // The record can be used to make the object persistent.
112  // The <src>tableName</src> argument can be used by derived
113  // classes (e.g. casacore::LCPagedMask) to put very large objects.
114  virtual casacore::TableRecord toRecord(const casacore::String& tableName) const;
115 
116  // Convert to a QtWCBox from a record.
117  static QtWCBox* fromRecord (const casacore::TableRecord& rec,
118  const casacore::String& tableName);
119 
120  // Returns QtWCBox
121  static casacore::String className();
122 
123  // Return region type. Returns the class name
124  virtual casacore::String type() const;
125 
126  // Convert from/to boxit format string
128  static QtWCBox* fromBoxString(const casacore::String&,
129  const DisplayCoordinateSystem& cSys, casacore::String& err);
130 
131  // FIXME: refactor to someplace more appropriate
132  // get/set chan extension
133  void setChanExt(const casacore::Double, const casacore::Double);
135 
136  // FIXME: refactor to someplace more appropriate
137  // get/set pol extension
138  void setPolExt(const casacore::Double, const casacore::Double);
140 
141  static void unitInit();
142 
143  private:
150 
151 
152 // Check units of quanta are consistent with DisplayCoordinateSystem
153  void checkUnits (const casacore::IPosition& pixelAxes,
155  const DisplayCoordinateSystem& cSys);
156 
157 // Convert relative pixels to absolute or fill in defaults
158  void convertPixel(casacore::Double& pixel,
160  const casacore::Int absRel,
161  const casacore::Double refPix,
162  const casacore::Int shape,
163  const casacore::Bool isBlc) const;
164 
165  };
166 
167 
168 
169 } //# NAMESPACE CASA - END
170 
171 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
A 1-D Specialization of the Array class.
casacore::Bool getChanExt(casacore::Double &, casacore::Double &)
int Int
Definition: aipstype.h:50
static QtWCBox * fromRecord(const casacore::TableRecord &rec, const casacore::String &tableName)
Convert to a QtWCBox from a record.
DisplayCoordinateSystem itsCSys
Definition: QtWCBox.h:147
QtWCBox splitBox(const casacore::IPosition &axes) const
Make a new box from the given axesin this box.
void checkUnits(const casacore::IPosition &pixelAxes, const casacore::Vector< casacore::Quantum< casacore::Double > > &values, const DisplayCoordinateSystem &cSys)
Check units of quanta are consistent with DisplayCoordinateSystem.
virtual ~QtWCBox()
Destructor.
casacore::Vector< casacore::Int > itsAbsRel
Definition: QtWCBox.h:148
QtWCBox & operator=(const QtWCBox &other)
Assignment (copy semantics)
virtual casacore::String type() const
Return region type.
void setChanExt(const casacore::Double, const casacore::Double)
FIXME: refactor to someplace more appropriate get/set chan extension.
void convertPixel(casacore::Double &pixel, const casacore::Quantum< casacore::Double > &value, const casacore::Int absRel, const casacore::Double refPix, const casacore::Int shape, const casacore::Bool isBlc) const
Convert relative pixels to absolute or fill in defaults.
virtual casacore::WCRegion * cloneRegion() const
Clone a QtWCBox object.
casacore::Vector< casacore::Quantum< casacore::Double > > itsTrc
Definition: QtWCBox.h:145
casacore::Vector< casacore::Quantum< casacore::Double > > itsBlc
Definition: QtWCBox.h:144
virtual casacore::TableRecord toRecord(const casacore::String &tableName) const
Convert the QtWCBox object to a record.
double Double
Definition: aipstype.h:55
virtual casacore::LCRegion * doToLCRegion(const casacore::CoordinateSystem &cSys, const casacore::IPosition &latticeShape, const casacore::IPosition &pixelAxesMap, const casacore::IPosition &outOrder) const
Convert to an casacore::LCRegion using the supplied DisplayCoordinateSystem and shape.
void setPolExt(const casacore::Double, const casacore::Double)
FIXME: refactor to someplace more appropriate get/set pol extension.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual casacore::Bool operator==(const casacore::WCRegion &other) const
Comparison.
casacore::Bool itsNull
Definition: QtWCBox.h:149
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
Definition: ExprNode.h:1944
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:182
static void unitInit()
static casacore::String className()
Returns QtWCBox.
static QtWCBox * fromBoxString(const casacore::String &, const DisplayCoordinateSystem &cSys, casacore::String &err)
virtual casacore::Bool canExtend() const
QtWCBox can extend a region.
casacore::Bool getPolExt(casacore::Double &, casacore::Double &)
Base class to define world coordinate regions of interest in an image.
Definition: WCRegion.h:95
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::IPosition itsPixelAxes
Definition: QtWCBox.h:146
Interconvert pixel and world coordinates.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
casacore::String toBoxString() const
Convert from/to boxit format string.
Abstract base class to define a region of interest in lattice coordinates.
Definition: LCRegion.h:87
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42