LArOpenCV
1
|
An abstract base class for ImageCluster algorithms. More...
#include <ImageClusterBase.h>
Public Member Functions | |
ImageClusterBase (const std::string name="noname") | |
Default constructor: Name is used to identify a configuration parameter set via larcv::ImageClusterManager. More... | |
virtual | ~ImageClusterBase () |
Default destructor. More... | |
const std::string & | Name () const |
Name accessor. More... | |
void | Configure (const ::fcllite::PSet &pset) |
Configuration method. More... | |
void | Profile (bool doit=true) |
Profile flag setter. More... | |
larcv::ContourArray_t | Process (const larcv::ContourArray_t &clusters, const ::cv::Mat &img, larcv::ImageMeta &meta) |
wrapper execution method: internally executes Process function (see there for details) More... | |
size_t | ProcessCount () const |
Process count. More... | |
double | ProcessTime () const |
Process time. More... | |
const larcv::logger & | logger () const |
Logger getter. More... | |
void | set_verbosity (::larcv::msg::Level_t level) |
Verbosity level. More... | |
Protected Member Functions | |
virtual void | _Configure_ (const ::fcllite::PSet &pset)=0 |
Inherited class configuration method. More... | |
virtual larcv::ContourArray_t | _Process_ (const larcv::ContourArray_t &clusters, const ::cv::Mat &img, larcv::ImageMeta &meta)=0 |
Execution method: given previous algorithm's output clusters, image, and metadata to be updated, produce clusters. More... | |
Private Attributes | |
std::string | _name |
name identifier, used to fetch configuration More... | |
larcv::Watch | _watch |
algorithm profile stopwatch More... | |
double | _proc_time |
algorithm execution time record (cumulative) More... | |
size_t | _proc_count |
algorithm execution counter (cumulative) More... | |
bool | _profile |
measure process time if profile flag is on More... | |
An abstract base class for ImageCluster algorithms.
Its role is to construct a set of "cluster" given an image.
An algorithm instance is expected to be "configured" and "executed" via larcv::ImageClusterManager, though a user
can perform those actions by hand (which may be useful for development work) as well if wished.
larcv::ImageClusterManager executes a chain of algorithms that inherit from ImageClusterBase. Each algorithm instance
receives an image, information about previous algorithm's clustering result, and meta data to be updated for resulting
clusters from it. See larcv::ImageClusterManager for more details.
Configuration parameters are passed via fhicllite::PSet (which is constructed via larcv::ImageClusterManager)
and a derived class must implement ImageClusterBase::Configure abstruct method. An execution of an algorithm
is done inside an abstract method ImageClusterBase::Process method which must be implemented in a child class.
A cluster is represented as a 2D contour (larcv::Contour_t). The execution method recieves 3 inputs: 0) a set of
pre-defined clusters (typically a set of clusters created by the previous algorithm in a chain executed by
larcv::ImageClusterManager), 1) cv::Mat representing 2D image, and 2) larcv::ImageMeta which contains meta data
of 1) and should be updated to interpret the algorithm's return larcv::Contour_t if needed.
Definition at line 43 of file ImageClusterBase.h.
larcv::ImageClusterBase::ImageClusterBase | ( | const std::string | name = "noname" ) |
Default constructor: Name is used to identify a configuration parameter set via larcv::ImageClusterManager.
Definition at line 8 of file ImageClusterBase.cxx.
References LARCV_DEBUG.
|
inlinevirtual |
|
protectedpure virtual |
Inherited class configuration method.
Implemented in larcv::EmptyImageCluster, larcv::ToyImageCluster, and larcv::SBCluster.
Referenced by Configure().
|
protectedpure virtual |
Execution method: given previous algorithm's output clusters, image, and metadata to be updated, produce clusters.
Each cluster is represented by larcv::Contour_t. The first argument is clusters created by a previous
algorithm's execution (ignore if not needed). The second argumnet is the image to be wokred on. The
third argument is meta data to interpret a returned clusters (i.e. update metadata if return clusters
do not use the same coordinate reference as provided image, else leave unchanged).
Implemented in larcv::EmptyImageCluster, larcv::ToyImageCluster, and larcv::SBCluster.
Referenced by Process().
void larcv::ImageClusterBase::Configure | ( | const ::fcllite::PSet & | pset) |
Configuration method.
Definition at line 16 of file ImageClusterBase.cxx.
References _Configure_(), _profile, LARCV_DEBUG, and larcv::laropencv_base::set_verbosity().
|
inlineinherited |
Logger getter.
Definition at line 43 of file laropencv_base.h.
References larcv::laropencv_base::_logger.
Referenced by larcv::ImageClusterManager::Configure().
|
inline |
ContourArray_t larcv::ImageClusterBase::Process | ( | const larcv::ContourArray_t & | clusters, |
const ::cv::Mat & | img, | ||
larcv::ImageMeta & | meta | ||
) |
wrapper execution method: internally executes Process function (see there for details)
Definition at line 27 of file ImageClusterBase.cxx.
References _proc_count, _proc_time, _Process_(), _profile, _watch, larcv::Watch::Start(), and larcv::Watch::WallTime().
|
inline |
|
inline |
|
inline |
|
inlineinherited |
Verbosity level.
Definition at line 47 of file laropencv_base.h.
References larcv::laropencv_base::_logger.
Referenced by Configure(), and larcv::ImageClusterManager::Configure().
|
private |
name identifier, used to fetch configuration
Definition at line 92 of file ImageClusterBase.h.
Referenced by Name().
|
private |
algorithm execution counter (cumulative)
Definition at line 98 of file ImageClusterBase.h.
Referenced by Process(), and ProcessCount().
|
private |
algorithm execution time record (cumulative)
Definition at line 96 of file ImageClusterBase.h.
Referenced by Process(), and ProcessTime().
|
private |
measure process time if profile flag is on
Definition at line 100 of file ImageClusterBase.h.
Referenced by Configure(), Process(), and Profile().
|
private |
algorithm profile stopwatch
Definition at line 94 of file ImageClusterBase.h.
Referenced by Process().