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
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38// <summary>
39// Class to define a rectangular box of interest.
40// </summary>
41
42// <use visibility=export>
43
44// <reviewed reviewer="" date="" tests="">
45// </reviewed>
46
47// <prerequisite>
48// <li> <linkto class=LCRegion>LCRegion</linkto>
49// </prerequisite>
50
51// <synopsis>
52// The LCBox class is a specialization of class
53// <linkto class=LCRegion>LCRegion</linkto>.
54// It makes it possible to define a rectangular region of interest.
55// </synopsis>
56
57// <example>
58// <srcblock>
59// </srcblock>
60// </example>
61
62// <todo asof="1997/11/11">
63// </todo>
64
65class LCBox: public LCRegionFixed
66{
67public:
69
70 // Construct a box for the full lattice shape.
71 explicit LCBox (const IPosition& latticeShape);
72
73 // Construct from the Slicer defining the box.
74 // The slicer may not contain a stride.
75 LCBox (const Slicer& box, const IPosition& latticeShape);
76
77 // Construct from the IPosition's defining the bottom-left and
78 // top-right corner of the box.
79 LCBox (const IPosition& blc, const IPosition& trc,
80 const IPosition& latticeShape);
81
82 // Construct from the Vector's defining the bottom-left and
83 // top-right corner of the box.
84 // <group>
86 const IPosition& latticeShape);
88 const IPosition& latticeShape);
89 // </group>
90
91 // Copy constructor (reference semantics).
92 LCBox (const LCBox& other);
93
94 virtual ~LCBox();
95
96 // Assignment (copy semantics).
97 LCBox& operator= (const LCBox& other);
98
99 // Comparison. Mask not checked. Use function
100 // LRegionSingle::maskEqual to do this
101 virtual Bool operator== (const LCRegion& other) const;
102
103 // Make a copy of the derived object.
104 virtual LCRegion* cloneRegion() const;
105
106 // Get the class name (to store in the record).
108
109 // Get the region type. Returns className()
110 virtual String type() const;
111
112 // Convert the (derived) object to a record.
113 virtual TableRecord toRecord (const String& tableName) const;
114
115 // Convert correct object from a record.
116 static LCBox* fromRecord (const TableRecord&,
117 const String& tablename);
118
119 // Get the box blc
120 Vector<Float> blc() const;
121
122 // Get the box trc
123 Vector<Float> trc() const;
124
125// Verify a box specification. Illegal (inlcuding blc > trc) or
126// unspecified values are given 0 (blc) shape (trc) or
127// unity (inc). Returns <src>True</src> if any of the blc/trc/inc
128// are changed from their input values, else returns <src>False</src>
130 IPosition& inc, const IPosition& shape);
131
132
133protected:
134 // Construct another LCBox (for e.g. another lattice) by moving
135 // this one. It recalculates the bounding box.
136 // A positive translation value indicates "to right".
137 virtual LCRegion* doTranslate (const Vector<Float>& translateVector,
138 const IPosition& newLatticeShape) const;
139
140private:
141 // Make a box from the blc,trc such that it does not exceed the
142 // lattice boundaries.
143 void setSlicerBox (const IPosition& blc, const IPosition& trc);
144
145 // Fill the blc and trc vector from IPositions.
147
148
149 //# Variables
152};
153
154
156{
157 return itsBlc;
158}
160{
161 return itsTrc;
162}
163
164
165
166} //# NAMESPACE CASACORE - END
167
168#endif
virtual String type() const
Get the region type.
LCBox & operator=(const LCBox &other)
Assignment (copy semantics).
virtual LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Construct another LCBox (for e.g.
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.
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:150
virtual LCRegion * cloneRegion() const
Make a copy of the derived object.
LCBox(const IPosition &latticeShape)
Construct a box for the full lattice shape.
virtual Bool operator==(const LCRegion &other) const
Comparison.
virtual TableRecord toRecord(const String &tableName) const
Convert the (derived) object to a record.
Vector< Float > trc() const
Get the box trc.
Definition LCBox.h:159
void setSlicerBox(const IPosition &blc, const IPosition &trc)
Make a box from the blc,trc such that it does not exceed the lattice boundaries.
void fillBlcTrc()
Fill the blc and trc vector from IPositions.
Vector< Float > blc() const
Get the box blc.
Definition LCBox.h:155
static String className()
Get the class name (to store in the record).
Vector< Float > itsTrc
Definition LCBox.h:151
const IPosition & latticeShape() const
Give the full lattice shape.
Definition LCRegion.h:229
virtual IPosition shape() const
Return the shape of the region (i.e.
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40