Gaia
|
A region is a physical location in the point layout which consists in a list of segments. More...
#include <region.h>
Public Member Functions | |
Region & | merge (const Region &r) |
Merges another Region with this one. More... | |
DescriptorType | type () const |
Returns the descriptor type if all segments within this region are of the same type. More... | |
DescriptorLengthType | lengthType () const |
Returns the descriptor length type if all segments within this region are of the same type. More... | |
int | index () const |
Returns the index corresponding to the descriptor contained in this region if and only if this region is composed of a single segment of size 1 (eg: it only contains one single descriptor). More... | |
int | index (DescriptorType type, DescriptorLengthType ltype) const |
Does the same thing as the index() method without arguments, but also checks if the region type is of the specified type and the length-type is the same also, otherwise throws an error. | |
int | index (DescriptorLengthType ltype) const |
Does the same thing as the index() method without arguments, but also checks if the length type is the same. | |
void | checkTypeOnlyFrom (DescriptorType type, const PointLayout *layout=0) const |
Checks that all segments in this region are of the same type. More... | |
bool | isTypeOnlyFrom (DescriptorType type) const |
Returns whether all segments in this region are of the same given type. | |
void | checkLengthTypeOnlyFrom (DescriptorLengthType ltype, const PointLayout *layout=0) const |
Checks that all segments in this region are of the same length type. More... | |
bool | isLengthTypeOnlyFrom (DescriptorLengthType type) const |
Returns whether all segments in this region are of the same given length type. | |
void | checkSingleDescriptor () const |
Checks that this Region is composed of only 1 descriptor. More... | |
int | dimension (DescriptorType type=UndefinedType, const Point *p=0) const |
Returns the total dimension of all the fields of the specified type in the given point. More... | |
const Segment & | segment () const |
If this region corresponds to a single descriptor, returns its corresponding Segment. More... | |
const Segment & | segment (DescriptorType type) const |
If this region corresponds to a single descriptor of the specified type, returns its corresponding Segment. More... | |
int | size (DescriptorType type, DescriptorLengthType ltype) const |
Returns the size of the part of the region which is of the specified type and length type, eg: the sum of the sizes of its segments. | |
QVector< int > | listIndices (DescriptorType type, DescriptorLengthType ltype) const |
Region | select (DescriptorType type) const |
Returns a new region which is a subset of this one and contains all the segments of the specified type. | |
Region | select (DescriptorType type, DescriptorLengthType ltype) const |
Returns a new region which is a subset of this one and contains all the segments of the specified type. | |
QString | toString () const |
void | debug () |
void | canonical () |
Tries to simplify segments if there are contiguous segments, ie: [0,10[ U [10,20[ = [0,20[. More... | |
Public Attributes | |
QString | name |
QList< Segment > | segments |
A region is a physical location in the point layout which consists in a list of segments.
It does not require all the segments to be of the same type.
void Region::canonical | ( | ) |
Tries to simplify segments if there are contiguous segments, ie: [0,10[ U [10,20[ = [0,20[.
Referenced by gaia2::DescriptorTree::correspondingRegion(), and gaia2::PointLayout::descriptorLocation().
void Region::checkLengthTypeOnlyFrom | ( | DescriptorLengthType | ltype, |
const PointLayout * | layout = 0 |
||
) | const |
Checks that all segments in this region are of the same length type.
Does nothing on success, and throws an exception if this condition is not fulfilled.
You can optionally specify a PointLayout, which is only used for giving full descriptor names in case of an error.
References gaia2::PointLayout::descriptorName().
Referenced by gaia2::getRegionMeanVar(), and gaia2::getRegionMinMax().
void Region::checkSingleDescriptor | ( | ) | const |
Checks that this Region is composed of only 1 descriptor.
Does nothing on success and throws an exception if this condition is not fulfilled.
void Region::checkTypeOnlyFrom | ( | DescriptorType | type, |
const PointLayout * | layout = 0 |
||
) | const |
Checks that all segments in this region are of the same type.
Does nothing on success, and throws an exception if this condition is not fulfilled.
You can optionally specify a PointLayout, which is only used for giving full descriptor names in case of an error.
References gaia2::PointLayout::descriptorName().
int Region::dimension | ( | DescriptorType | type = UndefinedType , |
const Point * | p = 0 |
||
) | const |
Returns the total dimension of all the fields of the specified type in the given point.
Note: you need to specify a point because of variable-length fields which change from one point to another.
Referenced by gaia2::RCA::computeCovarianceMatrix(), gaia2::FrozenDataSet::fromDataSet(), gaia2::mergeDescriptors(), and gaia2::DataSet::simplifyHistory().
int Region::index | ( | ) | const |
Returns the index corresponding to the descriptor contained in this region if and only if this region is composed of a single segment of size 1 (eg: it only contains one single descriptor).
Throws an error if the region is empty or contains more than one descriptor.
Referenced by gaia2::SVMPredict::mapDataSet(), gaia2::SVMPredict::mapPoint(), and gaia2::Point::switchLayout().
DescriptorLengthType Region::lengthType | ( | ) | const |
Returns the descriptor length type if all segments within this region are of the same type.
GaiaException | if region is empty or if there are at least 2 segments of different types in this region. |
Referenced by gaia2::PointLayout::canMorphInto(), gaia2::FrozenDataSet::checkValidFrozenDataSet(), gaia2::PointLayout::differenceWith(), gaia2::SVMPredict::mapDataSet(), gaia2::SVMPredict::mapPoint(), and gaia2::PointLayout::symmetricDifferenceWith().
Merges another Region with this one.
Surely there is an algorithmically "smart" way to do this...
Referenced by gaia2::DescriptorTree::correspondingRegion(), and gaia2::PointLayout::descriptorLocation().
const Segment & Region::segment | ( | ) | const |
If this region corresponds to a single descriptor, returns its corresponding Segment.
Throws an exception otherwise.
Referenced by gaia2::Point::checkValidSegment(), gaia2::FrozenDataSet::fromDataSet(), gaia2::Distribute::mapPoint(), and gaia2::mergeLayouts().
const Segment & Region::segment | ( | DescriptorType | type | ) | const |
If this region corresponds to a single descriptor of the specified type, returns its corresponding Segment.
Throws an exception otherwise.
DescriptorType Region::type | ( | ) | const |
Returns the descriptor type if all segments within this region are of the same type.
GaiaException | if region is empty or if there are at least 2 segments of different types in this region. |
Referenced by gaia2::PointLayout::canMorphInto(), gaia2::PointLayout::differenceWith(), gaia2::mapRegionIndicesToNames(), gaia2::mergeDescriptors(), gaia2::Point::switchLayout(), and gaia2::PointLayout::symmetricDifferenceWith().