Loading [MathJax]/extensions/tex2jax.js
1.7.0
Geostatistics & Machine Learning toolbox | https://gstlearn.org
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
NeighImage Class Reference

Image Neighborhood definition. More...

#include <NeighImage.hpp>

Inheritance diagram for NeighImage:
ANeigh ASpaceObject ASerializable ICloneable 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 VectorInt &radius=VectorInt(), int skip=0, const ASpaceSharedPtr &space=ASpaceSharedPtr())
 
 NeighImage (const NeighImage &r)
 
NeighImageoperator= (const NeighImage &r)
 
virtual ~NeighImage ()
 
virtual void getNeigh (int iech_out, VectorInt &ranks) override
 Interface for ANeigh.
 
virtual int getNSampleMax (const Db *db) const override
 
virtual bool hasChanged (int iech_out) const override
 
virtual ENeigh getType () const override
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 Interface for AStringable.
 
int getSkip () const
 
const VectorIntgetImageRadius () const
 
int getImageRadius (int idim) const
 
void setImageRadius (const VectorInt &imageRadius)
 
void setSkip (int skip)
 
DbGridbuildImageGrid (const DbGrid *dbgrid, int 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 ANeigh
 ANeigh (const ASpaceSharedPtr &space=ASpaceSharedPtr())
 
 ANeigh (const ANeigh &r)
 
ANeighoperator= (const ANeigh &r)
 
virtual ~ANeigh ()
 
virtual bool isConsistent (const ASpace *space) const override
 ASpaceObject Interface.
 
virtual int attach (const Db *dbin, const Db *dbout)
 Interface for ANeigh.
 
virtual VectorDouble summary (int iech_out)
 
virtual bool getFlagContinuous () const
 
void displayDebug (VectorInt &ranks) const
 
void select (int iech_out, VectorInt &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, int leaf_size=10)
 
void attachBall (double(*dist_function)(const double *x1, const double *x2, int size)=nullptr)
 
- Public Member Functions inherited from 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.
 
VectorDouble 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.
 
unsigned int getNDim (int ispace=-1) const
 Shortcuts to ASpace methods.
 
const VectorDoublegetOrigin (int ispace=-1) const
 Return the current space context origin coordinates.
 
double getDistance (const SpacePoint &p1, const SpacePoint &p2, int ispace=0) const
 Return the distance between two space points for the current space context.
 
VectorDouble getDistances (const SpacePoint &p1, const SpacePoint &p2) const
 Return all the distances (space composits) between two space points for the current space context.
 
VectorDouble getIncrement (const SpacePoint &p1, const SpacePoint &p2, int ispace=0) const
 Return the increment vector between two space points for the current space context.
 
- Public Member Functions inherited from AStringable
 AStringable ()
 
 AStringable (const AStringable &r)
 
AStringableoperator= (const AStringable &r)
 
virtual ~AStringable ()
 
virtual void display (const AStringFormat *strfmt=nullptr) const final
 
virtual void display (int level) const final
 
- Public Member Functions inherited from ASerializable
 ASerializable ()
 
 ASerializable (const ASerializable &r)
 
ASerializableoperator= (const ASerializable &r)
 
virtual ~ASerializable ()
 
bool deserialize (std::istream &is, bool verbose=true)
 
bool serialize (std::ostream &os, bool verbose=true) const
 
bool dumpToNF (const String &neutralFilename, bool verbose=false) const
 
- Public Member Functions inherited from ICloneable
 ICloneable ()
 
virtual ~ICloneable ()
 
virtual ICloneableclone () const =0
 

Static Public Member Functions

static NeighImagecreate (const VectorInt &radius, int skip=0, const ASpaceSharedPtr &space=ASpaceSharedPtr())
 
static NeighImagecreateFromNF (const String &neutralFilename, bool verbose=true)
 
- Static Public Member Functions inherited from ASerializable
static String buildFileName (int status, const String &filename, bool ensureDirExist=false)
 
static String getHomeDirectory (const String &sub="")
 
static String getWorkingDirectory ()
 
static String getTestData (const String &subdir, const String &filename)
 
static String getFileIdentity (const String &filename, bool verbose=false)
 
static void setContainerName (bool useDefault, const String &containerName="", bool verbose=false)
 
static void unsetContainerName ()
 
static void setPrefixName (const String &prefixName)
 
static void unsetPrefixName ()
 
static const StringgetContainerName ()
 
static const StringgetPrefixName ()
 
static bool createDirectory (const String &dir)
 
static String getExecDirectory ()
 
static String getDirectory (const String &path)
 

Constructor & Destructor Documentation

◆ NeighImage() [1/2]

NeighImage::NeighImage ( const VectorInt radius = VectorInt(),
int  skip = 0,
const ASpaceSharedPtr space = ASpaceSharedPtr() 
)

◆ NeighImage() [2/2]

NeighImage::NeighImage ( const NeighImage r)

◆ ~NeighImage()

NeighImage::~NeighImage ( )
virtual

Member Function Documentation

◆ buildImageGrid()

DbGrid * NeighImage::buildImageGrid ( const DbGrid dbgrid,
int  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 * NeighImage::create ( const VectorInt radius,
int  skip = 0,
const ASpaceSharedPtr space = ASpaceSharedPtr() 
)
static

◆ createFromNF()

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

Create a NeighImageborhood by loading the contents of a Neutral File

Parameters
neutralFilenameName of the Neutral File
verboseVerbose flag
Returns

◆ getImageRadius() [1/2]

const VectorInt & NeighImage::getImageRadius ( ) const
inline

◆ getImageRadius() [2/2]

int NeighImage::getImageRadius ( int  idim) const
inline

◆ getNeigh()

void NeighImage::getNeigh ( int  iech_out,
VectorInt 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 ANeigh.

◆ getNSampleMax()

int 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 ANeigh.

◆ getSkip()

int NeighImage::getSkip ( ) const
inline

◆ getType()

virtual ENeigh NeighImage::getType ( ) const
inlineoverridevirtual

Reimplemented from ANeigh.

◆ hasChanged()

bool NeighImage::hasChanged ( int  iech_out) const
overridevirtual

Reimplemented from ANeigh.

◆ operator=()

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

◆ setImageRadius()

void NeighImage::setImageRadius ( const VectorInt imageRadius)
inline

◆ setSkip()

void NeighImage::setSkip ( int  skip)
inline

◆ toString()

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

Interface for AStringable.

Reimplemented from ASpaceObject.


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