Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

Spatial_Data Class Reference

A class representing a spatial dataset. More...

#include <Spatial_Data.hpp>

List of all members.

Public Member Functions

 Spatial_Data ()
 Default Constructor.
 Spatial_Data (Data *d, Neighborhood_System *nhs)
 Constructor.
 ~Spatial_Data ()
 Destructor.
void DeleteAll ()
 Free all the memory used by this object.
void Get (uint i, vector< double > &obs)
 Get the observation at site i.
double Get (uint i, uint d)
 Get X_i[d].
uint GetLabel (uint i)
 Get the label of site i.
void GetLabels (vector< uint > &labs)
 Get all the labels.
uint Get_N ()
 Get the number of sites.
uint Get_D ()
 Get the dimension of observations.
Neighborhood_SystemGet_NS ()
void GetNeighbors (uint site, vector< Weighted_Neighbor * > &neighs)
 Get the neighbors for a given site.
void ReadStructureFromFile (string filename)
 Read the structure of the spatial data set.
void ReadDataFromFile (string filename)
 Read the dataset from a file.
void ReadNeighborhoodFromFile (string filename)
 Read the neighborhood from a file.
void ReadFromFile (string filename)
 Read from a file.
void WriteToFile (string filename)
 Write to a file.
void Stats (vector< double > &mean, vector< double > &cov)
 Compute the (empirical) mean and covariance of the data.
void K_means (uint K, vector< double > &centers, vector< uint > &labels)
 K-means algorithm.
void Info ()
 display some information about the spatial dataset.


Detailed Description

Author:
Lemine Abdallahi
Date:
Aug. 2005
This class represents the spatial dataset as understood in this project. This is the main data access class.

All the algorithms, models defined later will access data through an object of this class.

A spatial dataset is given by :

These two members are private. they are only accessible through some (shortcut) methods.


Constructor & Destructor Documentation

Spatial_Data::Spatial_Data  ) 
 

Default constructor.

Creates a spatial dataset with a default dataset and a default neighborhood system.

Spatial_Data::Spatial_Data Data d,
Neighborhood_System nhs
 

Default constructor.

Parameters:
[in] d : Data object
[in] nhs : Neighborhood_System object.
Creates a spatial dataset with a given dataset dat and a given neighborhood system nhs.

Spatial_Data::~Spatial_Data  ) 
 

Deletes the object.

Calls DeleteAll


Member Function Documentation

void Spatial_Data::DeleteAll  ) 
 

Frees all the memory used by the object.

double Spatial_Data::Get uint  i,
uint  d
 

Get X_i[d]

void Spatial_Data::Get uint  i,
vector< double > &  obs
 

Get the observation at the site i.

Parameters:
i : a site.
obs : a vector containing the observation at the site i.

uint Spatial_Data::Get_D  ) 
 

Get the dimension.

Returns:
The dimension of the observations.

uint Spatial_Data::Get_N  ) 
 

Get the number of observations, i.e. , the size of the dataset.

Returns:
The number of observations in the dataset.

Neighborhood_System * Spatial_Data::Get_NS  ) 
 

Get the neighborhood system.

uint Spatial_Data::GetLabel uint  i  ) 
 

Get the label at the site i.

Parameters:
i : a site.
Returns:
the label at the site i.

void Spatial_Data::GetLabels vector< uint > &  labs  ) 
 

Get the labels.

Returns:
the labels at all the sites.

void Spatial_Data::GetNeighbors uint  site,
vector< Weighted_Neighbor * > &  neighs
 

Get the (weighted) neighbors for a given site (in the underlying neighborhood system).

Parameters:
[in] site : a site.
[out] neighs : the set of neighbors of the site site
Fills the vector neighs with the necessary neighborhood data for the site site.

void Spatial_Data::Info  ) 
 

Display some information about the spatial dataset.

Calls Data::Info()

Calls Neighborhood_System::Info()

void Spatial_Data::K_means uint  K,
vector< double > &  centers,
vector< uint > &  labels
 

K-means algorithm

void Spatial_Data::ReadDataFromFile string  filename  ) 
 

Read the embedded dataset from a file.

Parameters:
[in] filename : name of the input file.
Calls Data::ReadFromFile

void Spatial_Data::ReadFromFile string  filename  ) 
 

Read data and neighborhood system from a file.

Parameters:
[in] filename : name of the input file (without extension).

void Spatial_Data::ReadNeighborhoodFromFile string  filename  ) 
 

Read the embedded neighborhood system from a file.

Parameters:
[in] filename : name of the input file.
Calls Neighborhood_System::ReadFromFile

void Spatial_Data::ReadStructureFromFile string  filename  ) 
 

Read the structure of 5the spatial dataset in a file.

Parameters:
[in] filename : name of the input file.
File format is as follows :

On a unique line :

type size dim

where :

  • type is the neighborhood type marker. one of N , I , S :
    • N = Non-spatial neighborhood (TBD)
    • S = ( Spatial ) generic neighborhood.
    • I = ( Image ) local neighborhood.
  • size is :
    • NbPts : if (type == N or S)
    • Nlines Ncols : if ( type == I )
  • dim : is the dimension (number of variables).
A typical structure file :

   S 65536 4

or

   I 256 256 4

void Spatial_Data::Stats vector< double > &  mean,
vector< double > &  cov
 

Compute simple statistics from the data (mean and covariance).

Useful for estimating a gaussain distribution.

void Spatial_Data::WriteToFile string  filename  ) 
 

Write data and neighborhood system to a file.

Parameters:
[in] filename : name of the output file (without extension).


The documentation for this class was generated from the following files:
Generated on Thu Jan 12 11:55:05 2006 for NEM by  doxygen 1.4.4