29 #ifndef IMAGES_IMAGEPROXY_H
30 #define IMAGES_IMAGEPROXY_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>());
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,
A Vector of integers, for indexing into Array<T> objects.
ImageInterface< Double > * itsImageDouble
const ImageInfo & imageInfoObject() const
A 1-D Specialization of the Array class.
void checkNull() const
Throw an exception if the object is null.
uInt ndim() const
Get the dimensionality of the image.
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).
String unit() const
Get the brightness unit.
static LatticeBase * openImageOrExpr(const String &str, const MaskSpecifier &, const Block< LatticeExprNode > &nodes)
Open an image in the file/table with the given name.
ImageAttrHandler * itsAttrHandler
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
Vector< String > attrNames(const String &groupName) const
Get the names of all attributes in a group.
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Record imageInfo() const
Get the image info.
ValueHolder getData(const IPosition &blc, const IPosition &trc, const IPosition &inc)
Get a chunk of data.
ImageProxy()
Default constructor is needed for Boost-Python.
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.
Vector< Double > toPixel(const Vector< Double > &world, Bool reverseAxes)
Convert a world coordinate to pixel coordinate.
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.
const CoordinateSystem * itsCoordSys
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.
static IPosition adjustInc(const IPosition &inc, const IPosition &shp)
A non-templated, abstract base class for array-like objects.
LatticeBase * getLattice() const
void doPutMask(ImageInterface< T > &image, const ValueHolder &value, const IPosition &blc, const IPosition &inc)
Put the mask and create it if needed.
ImageProxy & operator=(const ImageProxy &)
Assignment (reference semantics).
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.
void createAttrGroup(const String &groupName)
Create a new attribute group.
ImageInterface< DComplex > * itsImageDComplex
void unlock()
Release the lock acquired by lock().
Abstract base class for an image attributes handler.
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.
String name(Bool stripPath=False) const
Get the name of the image.
Record getAttrRow(const String &groupName, uInt rownr) const
Get all attributes in a group row.
String dataType() const
Get the data type of the image.
Vector< String > getAttrMeas(const String &groupName, const String &attrName) const
Get the measinfo of an attribute in a group.
LatticeExprNode makeNode() const
Turn the ImageProxy into a LatticeExprNode.
Vector< Double > toWorld(const Vector< Double > &pixel, Bool reverseAxes)
Convert a pixel coordinate to world coordinate.
Record makeStatistics(const ImageInterface< T > &image, const Vector< Int > &axes, const String &mask, const ValueHolder &minMaxValues, Bool exclude, Bool robust) const
Calculate the statistics.
Define the shape and tile shape.
void lock(Bool writeLock=False, Int nattempts=0)
Try to acquire a read or write lock.
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.
Referenced counted pointer for constant data.
Vector< String > attrGroupNames() const
Get the names of the attribute groups.
A base class for astronomical images.
Record coordSys() const
Get the coordinate system.
String imageType() const
Get the image type (PagedImage, HDF5Image, etc.)
Class to specify which mask to use in an image.
void putMask(const ValueHolder &value, const IPosition &blc, const IPosition &inc)
Put a chunk of the mask.
Vector< String > history() const
Get the history.
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.
A holder for a value of any basic Casacore data type.
Bool hasLock(Bool writeLock=False)
Does the image have a read or write lock?
uInt attrNrows(const String &groupName) const
Get the number of rows in an attribute group.
ValueHolder getMask(const IPosition &blc, const IPosition &trc, const IPosition &inc)
Get a chunk of the mask.
uInt size() const
Get the size of the image (nr of pixels).
static IPosition adjustTrc(const IPosition &trc, const IPosition &shp)
IPosition shape() const
Get the shape of the image.
A hierarchical collection of named fields of various types.
void concatImagesFloat(const std::vector< ImageProxy > &images, Int axis)
bool Bool
Define the standard types used by Casacore.
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.
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.
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.
void putData(const ValueHolder &, const IPosition &blc, const IPosition &inc)
Put a chunk of data.
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.
Bool isPersistent() const
Is the image persistent or temporary.
Bridging class to allow C++ expressions involving lattices.
void concatImagesDouble(const std::vector< ImageProxy > &images, Int axis)
ImageInterface< Complex > * itsImageComplex
String: the storage and methods of handling collections of characters.
CountedPtr< LatticeBase > itsLattice
void concatImagesDComplex(const std::vector< ImageProxy > &images, Int axis)
void setup()
Setup the pointers for the various image data types.
ValueHolder getAttr(const String &groupName, const String &attrName, uInt rownr) const
Get the value of an attribute in a group row.
CoordinateSystem makeCoordinateSystem(const Record &coordinates, const IPosition &shape) const
Make a coordinate system from the Record.
void concatImages(const std::vector< ImageProxy > &images, Int axis)
Form a concatenated image.
ImageInterface< Float > * itsImageFloat
const CoordinateSystem & coordSysObject() const
Vector< String > getAttrUnit(const String &groupName, const String &attrName) const
Get the unit(s) of an attribute in a group.
Miscellaneous information related to an image.
void close()
Close the image by setting all pointers to 0.
void concatImagesComplex(const std::vector< ImageProxy > &images, Int axis)
Interconvert pixel and world coordinates.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
void centreRefPix(CoordinateSystem &cSys, const IPosition &shape) const
Centre all axes except the Stokes one.
Record miscInfo() const
Get the miscellaneous info.