Loading...
Searching...
No Matches
LCBox.h
Go to the documentation of this file.
//# LCBox.h: Class to define a rectangular box of interest
//# Copyright (C) 1997,1998,1999
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: casa-feedback@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
#ifndef LATTICES_LCBOX_H
#define LATTICES_LCBOX_H
//# Includes
#include <casacore/casa/aips.h>
#include <casacore/lattices/LRegions/LCRegionFixed.h>
#include <casacore/casa/Arrays/Slicer.h>
#include <casacore/casa/Arrays/Vector.h>
namespace casacore { //# NAMESPACE CASACORE - BEGIN
// <summary>
// Class to define a rectangular box of interest.
// </summary>
// <use visibility=export>
// <reviewed reviewer="" date="" tests="">
// </reviewed>
// <prerequisite>
// <li> <linkto class=LCRegion>LCRegion</linkto>
// </prerequisite>
// <synopsis>
// The LCBox class is a specialization of class
// <linkto class=LCRegion>LCRegion</linkto>.
// It makes it possible to define a rectangular region of interest.
// </synopsis>
// <example>
// <srcblock>
// </srcblock>
// </example>
// <todo asof="1997/11/11">
// </todo>
class LCBox: public LCRegionFixed
{
public:
LCBox();
// Construct a box for the full lattice shape.
explicit LCBox (const IPosition& latticeShape);
// Construct from the Slicer defining the box.
// The slicer may not contain a stride.
LCBox (const Slicer& box, const IPosition& latticeShape);
// Construct from the IPosition's defining the bottom-left and
// top-right corner of the box.
LCBox (const IPosition& blc, const IPosition& trc,
const IPosition& latticeShape);
// Construct from the Vector's defining the bottom-left and
// top-right corner of the box.
// <group>
LCBox (const Vector<Float>& blc, const Vector<Float>& trc,
const IPosition& latticeShape);
LCBox (const Vector<Double>& blc, const Vector<Double>& trc,
const IPosition& latticeShape);
// </group>
// Copy constructor (reference semantics).
LCBox (const LCBox& other);
virtual ~LCBox();
// Assignment (copy semantics).
LCBox& operator= (const LCBox& other);
// Comparison. Mask not checked. Use function
// LRegionSingle::maskEqual to do this
virtual Bool operator== (const LCRegion& other) const;
// Make a copy of the derived object.
virtual LCRegion* cloneRegion() const;
// Get the class name (to store in the record).
static String className();
// Get the region type. Returns className()
virtual String type() const;
// Convert the (derived) object to a record.
virtual TableRecord toRecord (const String& tableName) const;
// Convert correct object from a record.
static LCBox* fromRecord (const TableRecord&,
const String& tablename);
// Get the box blc
Vector<Float> blc() const;
// Get the box trc
Vector<Float> trc() const;
// Verify a box specification. Illegal (inlcuding blc > trc) or
// unspecified values are given 0 (blc) shape (trc) or
// unity (inc). Returns <src>True</src> if any of the blc/trc/inc
// are changed from their input values, else returns <src>False</src>
static Bool verify (IPosition& blc, IPosition& trc,
IPosition& inc, const IPosition& shape);
protected:
// Construct another LCBox (for e.g. another lattice) by moving
// this one. It recalculates the bounding box.
// A positive translation value indicates "to right".
virtual LCRegion* doTranslate (const Vector<Float>& translateVector,
const IPosition& newLatticeShape) const;
private:
// Make a box from the blc,trc such that it does not exceed the
// lattice boundaries.
void setSlicerBox (const IPosition& blc, const IPosition& trc);
// Fill the blc and trc vector from IPositions.
void fillBlcTrc();
//# Variables
Vector<Float> itsBlc;
Vector<Float> itsTrc;
};
inline Vector<Float> LCBox::blc() const
{
return itsBlc;
}
inline Vector<Float> LCBox::trc() const
{
return itsTrc;
}
} //# NAMESPACE CASACORE - END
#endif
casacore::IPosition
Definition IPosition.h:117
casacore::LCBox::type
virtual String type() const
Get the region type.
casacore::LCBox::operator=
LCBox & operator=(const LCBox &other)
Assignment (copy semantics).
casacore::LCBox::doTranslate
virtual LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Construct another LCBox (for e.g.
casacore::LCBox::LCBox
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.
casacore::LCBox::LCBox
LCBox(const Slicer &box, const IPosition &latticeShape)
Construct from the Slicer defining the box.
casacore::LCBox::LCBox
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.
casacore::LCBox::LCBox
LCBox(const LCBox &other)
Copy constructor (reference semantics).
casacore::LCBox::~LCBox
virtual ~LCBox()
casacore::LCBox::fromRecord
static LCBox * fromRecord(const TableRecord &, const String &tablename)
Convert correct object from a record.
casacore::LCBox::LCBox
LCBox(const Vector< Double > &blc, const Vector< Double > &trc, const IPosition &latticeShape)
casacore::LCBox::verify
static Bool verify(IPosition &blc, IPosition &trc, IPosition &inc, const IPosition &shape)
Verify a box specification.
casacore::LCBox::itsBlc
Vector< Float > itsBlc
Definition LCBox.h:150
casacore::LCBox::cloneRegion
virtual LCRegion * cloneRegion() const
Make a copy of the derived object.
casacore::LCBox::LCBox
LCBox(const IPosition &latticeShape)
Construct a box for the full lattice shape.
casacore::LCBox::operator==
virtual Bool operator==(const LCRegion &other) const
Comparison.
casacore::LCBox::toRecord
virtual TableRecord toRecord(const String &tableName) const
Convert the (derived) object to a record.
casacore::LCBox::trc
Vector< Float > trc() const
Get the box trc.
Definition LCBox.h:159
casacore::LCBox::setSlicerBox
void setSlicerBox(const IPosition &blc, const IPosition &trc)
Make a box from the blc,trc such that it does not exceed the lattice boundaries.
casacore::LCBox::LCBox
LCBox()
casacore::LCBox::fillBlcTrc
void fillBlcTrc()
Fill the blc and trc vector from IPositions.
casacore::LCBox::blc
Vector< Float > blc() const
Get the box blc.
Definition LCBox.h:155
casacore::LCBox::className
static String className()
Get the class name (to store in the record).
casacore::LCBox::itsTrc
Vector< Float > itsTrc
Definition LCBox.h:151
casacore::LCRegionFixed::LCRegionFixed
LCRegionFixed()
casacore::LCRegion
Definition LCRegion.h:86
casacore::LCRegion::latticeShape
const IPosition & latticeShape() const
Give the full lattice shape.
Definition LCRegion.h:229
casacore::Slicer
Definition Slicer.h:287
casacore::String
String: the storage and methods of handling collections of characters.
Definition String.h:223
casacore::TableRecord
Definition TableRecord.h:183
casacore::Vector
Definition Vector.h:82
casacore
this file contains all the compiler specific defines
Definition mainpage.dox:28
casacore::shape
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40