casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
casa::PixelValueManipulator< T > Class Template Reference

#include <PixelValueManipulator.h>

Inheritance diagram for casa::PixelValueManipulator< T >:
casa::ImageTask< T >

Public Types

enum  Operator {
  ADDITION,
  SUBTRACTION,
  MULTIPLICATION,
  DIVISION,
  NONE
}
 Top level interface for getting and setting image pixel values. More...
 
- Public Types inherited from casa::ImageTask< T >
enum  Verbosity {
  QUIET,
  WHISPER,
  LOW,
  NORMAL,
  HIGH,
  NOISY,
  DEAFENING
}
 Virtual base class for image analysis tasks. More...
 

Public Member Functions

 PixelValueManipulator ()=delete
 
 PixelValueManipulator (const SPCIIT image, const casacore::Record *const regionRec, const casacore::String &mask, casacore::Bool verboseDuringConstruction=casacore::True)
 regionRec = 0 => no region selected, full image used mask = "" => No additional mask specification, although image default mask will be used if one exists. More...
 
 ~PixelValueManipulator ()
 
void setAxes (const casacore::IPosition &axes, casacore::Bool invert=false)
 set axes to average over. More...
 
casacore::Record get () const
 Get pixel values, pixel mask values, etc. More...
 
casacore::Record getProfile (casacore::uInt axis, const casacore::String &function, const casacore::String &unit, PixelValueManipulatorData::SpectralType specType=PixelValueManipulatorData::DEFAULT, const casacore::Quantity *const restFreq=nullptr, const casacore::String &frame="")
 get the aggregated values along the specified pixel axis using the region and mask at construction and any other mask the image may have. More...
 
casacore::Record getProfile (casacore::uInt axis, ImageCollapserData::AggregateType function, const casacore::String &unit, PixelValueManipulatorData::SpectralType specType=PixelValueManipulatorData::DEFAULT, const casacore::Quantity *const restFreq=nullptr, const casacore::String &frame="")
 
casacore::String getClass () const
 
casacore::Record pixelValue (const casacore::Vector< casacore::Int > &pixel) const
 
void pixelValue (casacore::Bool &offImage, casacore::Quantum< T > &value, casacore::Bool &mask, casacore::Vector< casacore::Int > &pos) const
 
void setRegionName (const casacore::String &rname)
 set region name for logging purposes. More...
 
- Public Member Functions inherited from casa::ImageTask< T >
virtual ~ImageTask ()
 
void setStretch (const casacore::Bool stretch)
 
void setLogfile (const casacore::String &lf)
 tacitly does nothing if lf is the empty string. More...
 
void setLogfileAppend (const casacore::Bool a)
 
void setRegion (const casacore::Record &region)
 
void setMask (const casacore::String &mask)
 
void setVerbosity (Verbosity verbosity)
 
void addHistory (const std::vector< std::pair< casacore::String, casacore::String > > &msgs) const
 These messages will appear in the product image history upon the call to _prepareOutputImage(). More...
 
void addHistory (const casacore::LogOrigin &origin, const casacore::String &msg) const
 
void addHistory (const casacore::LogOrigin &origin, const std::vector< casacore::String > &msgs) const
 
void addHistory (const casacore::LogOrigin &origin, const casacore::String &taskname, const std::vector< casacore::String > &paramNames, const std::vector< casac::variant > &paramValues) const
 This adds standard history messages regarding the task that was run and input parameters used. More...
 
void suppressHistoryWriting (casacore::Bool b)
 suppress writing the history on _prepareOutputImage() call. More...
 
std::vector< std::pair
< casacore::String,
casacore::String > > 
getHistory ()
 get the history associated with the task. More...
 
void setDropDegen (casacore::Bool d)
 

Static Public Member Functions

static void addNoise (SPIIT image, const casacore::String &type, const casacore::Record &region, const casacore::Vector< casacore::Double > &pars, casacore::Bool zero, const std::pair< casacore::Int, casacore::Int > *const &seeds)
 
static casacore::RecordcoordMeasures (casacore::Quantum< T > &intensity, casacore::Record &direction, casacore::Record &frequency, casacore::Record &velocity, SPCIIT image, const casacore::Vector< casacore::Double > &pixel, const casacore::String &dirFrame, const casacore::String &freqFrame)
 dirFrame and freqFrame are the codes for the frames for which it is desired that the returned measures should be specified. More...
 
static casacore::RecordgetSlice (SPCIIT image, const casacore::Vector< casacore::Double > &x, const casacore::Vector< casacore::Double > &y, const casacore::Vector< casacore::Int > &axes, const casacore::Vector< casacore::Int > &coord, casacore::Int npts=0, const casacore::String &method="linear")
 get a slice through the image. More...
 
