1.8.0
CCC
 
Loading...
Searching...
No Matches
gstlrn::NeighImage Class Reference

Image Neighborhood definition. More...

#include <NeighImage.hpp>

Inheritance diagram for gstlrn::NeighImage:
gstlrn::ANeigh gstlrn::ASpaceObject gstlrn::ASerializable gstlrn::ICloneable gstlrn::AStringable

Detailed Description

Image Neighborhood definition.

The Neighborhood is usually meant to select a sub-population from the input Data Base, containing the active samples close to the target.

This Neighborhood is only defined in the case when the Data and the Target belong to the same grid. This neighborhood is defined as a rectangular set of pixels, located around the target. This rectangle is given by its half-extension in each space dimension (called 'radius') As the number of pixels grows fast with the space dimension, it is offered to sample them by specifying a skipping factor, so as to retain only 1 / (1 + skip) of them.

Public Member Functions

 NeighImage (const 1 &radius=1(), Id skip=0, const ASpaceSharedPtr &space=ASpaceSharedPtr())
 
 NeighImage (const NeighImage &r)
 
NeighImageoperator= (const NeighImage &r)
 
virtual ~NeighImage ()
 
void getNeigh (Id iech_out, 1 &ranks) override
 Interface for ANeigh.
 
Id getNSampleMax (const Db *db) const override
 
bool hasChanged (Id iech_out) const override
 
ENeigh getType () const override
 
String toString (const AStringFormat *strfmt=nullptr) const override
 Interface for AStringable.
 
Id getSkip () const
 
const & getImageRadius () const
 
Id getImageRadius (Id idim) const
 
void setImageRadius (const 1 &imageRadius)
 
void setSkip (Id skip)
 
DbGridbuildImageGrid (const DbGrid *dbgrid, Id seed) const
 Create a subgrid containing the minimum pattern for Image Neighborhood. The output subgrid is "parallel" to the input 'dbgrid'.
 
- Public Member Functions inherited from gstlrn::ANeigh
 ANeigh (const ASpaceSharedPtr &space=ASpaceSharedPtr())
 
 ANeigh (const ANeigh &r)
 
ANeighoperator= (const ANeigh &r)
 
virtual ~ANeigh ()
 
bool isConsistent (const ASpace *space) const override
 ASpaceObject Interface.
 
virtual Id attach (const Db *dbin, const Db *dbout)
 Interface for ANeigh.
 
virtual summary (Id iech_out)
 
virtual bool getFlagContinuous () const
 
void displayDebug (1 &ranks) const
 
void select (Id iech_out, 1 &ranks)
 
bool isUnchanged () const
 
void setIsChanged (bool status=false)
 
void reset ()
 
bool getFlagXvalid () const
 
bool getFlagKFold () const
 
void setFlagXvalid (bool flagXvalid)
 
void setFlagKFold (bool flagKFold)
 
void setFlagSimu (bool flagSimu)
 
void setBallSearch (bool status, Id leaf_size=10)
 
void attachBall ()
 
- Public Member Functions inherited from gstlrn::ASpaceObject
 ASpaceObject (const ASpaceSharedPtr &space=ASpaceSharedPtr())
 
 ASpaceObject (const ASpaceObject &r)
 
ASpaceObjectoperator= (const ASpaceObject &r)
 
virtual ~ASpaceObject ()
 
ASpaceSharedPtr getSpace () const
 Accessor to the current object space context.
 
bool isConsistent () const
 Indicate if I am consistent with my current space context.
 
void setSpace (ASpaceSharedPtr &&space)
 
 getUnitaryVector () const
 Return unitary vector for the current space context.
 
bool isConsistent (const ASpaceSharedPtr &space) const
 Indicate if I am consistent with the provided space.
 
size_t getNDim (Id ispace=-1) const
 Shortcuts to ASpace methods.
 
const & getOrigin (Id ispace=-1) const
 Return the current space context origin coordinates.
 
double getDistance (const SpacePoint &p1, const SpacePoint &p2, Id ispace=0) const
 Return the distance between two space points for the current space context.
 
 getDistances (const SpacePoint &p1, const SpacePoint &p2) const
 Return all the distances (space composits) between two space points for the current space context.
 
 getIncrement (const SpacePoint &p1, const SpacePoint &p2, Id ispace=0) const
 Return the increment vector between two space points for the current space context.
 
void getIncrementInPlace (const SpacePoint &p1, const SpacePoint &p2, 1 &ptemp, Id ispace=-1) const
 
- Public Member Functions inherited from gstlrn::AStringable
 AStringable ()
 
 AStringable (const AStringable &r)
 
AStringableoperator= (const AStringable &r)
 
virtual ~AStringable ()
 
virtual void display (const AStringFormat *strfmt=nullptr) const final
 
virtual void display (Id level) const final
 
