#include <ImageTask.h>
Public Types | |
enum | Verbosity { QUIET, WHISPER, LOW, NORMAL, HIGH, NOISY, DEAFENING } |
Virtual base class for image analysis tasks. More... | |
Public Member Functions | |
virtual | ~ImageTask () |
virtual String | getClass () const =0 |
void | setStretch (const Bool stretch) |
void | setLogfile (const String &lf) |
tacitly does nothing if lf is the empty string. | |
void | setLogfileAppend (const Bool a) |
void | setRegion (const Record ®ion) |
void | setMask (const String &mask) |
void | setVerbosity (Verbosity verbosity) |
void | addHistory (const vector< std::pair< String, String > > &msgs) const |
These messages will appear in the product image history upon the call to _prepareOutputImage(). | |
void | addHistory (const LogOrigin &origin, const String &msg) const |
void | addHistory (const LogOrigin &origin, const vector< String > &msgs) const |
void | addHistory (const LogOrigin &origin, const String &taskname, const vector< String > ¶mNames, const vector< casac::variant > ¶mValues) const |
This adds standard history messages regarding the task that was run and input parameters used. | |
void | suppressHistoryWriting (Bool b) |
suppress writing the history on _prepareOutputImage() call. | |
vector< std::pair< String, String > > | getHistory () |
get the history associated with the task. | |
void | setDropDegen (Bool d) |
Protected Member Functions | |
ImageTask (const SPCIIT image, const String ®ion, const Record *const ®ionPtr, const String &box, const String &chanInp, const String &stokes, const String &maskInp, const String &outname, 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 | |
ImageTask (const SPCIIT image, const Record *const ®ionPtr, const String &mask, const String &outname, Bool overwrite) | |
virtual CasacRegionManager::StokesControl | _getStokesControl () const =0 |
virtual std::vector < OutputDestinationChecker::OutputStruct > | _getOutputStruct () |
virtual void | _construct (Bool verbose=True) |
does the lion's share of constructing the object, ie checks validity of inputs, etc. | |
const SPCIIT | _getImage () const |
const String & | _getMask () const |
const Record * | _getRegion () const |
void | _setStokes (const String &stokes) |
const String & | _getStokes () const |
const String & | _getChans () const |
const String & | _getOutname () const |
virtual std::vector < Coordinate::Type > | _getNecessaryCoordinates () const =0 |
Represents the minimum set of coordinates necessary for the task to function. | |
void | _removeExistingOutfileIfNecessary () const |
void | _removeExistingFileIfNecessary (const String &filename, const Bool overwrite, Bool warnOnly=False) const |
if warnOnly is True, log a warning message if file exists and overwrite is True, else throw an exception. | |
String | _summaryHeader () const |
const SHARED_PTR< LogIO > | _getLog () const |
virtual Bool | _hasLogfileSupport () const |
by default, derived classes are configured to have no log file support. | |
Bool | _getStretch () const |
const SHARED_PTR< LogFile > | _getLogFile () const |
Bool | _writeLogfile (const String &output, const Bool open=True, const Bool close=True) |
Bool | _openLogfile () |
void | _closeLogfile () const |
virtual Bool | _supportsMultipleRegions () const |
virtual Bool | _supportsMultipleBeams () const |
does this task support images with multiple beams? False means it never does. | |
SPIIT | _prepareOutputImage (const ImageInterface< T > &image, const Array< T > *const values, const ArrayLattice< Bool > *const mask=nullptr, const IPosition *const outShape=nullptr, const CoordinateSystem *const coordsys=nullptr, const String *const outname=nullptr, Bool overwrite=False, Bool dropDegen=False) const |
If outname != NULL, use the value supplied. | |
SPIIT | _prepareOutputImage (const ImageInterface< T > &image, Bool dropDegen=False) const |
SPIIT | _prepareOutputImage (const ImageInterface< T > &image, const String &outname, Bool overwrite, Bool warnOnly) const |
if warnOnly is True, only log a warning message if the file exists and overwrite is True, else throw an excepction | |
SPIIT | _prepareOutputImage (const ImageInterface< T > &image, const Lattice< T > &data) const |
data are copied to the output image from the data lattice. | |
Verbosity | _getVerbosity () const |
Bool | _getOverwrite () const |
virtual Bool | _mustHaveSquareDirectionPixels () const |
Bool | _getDropDegen () const |
template<class U > | |
void | _doHistory (SHARED_PTR< ImageInterface< U >> &image) const |
Static Protected Member Functions | |
static void | _copyMask (Lattice< Bool > &mask, const ImageInterface< T > &image) |
static void | _copyData (Lattice< T > &data, const ImageInterface< T > &image) |
Private Attributes | |
const SPCIIT | _image |
SHARED_PTR< LogIO > | _log |
const Record *const | _regionPtr |
Record | _regionRecord |
String | _region |
String | _box |
String | _chan |
String | _stokesString |
String | _mask |
String | _outname |
Bool | _overwrite |
Bool | _stretch |
Bool | _logfileAppend |
Bool | _suppressHistory |
Bool | _dropDegen |
std::unique_ptr< FiledesIO > | _logFileIO |
Verbosity | _verbosity |
SHARED_PTR< LogFile > | _logfile |
vector< std::pair< String, String > > | _newHistory |
C11Timer | _timer |
Definition at line 22 of file ImageTask.h.
enum casa::ImageTask::Verbosity |
Virtual base class for image analysis tasks.
Image tasking
Virtual base class for image tasking. verbosity levels
Definition at line 45 of file ImageTask.h.
virtual casa::ImageTask< T >::~ImageTask | ( | ) | [virtual] |
casa::ImageTask< T >::ImageTask | ( | const SPCIIT | image, | |
const String & | region, | |||
const Record *const & | regionPtr, | |||
const String & | box, | |||
const String & | chanInp, | |||
const String & | stokes, | |||
const String & | maskInp, | |||
const String & | outname, | |||
Bool | overwrite | |||
) | [protected] |
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
casa::ImageTask< T >::ImageTask | ( | const SPCIIT | image, | |
const Record *const & | regionPtr, | |||
const String & | mask, | |||
const String & | outname, | |||
Bool | overwrite | |||
) | [protected] |
void casa::ImageTask< T >::_closeLogfile | ( | ) | const [protected] |
virtual void casa::ImageTask< T >::_construct | ( | Bool | verbose = True |
) | [protected, virtual] |
does the lion's share of constructing the object, ie checks validity of inputs, etc.
static void casa::ImageTask< T >::_copyData | ( | Lattice< T > & | data, | |
const ImageInterface< T > & | image | |||
) | [static, protected] |
static void casa::ImageTask< T >::_copyMask | ( | Lattice< Bool > & | mask, | |
const ImageInterface< T > & | image | |||
) | [static, protected] |
void casa::ImageTask< T >::_doHistory | ( | SHARED_PTR< ImageInterface< U >> & | image | ) | const [inline, protected] |
const String& casa::ImageTask< T >::_getChans | ( | ) | const [inline, protected] |
Definition at line 140 of file ImageTask.h.
Bool casa::ImageTask< T >::_getDropDegen | ( | ) | const [inline, protected] |
Definition at line 223 of file ImageTask.h.
const SPCIIT casa::ImageTask< T >::_getImage | ( | ) | const [inline, protected] |
Definition at line 130 of file ImageTask.h.
const SHARED_PTR<LogIO> casa::ImageTask< T >::_getLog | ( | ) | const [inline, protected] |
Definition at line 158 of file ImageTask.h.
const SHARED_PTR<LogFile> casa::ImageTask< T >::_getLogFile | ( | ) | const [protected] |
const String& casa::ImageTask< T >::_getMask | ( | ) | const [inline, protected] |
Definition at line 132 of file ImageTask.h.
virtual std::vector<Coordinate::Type> casa::ImageTask< T >::_getNecessaryCoordinates | ( | ) | const [protected, pure virtual] |
Represents the minimum set of coordinates necessary for the task to function.
Implemented in casa::ComponentImager, casa::Image1DSmoother< T >, casa::Image2DConvolver< T >, casa::ImageCollapser< T >, casa::ImageConcatenator< T >, casa::ImageConvolverTask< T >, casa::ImageCropper< T >, casa::ImageDecimator< T >, casa::ImageDecomposerTask< T >, casa::ImageFFTer< T >, casa::ImageFitter, casa::ImageHistogramsCalculator, casa::ImageMaskedPixelReplacer< T >, casa::ImageMaxFitter< T >, casa::ImageMomentsTask< T >, casa::ImagePadder, casa::ImagePrimaryBeamCorrector, casa::ImageProfileFitter, casa::ImageRebinner< T >, casa::ImageRegridderBase< T >, casa::ImageRotator, casa::ImageSourceFinder< T >, casa::ImageStatsCalculator, casa::ImageTransposer, casa::PeakIntensityFluxDensityConverter, casa::PixelValueManipulator< T >, casa::PVGenerator, casa::SepImageConvolverTask< T >, casa::TwoPointCorrelator< T >, casa::ImageRegridderBase< Float >, and casa::ImageRegridderBase< Complex >.
const String& casa::ImageTask< T >::_getOutname | ( | ) | const [inline, protected] |
Definition at line 142 of file ImageTask.h.
virtual std::vector<OutputDestinationChecker::OutputStruct> casa::ImageTask< T >::_getOutputStruct | ( | ) | [protected, virtual] |
Reimplemented in casa::ImageFitter, casa::ImageProfileFitter, and casa::ImageStatsCalculator.
Bool casa::ImageTask< T >::_getOverwrite | ( | ) | const [inline, protected] |
Definition at line 219 of file ImageTask.h.
const Record* casa::ImageTask< T >::_getRegion | ( | ) | const [inline, protected] |
Definition at line 134 of file ImageTask.h.
const String& casa::ImageTask< T >::_getStokes | ( | ) | const [inline, protected] |
Definition at line 138 of file ImageTask.h.
virtual CasacRegionManager::StokesControl casa::ImageTask< T >::_getStokesControl | ( | ) | const [protected, pure virtual] |
Implemented in casa::ComponentImager, casa::Image1DSmoother< T >, casa::Image2DConvolver< T >, casa::ImageCollapser< T >, casa::ImageConcatenator< T >, casa::ImageConvolverTask< T >, casa::ImageCropper< T >, casa::ImageDecimator< T >, casa::ImageDecomposerTask< T >, casa::ImageFFTer< T >, casa::ImageFitter, casa::ImageHistogramsCalculator, casa::ImageMaskedPixelReplacer< T >, casa::ImageMaxFitter< T >, casa::ImageMomentsTask< T >, casa::ImagePadder, casa::ImagePrimaryBeamCorrector, casa::ImageProfileFitter, casa::ImageRebinner< T >, casa::ImageRegridderBase< T >, casa::ImageRotator, casa::ImageSourceFinder< T >, casa::ImageStatsCalculator, casa::ImageTransposer, casa::PeakIntensityFluxDensityConverter, casa::PixelValueManipulator< T >, casa::PVGenerator, casa::SepImageConvolverTask< T >, casa::TwoPointCorrelator< T >, casa::ImageRegridderBase< Float >, and casa::ImageRegridderBase< Complex >.
Bool casa::ImageTask< T >::_getStretch | ( | ) | const [inline, protected] |
Definition at line 164 of file ImageTask.h.
Verbosity casa::ImageTask< T >::_getVerbosity | ( | ) | const [inline, protected] |
Definition at line 217 of file ImageTask.h.
virtual Bool casa::ImageTask< T >::_hasLogfileSupport | ( | ) | const [inline, protected, virtual] |
by default, derived classes are configured to have no log file support.
Reimplemented in casa::ImageFitter, casa::ImageProfileFitter, casa::ImageStatsCalculator, and casa::PixelValueManipulator< T >.
Definition at line 162 of file ImageTask.h.
virtual Bool casa::ImageTask< T >::_mustHaveSquareDirectionPixels | ( | ) | const [inline, protected, virtual] |
Reimplemented in casa::PVGenerator.
Definition at line 221 of file ImageTask.h.
Bool casa::ImageTask< T >::_openLogfile | ( | ) | [protected] |
SPIIT casa::ImageTask< T >::_prepareOutputImage | ( | const ImageInterface< T > & | image, | |
const Lattice< T > & | data | |||
) | const [protected] |
data are copied to the output image from the data
lattice.
The mask is copied from the input image.
SPIIT casa::ImageTask< T >::_prepareOutputImage | ( | const ImageInterface< T > & | image, | |
const String & | outname, | |||
Bool | overwrite, | |||
Bool | warnOnly | |||
) | const [protected] |
if warnOnly is True, only log a warning message if the file exists and overwrite is True, else throw an excepction
SPIIT casa::ImageTask< T >::_prepareOutputImage | ( | const ImageInterface< T > & | image, | |
Bool | dropDegen = False | |||
) | const [protected] |
SPIIT casa::ImageTask< T >::_prepareOutputImage | ( | const ImageInterface< T > & | image, | |
const Array< T > *const | values, | |||
const ArrayLattice< Bool > *const | mask = nullptr , |
|||
const IPosition *const | outShape = nullptr , |
|||
const CoordinateSystem *const | coordsys = nullptr , |
|||
const String *const | outname = nullptr , |
|||
Bool | overwrite = False , |
|||
Bool | dropDegen = False | |||
) | const [protected] |
If outname != NULL, use the value supplied.
If is NULL, use the value of _outname. Create a TempImage or PagedImage depending if outname/_outname is empty or not. Generally meant for the image to be returned to the UI or the final image product that the user will want. values=0 => the pixel values from the image will be used mask=0 => the mask attached to the image, if any will be used, outShape=0 => use image shape, coordsys=0 => use image coordinate system. overwrite is only used if outname != NULL.
SPIIT _prepareOutputImage(const ImageInterface<T>& image) const;
void casa::ImageTask< T >::_removeExistingFileIfNecessary | ( | const String & | filename, | |
const Bool | overwrite, | |||
Bool | warnOnly = False | |||
) | const [protected] |
if warnOnly is True, log a warning message if file exists and overwrite is True, else throw an exception.
void casa::ImageTask< T >::_removeExistingOutfileIfNecessary | ( | ) | const [protected] |
void casa::ImageTask< T >::_setStokes | ( | const String & | stokes | ) | [inline, protected] |
Definition at line 136 of file ImageTask.h.
String casa::ImageTask< T >::_summaryHeader | ( | ) | const [protected] |
virtual Bool casa::ImageTask< T >::_supportsMultipleBeams | ( | ) | const [inline, protected, virtual] |
does this task support images with multiple beams? False means it never does.
True means it does, but not necessarily in all cases (in which case, the derived class is responsible for checking for and throwing exceptions in those cases).
Reimplemented in casa::Image1DSmoother< T >, casa::ImageDecimator< T >, casa::ImageDecomposerTask< T >, casa::ImageMaxFitter< T >, casa::ImageMomentsTask< T >, casa::ImageSourceFinder< T >, and casa::TwoPointCorrelator< T >.
Definition at line 182 of file ImageTask.h.
virtual Bool casa::ImageTask< T >::_supportsMultipleRegions | ( | ) | const [inline, protected, virtual] |
Reimplemented in casa::Image2DConvolver< T >, casa::ImageCollapser< T >, casa::ImageConvolverTask< T >, casa::ImageDecimator< T >, casa::ImageFitter, casa::ImageHistogramsCalculator, casa::ImageMomentsTask< T >, casa::ImageProfileFitter, casa::ImageRotator, casa::ImageSourceFinder< T >, casa::ImageStatsCalculator, casa::PixelValueManipulator< T >, and casa::SepImageConvolverTask< T >.
Definition at line 177 of file ImageTask.h.
Bool casa::ImageTask< T >::_writeLogfile | ( | const String & | output, | |
const Bool | open = True , |
|||
const Bool | close = True | |||
) | [protected] |
void casa::ImageTask< T >::addHistory | ( | const LogOrigin & | origin, | |
const String & | taskname, | |||
const vector< String > & | paramNames, | |||
const vector< casac::variant > & | paramValues | |||
) | const |
This adds standard history messages regarding the task that was run and input parameters used.
The vectors must have the same length
void casa::ImageTask< T >::addHistory | ( | const LogOrigin & | origin, | |
const vector< String > & | msgs | |||
) | const |
void casa::ImageTask< T >::addHistory | ( | const LogOrigin & | origin, | |
const String & | msg | |||
) | const |
void casa::ImageTask< T >::addHistory | ( | const vector< std::pair< String, String > > & | msgs | ) | const |
These messages will appear in the product image history upon the call to _prepareOutputImage().
They will be located immediately after the input image's copied history. The first value in the pair is the log origin. The second is the associated message. If this method is called more than once on the same object, messages from subsequent calls are appended to the end of messages set in prior calls.
virtual String casa::ImageTask< T >::getClass | ( | ) | const [pure virtual] |
Implemented in casa::ComplexImageRegridder, casa::ComponentImager, casa::Image1DSmoother< T >, casa::Image2DConvolver< T >, casa::ImageBoxcarSmoother< T >, casa::ImageCollapser< T >, casa::ImageConcatenator< T >, casa::ImageConvolverTask< T >, casa::ImageCropper< T >, casa::ImageDecimator< T >, casa::ImageDecomposerTask< T >, casa::ImageFFTer< T >, casa::ImageFitter, casa::ImageHanningSmoother< T >, casa::ImageHistogramsCalculator, casa::ImageMaskedPixelReplacer< T >, casa::ImageMaxFitter< T >, casa::ImageMomentsTask< T >, casa::ImagePadder, casa::ImagePrimaryBeamCorrector, casa::ImageProfileFitter, casa::ImageRebinner< T >, casa::ImageRegridder, casa::ImageRotator, casa::ImageSourceFinder< T >, casa::ImageStatsCalculator, casa::ImageTransposer, casa::PeakIntensityFluxDensityConverter, casa::PixelValueManipulator< T >, casa::PVGenerator, casa::SepImageConvolverTask< T >, and casa::TwoPointCorrelator< T >.
vector<std::pair<String, String> > casa::ImageTask< T >::getHistory | ( | ) | [inline] |
get the history associated with the task.
Does not include the history of the input image.
Definition at line 97 of file ImageTask.h.
void casa::ImageTask< T >::setDropDegen | ( | Bool | d | ) | [inline] |
Definition at line 99 of file ImageTask.h.
void casa::ImageTask< T >::setLogfile | ( | const String & | lf | ) |
tacitly does nothing if lf
is the empty string.
void casa::ImageTask< T >::setLogfileAppend | ( | const Bool | a | ) |
void casa::ImageTask< T >::setMask | ( | const String & | mask | ) | [inline] |
Definition at line 68 of file ImageTask.h.
void casa::ImageTask< T >::setRegion | ( | const Record & | region | ) |
void casa::ImageTask< T >::setStretch | ( | const Bool | stretch | ) | [inline] |
Definition at line 59 of file ImageTask.h.
void casa::ImageTask< T >::setVerbosity | ( | Verbosity | verbosity | ) | [inline] |
Definition at line 70 of file ImageTask.h.
void casa::ImageTask< T >::suppressHistoryWriting | ( | Bool | b | ) | [inline] |
suppress writing the history on _prepareOutputImage() call.
Useful for not writing history to intermediate image products.
Definition at line 93 of file ImageTask.h.
String casa::ImageTask< T >::_box [private] |
Definition at line 237 of file ImageTask.h.
String casa::ImageTask< T >::_chan [private] |
Definition at line 238 of file ImageTask.h.
Referenced by casa::ImageTask< Complex >::_getChans().
Bool casa::ImageTask< T >::_dropDegen [private] |
Definition at line 246 of file ImageTask.h.
Referenced by casa::ImageTask< Complex >::_getDropDegen(), and casa::ImageTask< Complex >::setDropDegen().
const SPCIIT casa::ImageTask< T >::_image [private] |
Reimplemented in casa::ComponentImager, and casa::ImageMaskedPixelReplacer< T >.
Definition at line 232 of file ImageTask.h.
Referenced by casa::ImageTask< Complex >::_getImage().
SHARED_PTR<LogIO> casa::ImageTask< T >::_log [mutable, private] |
Definition at line 233 of file ImageTask.h.
Referenced by casa::ImageTask< Complex >::_getLog().
SHARED_PTR<LogFile> casa::ImageTask< T >::_logfile [private] |
Definition at line 249 of file ImageTask.h.
Bool casa::ImageTask< T >::_logfileAppend [private] |
Definition at line 244 of file ImageTask.h.
std::unique_ptr<FiledesIO> casa::ImageTask< T >::_logFileIO [private] |
Definition at line 247 of file ImageTask.h.
String casa::ImageTask< T >::_mask [private] |
Definition at line 240 of file ImageTask.h.
Referenced by casa::ImageTask< Complex >::_getMask(), and casa::ImageTask< Complex >::setMask().
vector<std::pair<String, String> > casa::ImageTask< T >::_newHistory [mutable, private] |
Definition at line 250 of file ImageTask.h.
Referenced by casa::ImageTask< Complex >::getHistory().
String casa::ImageTask< T >::_outname [private] |
Definition at line 241 of file ImageTask.h.
Referenced by casa::ImageTask< Complex >::_getOutname().
Bool casa::ImageTask< T >::_overwrite [private] |
Reimplemented in casa::ImageProfileFitter.
Definition at line 242 of file ImageTask.h.
Referenced by casa::ImageTask< Complex >::_getOverwrite().
String casa::ImageTask< T >::_region [private] |
Definition at line 236 of file ImageTask.h.
const Record* const casa::ImageTask< T >::_regionPtr [private] |
Definition at line 234 of file ImageTask.h.
Record casa::ImageTask< T >::_regionRecord [private] |
Definition at line 235 of file ImageTask.h.
Referenced by casa::ImageTask< Complex >::_getRegion().
String casa::ImageTask< T >::_stokesString [private] |
Definition at line 239 of file ImageTask.h.
Referenced by casa::ImageTask< Complex >::_getStokes(), and casa::ImageTask< Complex >::_setStokes().
Bool casa::ImageTask< T >::_stretch [private] |
Definition at line 243 of file ImageTask.h.
Referenced by casa::ImageTask< Complex >::_getStretch(), and casa::ImageTask< Complex >::setStretch().
Bool casa::ImageTask< T >::_suppressHistory [private] |
Definition at line 245 of file ImageTask.h.
Referenced by casa::ImageTask< Complex >::suppressHistoryWriting().
C11Timer casa::ImageTask< T >::_timer [mutable, private] |
Definition at line 252 of file ImageTask.h.
Verbosity casa::ImageTask< T >::_verbosity [private] |
Definition at line 248 of file ImageTask.h.
Referenced by casa::ImageTask< Complex >::_getVerbosity(), and casa::ImageTask< Complex >::setVerbosity().