static void put (SPIIT image, const casacore::Array< T > &pixelsArray, const casacore::Vector< casacore::Int > &blc, const casacore::Vector< casacore::Int > &inc, casacore::Bool list, casacore::Bool locking, casacore::Bool replicate)
 
static casacore::Bool putRegion (SPIIT image, const casacore::Array< T > &pixels, const casacore::Array< casacore::Bool > &mask, casacore::Record &region, casacore::Bool list, casacore::Bool usemask, casacore::Bool replicateArray)
 
static void insert (casacore::ImageInterface< T > &target, const casacore::ImageInterface< T > &image, const casacore::Record &region, const casacore::Vector< casacore::Double > &locatePixel, casacore::Bool verbose)
 region refers to the region in the image to be inserted, not the region that was chosen at object construction More...
 
static void makeRegionBlock (casacore::PtrBlock< const casacore::ImageRegion * > &regions, const casacore::Record &Regions)
 Make a block of regions from a Record public so ImageAnalysis can use it, once those methods have been excised, make private. More...
 
static casacore::Bool set (SPIIF image, const casacore::String &pixels, const casacore::Int pixelmask, casacore::Record &region, const casacore::Bool list=false)
 set specified pixels or mask equal to provided scalar value More...
 

Protected Member Functions

CasacRegionManager::StokesControl _getStokesControl () const
 
std::vector
< casacore::Coordinate::Type
_getNecessaryCoordinates () const
 Represents the minimum set of coordinates necessary for the task to function. More...
 
casacore::Bool _hasLogfileSupport () const
 by default, derived classes are configured to have no log file support. More...
 
casacore::Bool _supportsMultipleRegions () const
 
- Protected Member Functions inherited from casa::ImageTask< T >
 ImageTask (const SPCIIT image, const casacore::String &region, const casacore::Record *const &regionPtr, const casacore::String &box, const casacore::String &chanInp, const casacore::String &stokes, const casacore::String &maskInp, const casacore::String &outname, casacore::Bool overwrite)
 if outname is empty, no image will be written if overwrite is True, if image already exists it will be removed if overwrite is False, if image already exists exception will be thrown More...
 
 ImageTask (const SPCIIT image, const casacore::Record *const &regionPtr, const casacore::String &mask, const casacore::String &outname, casacore::Bool overwrite)
 
virtual std::vector
< OutputDestinationChecker::OutputStruct
_getOutputStruct ()
 
virtual void _construct (casacore::Bool verbose=true)
 does the lion's share of constructing the object, ie checks validity of inputs, etc. More...
 
const SPCIIT _getImage () const
 
const casacore::String_getMask () const
 
const casacore::Record_getRegion () const
 
void _setStokes (const casacore::String &stokes)
 
const casacore::String_getStokes () const
 
const casacore::String_getChans () const
 
const casacore::String_getOutname () const
 
casacore::Bool _isPVImage () const
 Is the attached image a position-velocity (PV) image? More...
 
void _removeExistingOutfileIfNecessary () const
 
void _removeExistingFileIfNecessary (const casacore::String &filename, const casacore::Bool overwrite, casacore::Bool warnOnly=false) const
 if warnOnly is true, log a warning message if file exists and overwrite is true, else throw an exception. More...
 
casacore::String _summaryHeader () const
 
const std::shared_ptr
< casacore::LogIO
_getLog () const
 
casacore::Bool _getStretch () const
 
Bool _getSuppressHistory () const
 
const std::shared_ptr< LogFile_getLogFile () const
 
casacore::Bool _writeLogfile (const casacore::String &output, const casacore::Bool open=true, const casacore::Bool close=true)
 
casacore::Bool _openLogfile ()
 
void _closeLogfile () const
 
virtual casacore::Bool _supportsMultipleBeams () const
 does this task support images with multiple beams? false means it never does. More...
 
SPIIT _prepareOutputImage (const casacore::ImageInterface< T > &image, const casacore::Array< T > *const values, const casacore::ArrayLattice< casacore::Bool > *const mask=nullptr, const casacore::IPosition *const outShape=nullptr, const casacore::CoordinateSystem *const coordsys=nullptr, const casacore::String *const outname=nullptr, casacore::Bool overwrite=false, casacore::Bool dropDegen=false) const
 If outname != NULL, use the value supplied. More...
 
SPIIT _prepareOutputImage (const casacore::ImageInterface< T > &image, casacore::Bool dropDegen=false) const
 
