Xmipp  v3.23.11-Nereus
Public Member Functions | List of all members
Layout Class Referenceabstract

#include <map.h>

Inheritance diagram for Layout:
Inheritance graph
[legend]

Public Member Functions

 Layout (const std::string &_id="")
 
virtual ~Layout ()
 
std::vector< unsigned > neighborhood (const ClassificationMap *_som, const SomPos &_center, double _radius) const
 
std::vector< unsigned > neighborhood (const FuzzyMap *_som, const SomPos &_center, double _radius) const
 
virtual void localAve (const FuzzyMap *_som, const SomPos &_center, std::vector< double > &_aveVector) const =0
 
virtual double numNeig (const FuzzyMap *_som, const SomPos &_center) const =0
 
virtual bool isIn (const SomPos &_center, const SomPos &_v, double _radius) const
 
virtual double dist (const SomPos &_center, const SomPos &_v) const =0
 
const std::string & id () const
 

Detailed Description

This class creates a SOM Layout. The neighborhood of a point depends on the type of the layout chosen.

Definition at line 573 of file map.h.

Constructor & Destructor Documentation

◆ Layout()

Layout::Layout ( const std::string &  _id = "")
inline

Generic constructor Parameter: _id The identification

Definition at line 581 of file map.h.

581  : theId(_id)
582  {};

◆ ~Layout()

virtual Layout::~Layout ( )
inlinevirtual

Virtual destructor

Definition at line 587 of file map.h.

588  {};

Member Function Documentation

◆ dist()

virtual double Layout::dist ( const SomPos _center,
const SomPos _v 
) const
pure virtual

Returns the distance between two vectors in their given position Parameter: _center Position of the center of neighborhood Parameter: _v Position of the code vector

Implemented in HEXALayout, and RECTLayout.

◆ id()

const std::string & Layout::id ( ) const

Returns the id of the layout

Definition at line 536 of file map.cpp.

537 {
538  return theId;
539 }

◆ isIn()

bool Layout::isIn ( const SomPos _center,
const SomPos _v,
double  _radius 
) const
virtual

Returns true if the vector in the given position is in the neighborhood or false otherwise Parameter: _center Position of the center of neighborhood Parameter: _v Position of the code vector Parameter: _radius Radius of neighbohood

Definition at line 526 of file map.cpp.

528 {
529  return (dist(_center, _v) <= _radius);
530 }
virtual double dist(const SomPos &_center, const SomPos &_v) const =0

◆ localAve()

virtual void Layout::localAve ( const FuzzyMap _som,
const SomPos _center,
std::vector< double > &  _aveVector 
) const
pure virtual

Returns the local average of a neuron in a non-const reference. (average of the sourounding vectors) in a Fuzzy SOM Parameter: _center Reference to the center of neighborhood Parameter: _aveVector: returns the average vector

Implemented in HEXALayout, and RECTLayout.

◆ neighborhood() [1/2]

std::vector< unsigned > Layout::neighborhood ( const ClassificationMap _som,
const SomPos _center,
double  _radius 
) const

Constructs a neighborhood for the SOM Parameter: _som The som Parameter: _center Reference to the center of neighborhood Parameter: _radius Radius of neighbohood

Constructs a neighborhood Parameter: _som The som Parameter: _center Reference to the center of neighborhood Parameter: _radius Radius of neighbohood

Definition at line 479 of file map.cpp.

481 {
482  std::vector<unsigned> neig;
483 
484  // try to find the neighbors
485  for (unsigned i = 0 ; i < _som->size() ; i++)
486  {
487  if (isIn(_center, _som->indexToPos(i), _radius))
488  neig.push_back(i);
489  }
490 
491  return neig;
492 }
SomPos indexToPos(const unsigned &_i) const
Definition: map.cpp:306
virtual bool isIn(const SomPos &_center, const SomPos &_v, double _radius) const
Definition: map.cpp:526
#define i

◆ neighborhood() [2/2]

std::vector< unsigned > Layout::neighborhood ( const FuzzyMap _som,
const SomPos _center,
double  _radius 
) const

Constructs a neighborhood for the Fuzzy SOM Parameter: _som The Fuzzy Som Parameter: _center Reference to the center of neighborhood Parameter: _radius Radius of neighbohood

Constructs a neighborhood Parameter: _som The Fuzzy Som Parameter: _center Reference to the center of neighborhood Parameter: _radius Radius of neighbohood

Definition at line 501 of file map.cpp.

503 {
504  std::vector<unsigned> neig;
505 
506  // try to find the neighbors
507  for (unsigned i = 0 ; i < _som->size() ; i++)
508  {
509  if (isIn(_center, _som->indexToPos(i), _radius))
510  {
511  neig.push_back(i);
512  }
513  }
514 
515  return neig;
516 }
SomPos indexToPos(const unsigned &_i) const
Definition: map.cpp:1033
virtual bool isIn(const SomPos &_center, const SomPos &_v, double _radius) const
Definition: map.cpp:526
#define i

◆ numNeig()

virtual double Layout::numNeig ( const FuzzyMap _som,
const SomPos _center 
) const
pure virtual

Returns the average number of neighbors in a Fuzzy SOM Parameter: _center Reference to the center of neighborhood Parameter: _radius: Radius

Implemented in HEXALayout, and RECTLayout.


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