casacore
Loading...
Searching...
No Matches
LCBox.h
Go to the documentation of this file.
1// # LCBox.h: Class to define a rectangular box of interest
2// # Copyright (C) 1997,1998,1999
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: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef LATTICES_LCBOX_H
27#define LATTICES_LCBOX_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/lattices/LRegions/LCRegionFixed.h>
32#include <casacore/casa/Arrays/Slicer.h>
33#include <casacore/casa/Arrays/Vector.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// <summary>
38// Class to define a rectangular box of interest.
39// </summary>
40
41// <use visibility=export>
42
43// <reviewed reviewer="" date="" tests="">
44// </reviewed>
45
46// <prerequisite>
47// <li> <linkto class=LCRegion>LCRegion</linkto>
48// </prerequisite>
49
50// <synopsis>
51// The LCBox class is a specialization of class
52// <linkto class=LCRegion>LCRegion</linkto>.
53// It makes it possible to define a rectangular region of interest.
54// </synopsis>
55
56// <example>
57// <srcblock>
58// </srcblock>
59// </example>
60
61// <todo asof="1997/11/11">
62// </todo>
63
64class LCBox : public LCRegionFixed {
65 public:
67
68 // Construct a box for the full lattice shape.
69 explicit LCBox(const IPosition& latticeShape);
70
71 // Construct from the Slicer defining the box.
72 // The slicer may not contain a stride.
73 LCBox(const Slicer& box, const IPosition& latticeShape);
74
75 // Construct from the IPosition's defining the bottom-left and
76 // top-right corner of the box.
78
79 // Construct from the Vector's defining the bottom-left and
80 // top-right corner of the box.
81 // <group>
84 // </group>
85
86 // Copy constructor (reference semantics).
87 LCBox(const LCBox& other);
88
89 virtual ~LCBox();
90
91 // Assignment (copy semantics).
92 LCBox& operator=(const LCBox& other);
93
94 // Make a copy of the derived object.
95 LCRegion* cloneRegion() const override;
96
97 // Get the class name (to store in the record).
98 static String className();
99
100 // Get the region type. Returns className()
101 String type() const override;
102
103 // Convert the (derived) object to a record.
104 TableRecord toRecord(const String& tableName) const override;
105
106 // Convert correct object from a record.
107 static LCBox* fromRecord(const TableRecord&, const String& tablename);
108
109 // Get the box blc
110 Vector<Float> blc() const;
111
112 // Get the box trc
113 Vector<Float> trc() const;
114
115 // Verify a box specification. Illegal (inlcuding blc > trc) or
116 // unspecified values are given 0 (blc) shape (trc) or
117 // unity (inc). Returns <src>True</src> if any of the blc/trc/inc
118 // are changed from their input values, else returns <src>False</src>
120
121 protected:
122 // Construct another LCBox (for e.g. another lattice) by moving
123 // this one. It recalculates the bounding box.
124 // A positive translation value indicates "to right".
125 LCRegion* doTranslate(const Vector<Float>& translateVector,
126 const IPosition& newLatticeShape) const override;
127
128 private:
129 // Comparison. Mask not checked. Use function
130 // LRegionSingle::maskEqual to do this
131 Bool equals(const LCRegion& other) const override;
132
133 // Make a box from the blc,trc such that it does not exceed the
134 // lattice boundaries.
135 void setSlicerBox(const IPosition& blc, const IPosition& trc);
136
137 // Fill the blc and trc vector from IPositions.
139
140 // # Variables
143};
144
145inline Vector<Float> LCBox::blc() const { return itsBlc; }
146inline Vector<Float> LCBox::trc() const { return itsTrc; }
147
148} // namespace casacore
149
150#endif
LCBox & operator=(const LCBox &other)
Assignment (copy semantics).
LCRegion * cloneRegion() const override
Make a copy of the derived object.
LCBox(const Vector< Float > &blc, const Vector< Float > &trc, const IPosition &latticeShape)
Construct from the Vector's defining the bottom-left and top-right corner of the box.
LCBox(const Slicer &box, const IPosition &latticeShape)
Construct from the Slicer defining the box.
LCBox(const IPosition &blc, const IPosition &trc, const IPosition &latticeShape)
Construct from the IPosition's defining the bottom-left and top-right corner of the box.
LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const override
Construct another LCBox (for e.g.
LCBox(const LCBox &other)
Copy constructor (reference semantics).
virtual ~LCBox()
static LCBox * fromRecord(const TableRecord &, const String &tablename)
Convert correct object from a record.
LCBox(const Vector< Double > &blc, const Vector< Double > &trc, const IPosition &latticeShape)
static Bool verify(IPosition &blc, IPosition &trc, IPosition &inc, const IPosition &shape)
Verify a box specification.
Vector< Float > itsBlc
Definition LCBox.h:141
LCBox(const IPosition &latticeShape)
Construct a box for the full lattice shape.
Vector< Float > trc() const
Get the box trc.
Definition LCBox.h:146
Bool equals(const LCRegion &other) const override
Comparison.
void setSlicerBox(const IPosition &blc, const IPosition &trc)
Make a box from the blc,trc such that it does not exceed the lattice boundaries.
String type() const override
Get the region type.
void fillBlcTrc()
Fill the blc and trc vector from IPositions.
Vector< Float > blc() const
Get the box blc.
Definition LCBox.h:145
static String className()
Get the class name (to store in the record).
TableRecord toRecord(const String &tableName) const override
Convert the (derived) object to a record.
Vector< Float > itsTrc
Definition LCBox.h:142
const IPosition & latticeShape() const
Give the full lattice shape.
Definition LCRegion.h:211
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40