SPIIT _prepareOutputImage (const casacore::ImageInterface< T > &image, const casacore::String &outname, casacore::Bool overwrite, casacore::Bool warnOnly) const
 if warnOnly is true, only log a warning message if the file exists and overwrite is true, else throw an excepction More...
 
SPIIT _prepareOutputImage (const casacore::ImageInterface< T > &image, const casacore::Lattice< T > &data) const
 data are copied to the output image from the data lattice. More...
 
Verbosity _getVerbosity () const
 
casacore::Bool _getOverwrite () const
 
virtual casacore::Bool _mustHaveSquareDirectionPixels () const
 
casacore::Bool _getDropDegen () const
 
template<class U >
void _doHistory (std::shared_ptr< casacore::ImageInterface< U >> &image) const
 
void _reportOldNewImageShapes (const ImageInterface< T > &out) const
 
void _reportOldNewImageShapes (const IPosition &outShape) const
 

Private Member Functions

void _checkUnit (const casacore::String &unit, const casacore::CoordinateSystem &csys, PixelValueManipulatorData::SpectralType specType) const
 
SPIIT _doComposite (casacore::uInt axis, const casacore::String &function, Operator op) const
 
SPIIT _doSingle (casacore::uInt axis, const casacore::String &function) const
 
casacore::Record _doWorld (SPIIT collapsed, const casacore::String &unit, PixelValueManipulatorData::SpectralType specType, const casacore::Quantity *const restFreq, const casacore::String &frame, casacore::uInt axis) const
 
void _doNoncomformantUnit (casacore::Vector< casacore::Double > &coords, const casacore::CoordinateSystem &csys, const casacore::String &unit, PixelValueManipulatorData::SpectralType specType, const casacore::Quantity *const restFreq, const casacore::String &axisUnit) const
 
casacore::Vector< casacore::uInt_npts (casacore::uInt axis) const
 

Private Attributes

casacore::IPosition _axes
 
casacore::IPosition _lastChunkShape
 
casacore::String _regionName
 

Static Private Attributes

static const casacore::String _className
 

Additional Inherited Members

- Static Protected Member Functions inherited from casa::ImageTask< T >
static void _copyMask (casacore::Lattice< casacore::Bool > &mask, const casacore::ImageInterface< T > &image)
 
static void _copyData (casacore::Lattice< T > &data, const casacore::Lattice< T > &image)
 

Detailed Description

template<class T>
class casa::PixelValueManipulator< T >

Definition at line 11 of file PixelValueManipulator.h.

Member Enumeration Documentation

template<class T >
enum casa::PixelValueManipulator::Operator

Top level interface for getting and setting image pixel values.

Etymology

Manipulates pixel values.

Synopsis

Top level interface for getting and setting image pixel values.

Example

Enumerator
ADDITION 
SUBTRACTION 
MULTIPLICATION 
DIVISION 
NONE 

Definition at line 35 of file PixelValueManipulator.h.

Constructor & Destructor Documentation

template<class T >
casa::PixelValueManipulator< T >::PixelValueManipulator ( )
delete
template<class T >
casa::PixelValueManipulator< T >::PixelValueManipulator ( const SPCIIT  image,
const casacore::Record *const  regionRec,
const casacore::String mask,
casacore::Bool  verboseDuringConstruction = casacore::True 
)

regionRec = 0 => no region selected, full image used mask = "" => No additional mask specification, although image default mask will be used if one exists.

template<class T >
casa::PixelValueManipulator< T >::~PixelValueManipulator ( )
inline

Definition at line 54 of file PixelValueManipulator.h.

Member Function Documentation

template<class T >
void casa::PixelValueManipulator< T >::_checkUnit ( const casacore::String unit,
const casacore::CoordinateSystem csys,
PixelValueManipulatorData::SpectralType  specType 
) const
private
template<class T >
SPIIT casa::PixelValueManipulator< T >::_doComposite ( casacore::uInt  axis,
const casacore::String function,
Operator  op 
) const
private
template<class T >
void casa::PixelValueManipulator< T >::_doNoncomformantUnit ( casacore::Vector< casacore::Double > &  coords,
const casacore::CoordinateSystem csys,
const casacore::String unit,
PixelValueManipulatorData::SpectralType  specType,
const casacore::Quantity *const  restFreq,
const casacore::String axisUnit 
) const
private
template<class T >
SPIIT casa::PixelValueManipulator< T >::_doSingle ( casacore::uInt  axis,
const casacore::String function 
) const
private
template<class T >
casacore::Record casa::PixelValueManipulator< T >::_doWorld ( SPIIT  collapsed,
const casacore::String unit,
PixelValueManipulatorData::SpectralType  specType,
const casacore::Quantity *const  restFreq,
const casacore::String frame,
casacore::uInt  axis 
) const
private
template<class T >
std::vector<casacore::Coordinate::Type> casa::PixelValueManipulator< T >::_getNecessaryCoordinates ( ) const
inlineprotectedvirtual

