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 std::vector<ImageProxy>& images);
98 Int dummy1=0,
Int dummy2=0);
107 const Record& coordinates,
121 const Record& coordinates,
144 const std::vector<ImageProxy>& images = std::vector<ImageProxy>());
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,
Referenced counted pointer for constant data.
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.
const CoordinateSystem * itsCoordSys
Record coordSys() const
Get the coordinate system.
CoordinateSystem makeCoordinateSystem(const Record &coordinates, const IPosition &shape) const
Make a coordinate system from the Record.
ImageProxy(const String &name, const String &mask, const std::vector< ImageProxy > &images)
Construct from a string that contains an image name or image expression.
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.
ImageProxy(const ValueHolder &values, const ValueHolder &mask, const Record &coordinates, const String &imageName=String(), Bool overwrite=True, Bool asHDF5=False, const String &maskName=String(), const IPosition &tileShape=IPosition())
Construct from a ValueHolder containing an Array of Float or Complex.
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.
void putData(const ValueHolder &, const IPosition &blc, const IPosition &inc)
Put a chunk of data.
Vector< String > history() const
Get the history.
ImageInterface< DComplex > * itsImageDComplex
uInt size() const
Get the size of the image (nr of pixels).
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 concatImagesFloat(const std::vector< ImageProxy > &images, Int axis)
ImageProxy()
Default constructor is needed for Boost-Python.
ImageProxy(LatticeBase *)
Form an ImageProxy object from an existing image object.
uInt attrNrows(const String &groupName) const
Get the number of rows in an attribute group.
void concatImagesComplex(const std::vector< ImageProxy > &images, Int axis)
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.
Vector< Double > toPixel(const Vector< Double > &world, Bool reverseAxes)
Convert a world coordinate to pixel coordinate.
void concatImagesDComplex(const std::vector< ImageProxy > &images, Int axis)
ValueHolder getAttr(const String &groupName, const String &attrName, uInt rownr) const
Get the value of an attribute in a group row.
void lock(Bool writeLock=False, Int nattempts=0)
Try to acquire a read or write lock.
const ImageInfo & imageInfoObject() const
ImageProxy & operator=(const ImageProxy &)
Assignment (reference semantics).
Vector< String > attrGroupNames() const
Get the names of the attribute groups.
Record miscInfo() const
Get the miscellaneous info.
void centreRefPix(CoordinateSystem &cSys, const IPosition &shape) const
Centre all axes except the Stokes one.
ValueHolder getMask(const IPosition &blc, const IPosition &trc, const IPosition &inc)
Get a chunk of the mask.
ImageInterface< Complex > * itsImageComplex
void putMask(const ValueHolder &value, const IPosition &blc, const IPosition &inc)
Put a chunk of the mask.
Bool hasLock(Bool writeLock=False)
Does the image have a read or write lock?
LatticeExprNode makeNode() const
Turn the ImageProxy into a LatticeExprNode.
Vector< String > getAttrUnit(const String &groupName, const String &attrName) const
Get the unit(s) of an attribute in a group.
IPosition shape() const
Get the shape of the image.
ImageInterface< Float > * itsImageFloat
Vector< String > getAttrMeas(const String &groupName, const String &attrName) const
Get the measinfo of an attribute in a group.
Record imageInfo() const
Get the image info.
ImageProxy(const IPosition &shape, const ValueHolder &value, const Record &coordinates, const String &imageName=String(), Bool overwrite=True, Bool asHDF5=False, const String &maskName=String(), const IPosition &tileShape=IPosition(), Int dummy=0)
Construct from a shape.
void unlock()
Release the lock acquired by lock().
Bool isPersistent() const
Is the image persistent or temporary.
ImageProxy(const ImageProxy &)
Copy constructor (reference semantics).
void concatImagesDouble(const std::vector< ImageProxy > &images, Int axis)
ImageAttrHandler * itsAttrHandler
CountedPtr< LatticeBase > itsLattice
void concatImages(const std::vector< ImageProxy > &images, Int axis)
Form a concatenated image.
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.
const CoordinateSystem & coordSysObject() const
static LatticeBase * openImage(const String &name, const String &mask=String(), const std::vector< ImageProxy > &images=std::vector< ImageProxy >())
Open the image (which can also be an expression).
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.
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.
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.
Vector< Double > toWorld(const Vector< Double > &pixel, Bool reverseAxes)
Convert a pixel coordinate to world coordinate.
static IPosition adjustBlc(const IPosition &blc, const IPosition &shp)
Check and adjust blc, trc, or inc using the shape.
String imageType() const
Get the image type (PagedImage, HDF5Image, etc.)
ImageInterface< Double > * itsImageDouble
uInt ndim() const
Get the dimensionality of the image.
ImageProxy(const std::vector< ImageProxy > &images, Int axis, Int dummy1=0, Int dummy2=0)
Construct from the concatenation of the image objects along the axis.
LatticeBase * getLattice() const
String unit() const
Get the brightness unit.
void checkNull() const
Throw an exception if the object is null.
ImageProxy(const Vector< String > &names, Int axis)
Construct from the concatenation of the images along the axis.
String dataType() const
Get the data type of the image.
String name(Bool stripPath=False) const
Get the name of the image.
static IPosition adjustTrc(const IPosition &trc, const IPosition &shp)
void setup()
Setup the pointers for the various image data types.
void setup(LatticeBase *lattice)
Setup the pointers for the various image data types.
void createAttrGroup(const String &groupName)
Create a new attribute group.
ImageProxy(const CountedPtr< LatticeBase > &)
Construct from an existing image object.
ValueHolder getData(const IPosition &blc, const IPosition &trc, const IPosition &inc)
Get a chunk of data.
Vector< String > attrNames(const String &groupName) const
Get the names of all attributes in a group.
static IPosition adjustInc(const IPosition &inc, const IPosition &shp)
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.
void close()
Close the image by setting all pointers to 0.
void doPutMask(ImageInterface< T > &image, const ValueHolder &value, const IPosition &blc, const IPosition &inc)
Put the mask and create it if needed.
static LatticeBase * openImageOrExpr(const String &str, const MaskSpecifier &, const Block< LatticeExprNode > &nodes)
Open an image in the file/table with the given name.
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.
Record makeStatistics(const ImageInterface< T > &image, const Vector< Int > &axes, const String &mask, const ValueHolder &minMaxValues, Bool exclude, Bool robust) const
Calculate the statistics.
Record getAttrRow(const String &groupName, uInt rownr) const
Get all attributes in a group row.
String: the storage and methods of handling collections of characters.
this file contains all the compiler specific defines
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
bool Bool
Define the standard types used by Casacore.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.