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