Represents the minimum set of coordinates necessary for the task to function.

Implements casa::ImageTask< T >.

Definition at line 211 of file PixelValueManipulator.h.

template<class T >
CasacRegionManager::StokesControl casa::PixelValueManipulator< T >::_getStokesControl ( ) const
inlineprotectedvirtual
template<class T >
casacore::Bool casa::PixelValueManipulator< T >::_hasLogfileSupport ( ) const
inlineprotectedvirtual

by default, derived classes are configured to have no log file support.

Reimplemented from casa::ImageTask< T >.

Definition at line 215 of file PixelValueManipulator.h.

template<class T >
casacore::Vector<casacore::uInt> casa::PixelValueManipulator< T >::_npts ( casacore::uInt  axis) const
private
template<class T >
casacore::Bool casa::PixelValueManipulator< T >::_supportsMultipleRegions ( ) const
inlineprotectedvirtual

Reimplemented from casa::ImageTask< T >.

Definition at line 217 of file PixelValueManipulator.h.

template<class T >
static void casa::PixelValueManipulator< T >::addNoise ( SPIIT  image,
const casacore::String type,
const casacore::Record region,
const casacore::Vector< casacore::Double > &  pars,
casacore::Bool  zero,
const std::pair< casacore::Int, casacore::Int > *const &  seeds 
)
static
template<class T >
static casacore::Record* casa::PixelValueManipulator< T >::coordMeasures ( casacore::Quantum< T > &  intensity,
casacore::Record direction,
casacore::Record frequency,
casacore::Record velocity,
SPCIIT  image,
const casacore::Vector< casacore::Double > &  pixel,
const casacore::String dirFrame,
const casacore::String freqFrame 
)
static

dirFrame and freqFrame are the codes for the frames for which it is desired that the returned measures should be specified.

In both cases, one can specify "native" for the native coordinate frame, "cl" for the conversion layer frame, or any valid frame string from casacore::MDirection::showType() or MFrequency::showType().

template<class T >
casacore::Record casa::PixelValueManipulator< T >::get ( ) const

Get pixel values, pixel mask values, etc.

The return casacore::Record has the following fields: 'values' => casacore::Array<T> of pixel values 'mask' => casacore::Array<casacore::Bool> of pixel mask values

template<class T >
casacore::String casa::PixelValueManipulator< T >::getClass ( ) const
inlinevirtual
template<class T >
casacore::Record casa::PixelValueManipulator< T >::getProfile ( casacore::uInt  axis,
const casacore::String function,
const casacore::String unit,
PixelValueManipulatorData::SpectralType  specType = PixelValueManipulatorData::DEFAULT,
const casacore::Quantity *const  restFreq = nullptr,
const casacore::String frame = "" 
)

get the aggregated values along the specified pixel axis using the region and mask at construction and any other mask the image may have.

Supported values of function are (case-insensitive, minimum match) those supported by ImageCollapser, ie "flux", "max", "mean", "median", "min", "rms", "sqrtsum", "sqrtsum_npix", sqrtsum_npix_beam", "stddev", "sum", "variance", and "zero". Aggregation of values occurs along all axes orthogonal to the one specified. One may specify the unit in which coordinate values are calculated using the unit parameter. If unit starts with "pix", then pixel coordinates are calculated, world coordinates otherwise. If pixel coordinates, the values are relative to the zeroth pixel on the corresponding axis of the input image. If specified and it doesn't start with "pix", the unit must be conformant with the unit of axis in the coordinate system of the image, or it must be a unit that this axis can be readily converted to (eg km/s if the axis is a frequency axis with base unit of Hz). If the selected axis is the spectral axis and if the unit is chosen to be something other than the native spectral coordinate unit (such as velocity or wavelength for a native frequency unit), specType indicates the system to use when converting the frequency. Values of RELATVISTIC, RADIO_VELOCITY, and OPTICAL_VELOCITY are only permitted if unit represents a velocity unit. Values of WAVELENGTH and AIR_WAVELENGTH are only permitted if unit represents a length unit. For a velocity unit, DEFAULT is equivalent to RELATIVISTIC. For a length unit, DEFAULT is equivalent to WAVELENGTH. If the selected axis is the spectral axis and unit is a velocity unit, restFreq represents the rest frequency with respect to which the velocity scale should be calculated. If null, the rest frequency associated with the spectral coordinate is used. If the selected axis is the spectral axis, and unit is a frequency unit, frame represents the frame of reference with respect to which the frequency scale should be calculated. If empty, the reference frame associated with the spectral coordinate is used. The return Record has the following keys: "values" is a casacore::Vector<T> containing the aggregate pixel values, "mask" is the associated mask values (Vector<Bool>), "coords" is a casacore::Vector<casacore::Double> of coordinate values, and "xUnit" is a casacore::String containing the coordinate unit, and "yUnit" is a string containing the ordinate unit.