- Public Member Functions inherited from gstlrn::ASerializable
 ASerializable ()
 
 ASerializable (const ASerializable &r)
 
ASerializableoperator= (const ASerializable &r)
 
 ASerializable (ASerializable &&r) noexcept
 
ASerializableoperator= (ASerializable &&r) noexcept
 
virtual ~ASerializable ()
 
bool dumpToNF (const String &NFFilename, const EFormatNF &format=EFormatNF::fromKey("DEFAULT"), bool verbose=false) const
 Dump the contents of an object into an Output File using a given Output NF Format.
 
void setDefaultFormatNF (const EFormatNF &format)
 
- Public Member Functions inherited from gstlrn::ICloneable
 ICloneable ()
 
virtual ~ICloneable ()
 
virtual ICloneableclone () const =0
 
std::shared_ptr< ICloneablecloneShared () const
 
std::unique_ptr< ICloneablecloneUnique () const
 

Static Public Member Functions

static NeighImagecreate (const 1 &radius, Id skip=0, const ASpaceSharedPtr &space=ASpaceSharedPtr())
 
static NeighImagecreateFromNF (const String &NFFilename, bool verbose=true)
 
- Static Public Member Functions inherited from gstlrn::ASerializable
static String buildFileName (Id status, const String &filename, bool ensureDirExist=false)
 
static String getFileIdentity (const String &filename, bool verbose=false)
 
static void setPrefixName (const String &prefixName)
 
static void unsetPrefixName ()
 
static const StringgetPrefixName ()
 

Constructor & Destructor Documentation

◆ NeighImage() [1/2]

gstlrn::NeighImage::NeighImage ( const 1 &  radius = 1(),
Id  skip = 0,
const ASpaceSharedPtr space = ASpaceSharedPtr() 
)

◆ NeighImage() [2/2]

gstlrn::NeighImage::NeighImage ( const NeighImage r)

◆ ~NeighImage()

gstlrn::NeighImage::~NeighImage ( )
virtual

Member Function Documentation

◆ buildImageGrid()

DbGrid * gstlrn::NeighImage::buildImageGrid ( const DbGrid dbgrid,
Id  seed 
) const

Create a subgrid containing the minimum pattern for Image Neighborhood. The output subgrid is "parallel" to the input 'dbgrid'.

Parameters
dbgridInput DbGrid
seedSeed used for random number generation
Returns
Pointer to the newly created DbGrid
Remarks
When a sample is skipped ('using 'skip' Neighborhood parameter) the value of the corresponding variable is set to 'TEST'.
The center point can never be skipped.

◆ create()

NeighImage * gstlrn::NeighImage::create ( const 1 &  radius,
Id  skip = 0,
const ASpaceSharedPtr space = ASpaceSharedPtr() 
)
static

◆ createFromNF()

NeighImage * gstlrn::NeighImage::createFromNF ( const String NFFilename,
bool  verbose = true 
)
static

Create a NeighImageborhood by loading the contents of a Neutral File

Parameters
NFFilenameName of the Neutral File
verboseVerbose flag
Returns

◆ getImageRadius() [1/2]

const & gstlrn::NeighImage::getImageRadius ( ) const
inline

◆ getImageRadius() [2/2]

Id gstlrn::NeighImage::getImageRadius ( Id  idim) const
inline

◆ getNeigh()

void gstlrn::NeighImage::getNeigh ( Id  iech_out,
1 &  ranks 
)
overridevirtual

Interface for ANeigh.

Select the neighborhood

Parameters
iech_outValid Rank of the sample in the output Db
ranksVector of sample ranks in neighborhood (empty when error)

Implements gstlrn::ANeigh.

◆ getNSampleMax()

Id gstlrn::NeighImage::getNSampleMax ( const Db db) const
overridevirtual

Given a Db, returns the maximum number of samples per NeighImageborhood

Parameters
dbPointer to the target Db
Returns

Implements gstlrn::ANeigh.

◆ getSkip()

Id gstlrn::NeighImage::getSkip ( ) const
inline

◆ getType()

ENeigh gstlrn::NeighImage::getType ( ) const
inlineoverridevirtual

Reimplemented from gstlrn::ANeigh.

◆ hasChanged()

bool gstlrn::NeighImage::hasChanged ( Id  iech_out) const
overridevirtual

Reimplemented from gstlrn::ANeigh.

◆ operator=()

NeighImage & gstlrn::NeighImage::operator= ( const NeighImage r)

◆ setImageRadius()

void gstlrn::NeighImage::setImageRadius ( const 1 &  imageRadius)
inline

◆ setSkip()

void gstlrn::NeighImage::setSkip ( Id  skip)
inline

◆ toString()

String gstlrn::NeighImage::toString ( const AStringFormat strfmt = nullptr) const
overridevirtual

Interface for AStringable.

Reimplemented from gstlrn::ASpaceObject.


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