Go to the documentation of this file.
29 #ifndef IMAGES_IMAGEPROXY_H
30 #define IMAGES_IMAGEPROXY_H
33 #include <casacore/casa/aips.h>
34 #include <casacore/images/Images/MaskSpecifier.h>
35 #include <casacore/lattices/Lattices/LatticeBase.h>
36 #include <casacore/lattices/Lattices/TiledShape.h>
37 #include <casacore/casa/Utilities/CountedPtr.h>
38 #include <casacore/casa/Containers/ValueHolder.h>
39 #include <casacore/casa/Containers/Record.h>
45 template<
typename T>
class ImageInterface;
46 class LatticeExprNode;
47 class CoordinateSystem;
48 class ImageAttrHandler;
90 const vector<ImageProxy>& images);
98 Int dummy1=0,
Int dummy2=0);
107 const Record& coordinates,
121 const Record& coordinates,
144 const vector<ImageProxy>& images = vector<ImageProxy>());
179 DataType
type()
const;
240 const String& attrName)
const;
244 const String& attrName)
const;
264 Bool preserveAxesOrder);
335 const String& method =
"linear",
428 template <
typename T>
431 const String& newMaskName,
Interconvert pixel and world coordinates.
A base class for astronomical images.
Vector< String > getAttrMeas(const String &groupName, const String &attrName) const
Get the measinfo of an attribute in a group.
void concatImagesFloat(const std::vector< ImageProxy > &images, Int axis)
A Vector of integers, for indexing into Array<T> objects.
static IPosition adjustTrc(const IPosition &trc, const IPosition &shp)
void makeImage(const Array< T > &array, const Array< Bool > &mask, const IPosition &shape, const Record &coordinates, const String &fileName, Bool asHDF5, const String &maskName, const IPosition &tileShape)
Make an image from an array or shape.
TiledShape makeTiledShape(const IPosition &newTileShape, const IPosition &shape, const IPosition &oldTileShape=IPosition()) const
Form a tiled shape from the current shape and a possible new tile shape.
Bool hasLock(Bool writeLock=False)
Does the image have a read or write lock?
Record makeStatistics(const ImageInterface< T > &image, const Vector< Int > &axes, const String &mask, const ValueHolder &minMaxValues, Bool exclude, Bool robust) const
Calculate the statistics.
ValueHolder getMask(const IPosition &blc, const IPosition &trc, const IPosition &inc)
Get a chunk of the mask.
void putData(const ValueHolder &, const IPosition &blc, const IPosition &inc)
Put a chunk of data.
Bool isPersistent() const
Is the image persistent or temporary.
Referenced counted pointer for constant data.
Record getAttrRow(const String &groupName, uInt rownr) const
Get all attributes in a group row.
ImageInterface< Complex > * itsImageComplex
Record miscInfo() const
Get the miscellaneous info.
CountedPtr< LatticeBase > itsLattice
void concatImagesDouble(const std::vector< ImageProxy > &images, Int axis)
const CoordinateSystem & coordSysObject() const
Record imageInfo() const
Get the image info.
void concatImages(const std::vector< ImageProxy > &images, Int axis)
Form a concatenated image.
uInt attrNrows(const String &groupName) const
Get the number of rows in an attribute group.
Vector< String > history() const
Get the history.
void setup()
Setup the pointers for the various image data types.
void concatImagesComplex(const std::vector< ImageProxy > &images, Int axis)
void concatImagesDComplex(const std::vector< ImageProxy > &images, Int axis)
Record statistics(const Vector< Int > &axes, const String &mask, const ValueHolder &minMaxValues, Bool exclude=False, Bool robust=False) const
Return the statistics for the given axes.
void toFits(const String &fitsfile, Bool overwrite=True, Bool velocity=True, Bool optical=True, Int bitpix=-32, Double minpix=1, Double maxpix=-1) const
Write the image in FITS format.
ImageInterface< Float > * itsImageFloat
String unit() const
Get the brightness unit.
Vector< String > attrNames(const String &groupName) const
Get the names of all attributes in a group.
const ImageInfo & imageInfoObject() const
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
void close()
Close the image by setting all pointers to 0.
void checkNull() const
Throw an exception if the object is null.
static LatticeBase * openImageOrExpr(const String &str, const MaskSpecifier &, const Block< LatticeExprNode > &nodes)
Open an image in the file/table with the given name.
uInt ndim() const
Get the dimensionality of the image.
A non-templated, abstract base class for array-like objects.
Class to specify which mask to use in an image.
void centreRefPix(CoordinateSystem &cSys, const IPosition &shape) const
Centre all axes except the Stokes one.
ImageInterface< Double > * itsImageDouble
this file contains all the compiler specific defines
static LatticeBase * openImage(const String &name, const String &mask=String(), const vector< ImageProxy > &images=vector< ImageProxy >())
Open the image (which can also be an expression).
ValueHolder getData(const IPosition &blc, const IPosition &trc, const IPosition &inc)
Get a chunk of data.
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
ImageAttrHandler * itsAttrHandler
void saveAs(const String &fileName, Bool overwrite=True, Bool hdf5=False, Bool copyMask=True, const String &newMaskName=String(), const IPosition &newTileShape=IPosition()) const
Write the image to an image file with the given name.
ImageProxy subImage2(const IPosition &blc, const IPosition &trc, const IPosition &inc, Bool dropDegenerate, Bool preserveAxesOrder)
Same with a new function name for backward compatibility with old pyrap.
String imageType() const
Get the image type (PagedImage, HDF5Image, etc.)
Vector< Double > toPixel(const Vector< Double > &world, Bool reverseAxes)
Convert a world coordinate to pixel coordinate.
Vector< String > attrGroupNames() const
Get the names of the attribute groups.
const CoordinateSystem * itsCoordSys
Bridging class to allow C++ expressions involving lattices.
String dataType() const
Get the data type of the image.
ImageProxy()
Default constructor is needed for Boost-Python.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
ImageProxy subImage(const IPosition &blc, const IPosition &trc, const IPosition &inc, Bool dropDegenerate=True)
Form a new (virtual) image being a subset of the image.
template <class T, class U> class vector;
static IPosition adjustInc(const IPosition &inc, const IPosition &shp)
String: the storage and methods of handling collections of characters.
LatticeBase * getLattice() const
IPosition shape() const
Get the shape of the image.
bool Bool
Define the standard types used by Casacore.
A holder for a value of any basic Casacore data type.
ImageProxy & operator=(const ImageProxy &)
Assignment (reference semantics).
Record coordSys() const
Get the coordinate system.
CoordinateSystem makeCoordinateSystem(const Record &coordinates, const IPosition &shape) const
Make a coordinate system from the Record.
void createAttrGroup(const String &groupName)
Create a new attribute group.
void doPutMask(ImageInterface< T > &image, const ValueHolder &value, const IPosition &blc, const IPosition &inc)
Put the mask and create it if needed.
String name(Bool stripPath=False) const
Get the name of the image.
A hierarchical collection of named fields of various types.
void putAttr(const String &groupName, const String &attrName, uInt rownr, const ValueHolder &value, const Vector< String > &units, const Vector< String > &measInfo)
Put the value, unit, and measinfo of an attribute in a group row.
ValueHolder getAttr(const String &groupName, const String &attrName, uInt rownr) const
Get the value of an attribute in a group row.
ImageInterface< DComplex > * itsImageDComplex
Abstract base class for an image attributes handler.
A 1-D Specialization of the Array class.
Vector< Double > toWorld(const Vector< Double > &pixel, Bool reverseAxes)
Convert a pixel coordinate to world coordinate.
void unlock()
Release the lock acquired by lock().
ImageProxy doRegrid(const ImageInterface< T > &image, const Vector< Int > &axes, const String &outfile, const IPosition &shape, const Record &coordSys, const String &method, Int decimate, Bool replicate, Bool doRefChange, Bool force)
Do the actual regridding.
static IPosition adjustBlc(const IPosition &blc, const IPosition &shp)
Check and adjust blc, trc, or inc using the shape.
void saveImage(const String &fileName, Bool hdf5, Bool copyMask, const String &newMaskName, const IPosition &newTileShape, const ImageInterface< T > &image) const
Copy the image to an image (PagedImage or HDF5Image) with the given name.
uInt size() const
Get the size of the image (nr of pixels).
void lock(Bool writeLock=False, Int nattempts=0)
Try to acquire a read or write lock.
void putMask(const ValueHolder &value, const IPosition &blc, const IPosition &inc)
Put a chunk of the mask.
Define the shape and tile shape.
Miscellaneous information related to an image.
Vector< String > getAttrUnit(const String &groupName, const String &attrName) const
Get the unit(s) of an attribute in a group.
ImageProxy regrid(const Vector< Int > &axes=Vector< Int >(), const String &outfile=String(), Bool overwriteOutFile=True, const IPosition &outShape=IPosition(), const Record &coordSys=Record(), const String &method="linear", Int decimate=10, Bool replicate=False, Bool doRefChange=True, Bool forceRegrid=False)
Regrid the image on the given axes to the given coordinate system.
LatticeExprNode makeNode() const
Turn the ImageProxy into a LatticeExprNode.