template<class T >
casacore::Record casa::PixelValueManipulator< T >::getProfile ( casacore::uInt  axis,
ImageCollapserData::AggregateType  function,
const casacore::String unit,
PixelValueManipulatorData::SpectralType  specType = PixelValueManipulatorData::DEFAULT,
const casacore::Quantity *const  restFreq = nullptr,
const casacore::String frame = "" 
)
template<class T >
static casacore::Record* casa::PixelValueManipulator< T >::getSlice ( SPCIIT  image,
const casacore::Vector< casacore::Double > &  x,
const casacore::Vector< casacore::Double > &  y,
const casacore::Vector< casacore::Int > &  axes,
const casacore::Vector< casacore::Int > &  coord,
casacore::Int  npts = 0,
const casacore::String method = "linear" 
)
static

get a slice through the image.

The values are interpolated at regular intervals to provide samples at npts number of points. x and y are in pixel coordinates

template<class T >
static void casa::PixelValueManipulator< T >::insert ( casacore::ImageInterface< T > &  target,
const casacore::ImageInterface< T > &  image,
const casacore::Record region,
const casacore::Vector< casacore::Double > &  locatePixel,
casacore::Bool  verbose 
)
static

region refers to the region in the image to be inserted, not the region that was chosen at object construction

template<class T >
static void casa::PixelValueManipulator< T >::makeRegionBlock ( casacore::PtrBlock< const casacore::ImageRegion * > &  regions,
const casacore::Record Regions 
)
static

Make a block of regions from a Record public so ImageAnalysis can use it, once those methods have been excised, make private.

template<class T >
casacore::Record casa::PixelValueManipulator< T >::pixelValue ( const casacore::Vector< casacore::Int > &  pixel) const
template<class T >
void casa::PixelValueManipulator< T >::pixelValue ( casacore::Bool offImage,
casacore::Quantum< T > &  value,
casacore::Bool mask,
casacore::Vector< casacore::Int > &  pos 
) const
template<class T >
static void casa::PixelValueManipulator< T >::put ( SPIIT  image,
const casacore::Array< T > &  pixelsArray,
const casacore::Vector< casacore::Int > &  blc,
const casacore::Vector< casacore::Int > &  inc,
casacore::Bool  list,
casacore::Bool  locking,
casacore::Bool  replicate 
)
static
template<class T >
static casacore::Bool casa::PixelValueManipulator< T >::putRegion ( SPIIT  image,
const casacore::Array< T > &  pixels,
const casacore::Array< casacore::Bool > &  mask,
casacore::Record region,
casacore::Bool  list,
casacore::Bool  usemask,
casacore::Bool  replicateArray 
)
static
template<class T >
static casacore::Bool casa::PixelValueManipulator< T >::set ( SPIIF  image,
const casacore::String pixels,
const casacore::Int  pixelmask,
casacore::Record region,
const casacore::Bool  list = false 
)
static

set specified pixels or mask equal to provided scalar value

template<class T >
void casa::PixelValueManipulator< T >::setAxes ( const casacore::IPosition axes,
casacore::Bool  invert = false 
)

set axes to average over.

If invert is true, select all axes other than the specified axes to average over.

template<class T >
void casa::PixelValueManipulator< T >::setRegionName ( const casacore::String rname)
inline

set region name for logging purposes.

Only used if the logfile is set.

Definition at line 204 of file PixelValueManipulator.h.

References casa::PixelValueManipulator< T >::_regionName.

Member Data Documentation

template<class T >
casacore::IPosition casa::PixelValueManipulator< T >::_axes
private

Definition at line 220 of file PixelValueManipulator.h.

template<class T >
const casacore::String casa::PixelValueManipulator< T >::_className
staticprivate

Definition at line 222 of file PixelValueManipulator.h.

Referenced by casa::PixelValueManipulator< T >::getClass().

template<class T >
casacore::IPosition casa::PixelValueManipulator< T >::_lastChunkShape
private

Definition at line 220 of file PixelValueManipulator.h.

template<class T >
casacore::String casa::PixelValueManipulator< T >::_regionName
private

The documentation for this class was generated from the following file: