Main MRPT website > C++ reference for MRPT 1.5.5
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Types
mrpt::maps::CRandomFieldGridMap3D Class Reference

Detailed Description

CRandomFieldGridMap3D represents a 3D regular grid where each voxel is associated one real-valued property which is to be estimated by this class.

This class implements a Gaussian Markov Random Field (GMRF) estimator, with each voxel being connected to its 6 immediate neighbors (Up, down, left, right, front, back).

Note that this class does not derive from mrpt::maps::CMetricMap since the estimated values do not have sensor-especific semantics, i.e. the grid can be used to estimate temperature, gas concentration, etc.

Usage:

Custom connectivity patterns can be defined with setVoxelsConnectivity().

See Also
mrpt::maps::CRandomFieldGridMap3D
Note
[New in MRPT 1.5.0]

Definition at line 72 of file CRandomFieldGridMap3D.h.

#include <mrpt/maps/CRandomFieldGridMap3D.h>

Inheritance diagram for mrpt::maps::CRandomFieldGridMap3D:
Inheritance graph

Classes

struct  ConnectivityDescriptor
 Base class for user-supplied objects capable of describing voxels connectivity, used to build prior factors of the MRF graph. More...
 
struct  TInsertionOptions
 Parameters common to any derived class. More...
 
struct  TObservationGMRF
 
struct  TPriorFactorGMRF
 

Public Types

enum  TVoxelInterpolationMethod { gimNearest = 0, gimBilinear }
 
typedef stlplus::smart_ptr
< ConnectivityDescriptor
ConnectivityDescriptorPtr
 

Public Member Functions

voidoperator new (size_t size)
 
voidoperator new[] (size_t size)
 
void operator delete (void *ptr) throw ()
 
void operator delete[] (void *ptr) throw ()
 
void operator delete (void *memory, void *ptr) throw ()
 
voidoperator new (size_t size, const std::nothrow_t &) throw ()
 
void operator delete (void *ptr, const std::nothrow_t &) throw ()
 
 CRandomFieldGridMap3D (double x_min=-2, double x_max=2, double y_min=-2, double y_max=2, double z_min=-2, double z_max=2, double voxel_size=0.5, bool call_initialize_now=true)
 Constructor. More...
 
void clear () MRPT_OVERRIDE
 Erases all added observations and start again with an empty gridmap. More...
 
bool saveAsCSV (const std::string &filName_mean, const std::string &filName_stddev=std::string()) const
 Save the current estimated mean values to a CSV file (compatible with Paraview) with fields x y z mean_value. More...
 
bool saveAsVtkStructuredGrid (const std::string &fil) const
 Save the current estimated grid to a VTK file (.vts) as a "structured grid". More...
 
virtual void resize (double new_x_min, double new_x_max, double new_y_min, double new_y_max, double new_z_min, double new_z_max, const TRandomFieldVoxel &defaultValueNewvoxels, double additionalMarginMeters=2.0) MRPT_OVERRIDE
 Changes the size of the grid, maintaining previous contents. More...
 
virtual void setSize (const double x_min, const double x_max, const double y_min, const double y_max, const double z_min, const double z_max, const double resolution_xy, const double resolution_z=-1.0, const TRandomFieldVoxel *fill_value=NULL) MRPT_OVERRIDE
 Changes the size of the grid, erasing previous contents.If resolution_z<0, the same resolution will be used for all dimensions x,y,z as given in resolution_xy More...
 
void setVoxelsConnectivity (const ConnectivityDescriptorPtr &new_connectivity_descriptor)
 Sets a custom object to define the connectivity between voxels. More...
 
bool insertIndividualReading (const double sensorReading, const double sensorVariance, const mrpt::math::TPoint3D &point, const TVoxelInterpolationMethod method, const bool update_map)
 Direct update of the map with a reading in a given position of the map. More...
 
void updateMapEstimation ()
 Run the method-specific procedure required to ensure that the mean & variances are up-to-date with all inserted observations, using parameters in insertionOptions. More...
 
void getAsVtkStructuredGrid (vtkStructuredGrid *output, const std::string &label_mean=std::string("mean"), const std::string &label_stddev=std::string("stddev")) const
 Returns the 3D grid contents as an VTK grid. More...
 
virtual void resize (double new_x_min, double new_x_max, double new_y_min, double new_y_max, double new_z_min, double new_z_max, const TRandomFieldVoxel &defaultValueNewCells, double additionalMarginMeters=2.0)
 Changes the size of the grid, maintaining previous contents. More...
 
virtual void setSize (const double x_min, const double x_max, const double y_min, const double y_max, const double z_min, const double z_max, const double resolution_xy, const double resolution_z_=-1.0, const TRandomFieldVoxel *fill_value=NULL)
 Changes the size of the grid, ERASING all previous contents. More...
 
void fill (const TRandomFieldVoxel &value)
 Fills all the cells with the same value. More...
 
size_t cellAbsIndexFromCXCYCZ (const int cx, const int cy, const int cz) const
 Gets the absolute index of a voxel in the linear container m_map[] from its cx,cy,cz indices, or -1 if out of map bounds (in any dimension). More...
 
TRandomFieldVoxelcellByPos (double x, double y, double z)
 Returns a pointer to the contents of a voxel given by its coordinates, or NULL if it is out of the map extensions. More...
 
const TRandomFieldVoxelcellByPos (double x, double y, double z) const
 
TRandomFieldVoxelcellByIndex (unsigned int cx, unsigned int cy, unsigned int cz)
 Returns a pointer to the contents of a voxel given by its voxel indexes, or NULL if it is out of the map extensions. More...
 
const TRandomFieldVoxelcellByIndex (unsigned int cx, unsigned int cy, unsigned int cz) const
 Returns a pointer to the contents of a voxel given by its voxel indexes, or NULL if it is out of the map extensions. More...
 
size_t getSizeX () const
 
size_t getSizeY () const
 
size_t getSizeZ () const
 
size_t getVoxelCount () const
 
double getXMin () const
 
double getXMax () const
 
double getYMin () const
 
double getYMax () const
 
double getZMin () const
 
double getZMax () const
 
double getResolutionXY () const
 
double getResolutionZ () const
 
int x2idx (double x) const
 Transform a coordinate values into voxel indexes. More...
 
int y2idx (double y) const
 
int z2idx (double z) const
 
double idx2x (int cx) const
 Transform a voxel index into a coordinate value of the voxel central point. More...
 
double idx2y (int cy) const
 
double idx2z (int cz) const
 
virtual mxArraywriteToMatlab () const
 Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class. More...
 
mrpt::utils::CObjectPtr duplicateGetSmartPtr () const
 Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer). More...
 
CObjectclone () const
 Cloning interface for smart pointers. More...
 

Static Public Member Functions

static voidoperator new (size_t size, void *ptr)
 

Public Attributes

TInsertionOptions insertionOptions
 

Static Public Attributes

static bool ENABLE_GMRF_PROFILER
 [default:false] Enables a profiler to show a performance report at application end. More...
 
static const size_t INVALID_VOXEL_IDX
 
static const
mrpt::utils::TRuntimeClassId 
classCObject
 
RTTI stuff
static const
mrpt::utils::TRuntimeClassId 
classCSerializable
 

Protected Member Functions

void internal_initialize (bool erase_prev_contents=true)
 Internal: called called after each change of resolution, size, etc. More...
 
std::vector< TRandomFieldVoxel > & m_map_castaway_const () const
 Used only from logically const method that really need to modify the object. More...
 
void dyngridcommon_writeToStream (mrpt::utils::CStream &out) const
 Serialization of all parameters, except the contents of each voxel (responsability of the derived class) More...
 
void dyngridcommon_readFromStream (mrpt::utils::CStream &in)
 Serialization of all parameters, except the contents of each voxel (responsability of the derived class) More...
 
CSerializable virtual methods
void writeToStream (mrpt::utils::CStream &out, int *getVersion) const
 Introduces a pure virtual method responsible for writing to a CStream. More...
 
void readFromStream (mrpt::utils::CStream &in, int version)
 Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori. More...
 

Protected Attributes

ConnectivityDescriptorPtr m_gmrf_connectivity
 Empty: default. More...
 
mrpt::graphs::ScalarFactorGraph m_gmrf
 
std::vector< std::deque
< TObservationGMRF > > 
m_mrf_factors_activeObs
 Vector with the active observations and their respective Information, for each map cell. More...
 
std::deque< TPriorFactorGMRFm_mrf_factors_priors
 Vector with the precomputed priors for each GMRF model. More...
 
std::vector< TRandomFieldVoxelm_map
 The cells. More...
 
double m_x_min
 
double m_x_max
 
double m_y_min
 
double m_y_max
 
double m_z_min
 
double m_z_max
 
double m_resolution_xy
 
double m_resolution_z
 
size_t m_size_x
 
size_t m_size_y
 
size_t m_size_z
 
size_t m_size_x_times_y
 

Private Types

typedef utils::CDynamicGrid3D
< TRandomFieldVoxel
BASE
 

RTTI stuff

typedef CRandomFieldGridMap3DPtr Ptr
 
typedef CRandomFieldGridMap3DPtr ConstPtr
 
static mrpt::utils::CLASSINIT _init_CRandomFieldGridMap3D
 
static mrpt::utils::TRuntimeClassId classCRandomFieldGridMap3D
 
static const
mrpt::utils::TRuntimeClassId
classinfo
 
static const
mrpt::utils::TRuntimeClassId
_GetBaseClass ()
 
virtual const
mrpt::utils::TRuntimeClassId
GetRuntimeClass () const
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::utils::CObjectduplicate () const
 Returns a copy of the object, indepently of its class. More...
 
static mrpt::utils::CObjectCreateObject ()
 
static CRandomFieldGridMap3DPtr Create ()
 

Member Typedef Documentation

Definition at line 77 of file CRandomFieldGridMap3D.h.

Definition at line 165 of file CRandomFieldGridMap3D.h.

typedef CRandomFieldGridMap3DPtr mrpt::maps::CRandomFieldGridMap3D::ConstPtr

Definition at line 80 of file CRandomFieldGridMap3D.h.

typedef CRandomFieldGridMap3DPtr mrpt::maps::CRandomFieldGridMap3D::Ptr

A typedef for the associated smart pointer

Definition at line 80 of file CRandomFieldGridMap3D.h.

Member Enumeration Documentation

Enumerator
gimNearest 
gimBilinear 

Definition at line 170 of file CRandomFieldGridMap3D.h.

Constructor & Destructor Documentation

CRandomFieldGridMap3D::CRandomFieldGridMap3D ( double  x_min = -2,
double  x_max = 2,
double  y_min = -2,
double  y_max = 2,
double  z_min = -2,
double  z_max = 2,
double  voxel_size = 0.5,
bool  call_initialize_now = true 
)

Constructor.

If you set call_initialize_now to false, the object will be initialized immediately (without the heavy initialization of the GMRF), but you then must call setSize() or clear() later to properly initialize the object before using it to insert observations.

Definition at line 41 of file CRandomFieldGridMap3D.cpp.

Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::maps::CRandomFieldGridMap3D::_GetBaseClass ( )
staticprotected
size_t mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellAbsIndexFromCXCYCZ ( const int  cx,
const int  cy,
const int  cz 
) const
inlineinherited

Gets the absolute index of a voxel in the linear container m_map[] from its cx,cy,cz indices, or -1 if out of map bounds (in any dimension).

See Also
x2idx(), y2idx(), z2idx()

Definition at line 185 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::INVALID_VOXEL_IDX, mrpt::utils::CDynamicGrid3D< T >::m_size_x, mrpt::utils::CDynamicGrid3D< T >::m_size_x_times_y, mrpt::utils::CDynamicGrid3D< T >::m_size_y, and mrpt::utils::CDynamicGrid3D< T >::m_size_z.

Referenced by insertIndividualReading().

TRandomFieldVoxel * mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellByIndex ( unsigned int  cx,
unsigned int  cy,
unsigned int  cz 
)
inlineinherited

Returns a pointer to the contents of a voxel given by its voxel indexes, or NULL if it is out of the map extensions.

Definition at line 211 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::cellAbsIndexFromCXCYCZ(), mrpt::utils::CDynamicGrid3D< T >::INVALID_VOXEL_IDX, and mrpt::utils::CDynamicGrid3D< T >::m_map.

const TRandomFieldVoxel * mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellByIndex ( unsigned int  cx,
unsigned int  cy,
unsigned int  cz 
) const
inlineinherited

Returns a pointer to the contents of a voxel given by its voxel indexes, or NULL if it is out of the map extensions.

Definition at line 220 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::cellAbsIndexFromCXCYCZ(), mrpt::utils::CDynamicGrid3D< T >::INVALID_VOXEL_IDX, and mrpt::utils::CDynamicGrid3D< T >::m_map.

TRandomFieldVoxel * mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellByPos ( double  x,
double  y,
double  z 
)
inlineinherited
const TRandomFieldVoxel * mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellByPos ( double  x,
double  y,
double  z 
) const
inlineinherited

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 202 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::cellAbsIndexFromCXCYCZ(), mrpt::utils::CDynamicGrid3D< T >::INVALID_VOXEL_IDX, mrpt::utils::CDynamicGrid3D< T >::m_map, mrpt::utils::CDynamicGrid3D< T >::x2idx(), mrpt::utils::CDynamicGrid3D< T >::y2idx(), and mrpt::utils::CDynamicGrid3D< T >::z2idx().

void CRandomFieldGridMap3D::clear ( )
virtual

Erases all added observations and start again with an empty gridmap.

Reimplemented from mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >.

Definition at line 85 of file CRandomFieldGridMap3D.cpp.

References mrpt::utils::CDynamicGrid3D< T >::clear().

CObject* mrpt::utils::CObject::clone ( ) const
inlineinherited

Cloning interface for smart pointers.

Definition at line 143 of file CObject.h.

static CRandomFieldGridMap3DPtr mrpt::maps::CRandomFieldGridMap3D::Create ( )
static
static mrpt::utils::CObject* mrpt::maps::CRandomFieldGridMap3D::CreateObject ( )
static
virtual mrpt::utils::CObject* mrpt::maps::CRandomFieldGridMap3D::duplicate ( ) const
virtual

Returns a copy of the object, indepently of its class.

Implements mrpt::utils::CObject.

mrpt::utils::CObjectPtr mrpt::utils::CObject::duplicateGetSmartPtr ( ) const
inlineinherited

Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).

Definition at line 140 of file CObject.h.

Referenced by mrpt::obs::CRawlog::addActions(), mrpt::slam::CIncrementalMapPartitioner::addMapFrame(), and mrpt::obs::CRawlog::addObservations().

void mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream ( mrpt::utils::CStream in)
inlineprotectedinherited
void mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream ( mrpt::utils::CStream out) const
inlineprotectedinherited
void mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::fill ( const TRandomFieldVoxel &  value)
inlineinherited

Fills all the cells with the same value.

Definition at line 177 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::m_map.

void CRandomFieldGridMap3D::getAsVtkStructuredGrid ( vtkStructuredGrid *  output,
const std::string label_mean = std::string("mean"),
const std::string label_stddev = std::string("stddev") 
) const
double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getResolutionXY ( ) const
inlineinherited
double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getResolutionZ ( ) const
inlineinherited
virtual const mrpt::utils::TRuntimeClassId* mrpt::maps::CRandomFieldGridMap3D::GetRuntimeClass ( ) const
virtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::utils::CSerializable.

size_t mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getSizeX ( ) const
inlineinherited

Definition at line 227 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::m_size_x.

Referenced by getAsVtkStructuredGrid().

size_t mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getSizeY ( ) const
inlineinherited

Definition at line 228 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::m_size_y.

Referenced by getAsVtkStructuredGrid().

size_t mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getSizeZ ( ) const
inlineinherited

Definition at line 229 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::m_size_z.

Referenced by getAsVtkStructuredGrid().

size_t mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getVoxelCount ( ) const
inlineinherited
double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getXMax ( ) const
inlineinherited

Definition at line 233 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::m_x_max.

double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getXMin ( ) const
inlineinherited

Definition at line 232 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::m_x_min.

double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getYMax ( ) const
inlineinherited

Definition at line 235 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::m_y_max.

double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getYMin ( ) const
inlineinherited

Definition at line 234 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::m_y_min.

double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getZMax ( ) const
inlineinherited

Definition at line 237 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::m_z_max.

double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getZMin ( ) const
inlineinherited

Definition at line 236 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::m_z_min.

double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::idx2x ( int  cx) const
inlineinherited

Transform a voxel index into a coordinate value of the voxel central point.

Definition at line 248 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::m_resolution_xy, and mrpt::utils::CDynamicGrid3D< T >::m_x_min.

Referenced by getAsVtkStructuredGrid(), and saveAsCSV().

double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::idx2y ( int  cy) const
inlineinherited
double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::idx2z ( int  cz) const
inlineinherited
bool CRandomFieldGridMap3D::insertIndividualReading ( const double  sensorReading,
const double  sensorVariance,
const mrpt::math::TPoint3D point,
const TVoxelInterpolationMethod  method,
const bool  update_map 
)

Direct update of the map with a reading in a given position of the map.

Returns
false if point is out of the grid extension.
Parameters
[in]sensorReadingThe value observed in the (x,y,z) position
[in]sensorVarianceThe variance of the sensor observation
[in]pointThe (x,y,z) location
[in]methodVoxel interpolation method: how many voxels will be affected by the reading
[in]update_mapRun a global map update after inserting this observation (algorithm-dependant)

Definition at line 308 of file CRandomFieldGridMap3D.cpp.

References mrpt::graphs::ScalarFactorGraph::addConstraint(), ASSERT_ABOVE_, ASSERTMSG_, mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellAbsIndexFromCXCYCZ(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::INVALID_VOXEL_IDX, mrpt::maps::CRandomFieldGridMap3D::TObservationGMRF::Lambda, m_gmrf, mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_map, m_mrf_factors_activeObs, MRPT_END, MRPT_START, mrpt::graphs::ScalarFactorGraph::UnaryFactorVirtualBase::node_id, mrpt::maps::CRandomFieldGridMap3D::TObservationGMRF::obsValue, updateMapEstimation(), mrpt::math::TPoint3D::x, mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::x2idx(), mrpt::math::TPoint3D::y, mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::y2idx(), mrpt::math::TPoint3D::z, and mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::z2idx().

Referenced by TEST().

void CRandomFieldGridMap3D::internal_initialize ( bool  erase_prev_contents = true)
protected
std::vector<TRandomFieldVoxel >& mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_map_castaway_const ( ) const
inlineprotectedinherited

Used only from logically const method that really need to modify the object.

Definition at line 255 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::m_map.

void mrpt::maps::CRandomFieldGridMap3D::operator delete ( void ptr)
throw (
)
inline

Definition at line 80 of file CRandomFieldGridMap3D.h.

void mrpt::maps::CRandomFieldGridMap3D::operator delete ( void memory,
void ptr 
)
throw (
)
inline

Definition at line 80 of file CRandomFieldGridMap3D.h.

void mrpt::maps::CRandomFieldGridMap3D::operator delete ( void ptr,
const std::nothrow_t &   
)
throw (
)
inline

Definition at line 80 of file CRandomFieldGridMap3D.h.

void mrpt::maps::CRandomFieldGridMap3D::operator delete[] ( void ptr)
throw (
)
inline

Definition at line 80 of file CRandomFieldGridMap3D.h.

static void* mrpt::maps::CRandomFieldGridMap3D::operator new ( size_t  size,
void ptr 
)
inlinestatic

Definition at line 80 of file CRandomFieldGridMap3D.h.

void* mrpt::maps::CRandomFieldGridMap3D::operator new ( size_t  size)
inline

Definition at line 80 of file CRandomFieldGridMap3D.h.

void* mrpt::maps::CRandomFieldGridMap3D::operator new ( size_t  size,
const std::nothrow_t &   
)
throw (
)
inline

Definition at line 80 of file CRandomFieldGridMap3D.h.

void* mrpt::maps::CRandomFieldGridMap3D::operator new[] ( size_t  size)
inline

Definition at line 80 of file CRandomFieldGridMap3D.h.

void CRandomFieldGridMap3D::readFromStream ( mrpt::utils::CStream in,
int  version 
)
protectedvirtual

Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori.

Parameters
inThe input binary stream where the object data must read from.
versionThe version of the object stored in the stream: use this version number in your code to know how to read the incoming data.
Exceptions
std::exceptionOn any error, see CStream::ReadBuffer
See Also
CStream

Implements mrpt::utils::CSerializable.

Definition at line 373 of file CRandomFieldGridMap3D.cpp.

References ASSERT_EQUAL_, mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::maps::CRandomFieldGridMap3D::TInsertionOptions::GMRF_lambdaPrior, mrpt::maps::CRandomFieldGridMap3D::TInsertionOptions::GMRF_skip_variance, insertionOptions, mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_map, MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION, and mrpt::utils::CStream::ReadBuffer().

virtual void mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::resize ( double  new_x_min,
double  new_x_max,
double  new_y_min,
double  new_y_max,
double  new_z_min,
double  new_z_max,
const TRandomFieldVoxel &  defaultValueNewCells,
double  additionalMarginMeters = 2.0 
)
inlinevirtualinherited
void CRandomFieldGridMap3D::resize ( double  new_x_min,
double  new_x_max,
double  new_y_min,
double  new_y_max,
double  new_z_min,
double  new_z_max,
const TRandomFieldVoxel defaultValueNewvoxels,
double  additionalMarginMeters = 2.0 
)
virtual

Changes the size of the grid, maintaining previous contents.

See Also
setSize

Definition at line 71 of file CRandomFieldGridMap3D.cpp.

References MRPT_END, and MRPT_START.

Referenced by TEST().

bool mrpt::maps::CRandomFieldGridMap3D::saveAsCSV ( const std::string filName_mean,
const std::string filName_stddev = std::string() 
) const

Save the current estimated mean values to a CSV file (compatible with Paraview) with fields x y z mean_value.

Optionally, std deviations can be also saved to another file with fields x y z stddev_value, if filName_stddev is provided.

Returns
false on error writing to file
See Also
saveAsVtkStructuredGrid

Definition at line 241 of file CRandomFieldGridMap3D.cpp.

References mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::idx2x(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::idx2y(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::idx2z(), mrpt::utils::CFileOutputStream::is_open(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_map, mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_size_x, mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_size_y, mrpt::utils::CFileOutputStream::open(), and mrpt::utils::CStream::printf().

Referenced by TEST().

bool CRandomFieldGridMap3D::saveAsVtkStructuredGrid ( const std::string fil) const

Save the current estimated grid to a VTK file (.vts) as a "structured grid".

See Also
saveAsCSV

Definition at line 211 of file CRandomFieldGridMap3D.cpp.

References getAsVtkStructuredGrid(), MRPT_END, MRPT_START, and THROW_EXCEPTION.

Referenced by TEST().

virtual void mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::setSize ( const double  x_min,
const double  x_max,
const double  y_min,
const double  y_max,
const double  z_min,
const double  z_max,
const double  resolution_xy,
const double  resolution_z_ = -1.0,
const TRandomFieldVoxel *  fill_value = NULL 
)
inlinevirtualinherited

Changes the size of the grid, ERASING all previous contents.

If fill_value is left as NULL, the contents of cells may be undefined (some will remain with their old values, the new ones will have the default voxel value, but the location of old values may change wrt their old places). If fill_value is not NULL, it is assured that all cells will have a copy of that value after resizing. If resolution_z<0, the same resolution will be used for all dimensions x,y,z as given in resolution_xy

See Also
resize, fill

Definition at line 135 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::m_map, mrpt::utils::CDynamicGrid3D< T >::m_resolution_xy, mrpt::utils::CDynamicGrid3D< T >::m_resolution_z, mrpt::utils::CDynamicGrid3D< T >::m_size_x, mrpt::utils::CDynamicGrid3D< T >::m_size_x_times_y, mrpt::utils::CDynamicGrid3D< T >::m_size_y, mrpt::utils::CDynamicGrid3D< T >::m_size_z, mrpt::utils::CDynamicGrid3D< T >::m_x_max, mrpt::utils::CDynamicGrid3D< T >::m_x_min, mrpt::utils::CDynamicGrid3D< T >::m_y_max, mrpt::utils::CDynamicGrid3D< T >::m_y_min, mrpt::utils::CDynamicGrid3D< T >::m_z_max, mrpt::utils::CDynamicGrid3D< T >::m_z_min, and mrpt::utils::round().

void CRandomFieldGridMap3D::setSize ( const double  x_min,
const double  x_max,
const double  y_min,
const double  y_max,
const double  z_min,
const double  z_max,
const double  resolution_xy,
const double  resolution_z = -1.0,
const TRandomFieldVoxel fill_value = NULL 
)
virtual

Changes the size of the grid, erasing previous contents.If resolution_z<0, the same resolution will be used for all dimensions x,y,z as given in resolution_xy

Changes the size of the grid, erasing previous contents.

See Also
resize.

Definition at line 56 of file CRandomFieldGridMap3D.cpp.

References MRPT_END, MRPT_START, and setSize().

Referenced by TEST().

void mrpt::maps::CRandomFieldGridMap3D::setVoxelsConnectivity ( const ConnectivityDescriptorPtr new_connectivity_descriptor)

Sets a custom object to define the connectivity between voxels.

Must call clear() or setSize() afterwards for the changes to take place.

Definition at line 303 of file CRandomFieldGridMap3D.cpp.

References m_gmrf_connectivity.

void CRandomFieldGridMap3D::updateMapEstimation ( )

Run the method-specific procedure required to ensure that the mean & variances are up-to-date with all inserted observations, using parameters in insertionOptions.

Definition at line 285 of file CRandomFieldGridMap3D.cpp.

References ASSERT_, ASSERTMSG_, mrpt::maps::CRandomFieldGridMap3D::TInsertionOptions::GMRF_skip_variance, insertionOptions, m_gmrf, mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_map, m_mrf_factors_activeObs, and mrpt::graphs::ScalarFactorGraph::updateEstimation().

Referenced by insertIndividualReading(), and TEST().

virtual mxArray* mrpt::utils::CSerializable::writeToMatlab ( ) const
inlinevirtualinherited

Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class.

Returns
A new mxArray (caller is responsible of memory freeing) or NULL is class does not support conversion to MATLAB.

Definition at line 79 of file CSerializable.h.

void CRandomFieldGridMap3D::writeToStream ( mrpt::utils::CStream out,
int getVersion 
) const
protectedvirtual

Introduces a pure virtual method responsible for writing to a CStream.

This can not be used directly be users, instead use "stream << object;" for writing it to a stream.

Parameters
outThe output binary stream where object must be dumped.
getVersionIf NULL, the object must be dumped. If not, only the version of the object dump must be returned in this pointer. This enables the versioning of objects dumping and backward compatibility with previously stored data.
Exceptions
std::exceptionOn any error, see CStream::WriteBuffer
See Also
CStream

Implements mrpt::utils::CSerializable.

Definition at line 341 of file CRandomFieldGridMap3D.cpp.

References mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::maps::CRandomFieldGridMap3D::TInsertionOptions::GMRF_lambdaPrior, mrpt::maps::CRandomFieldGridMap3D::TInsertionOptions::GMRF_skip_variance, insertionOptions, mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_map, and mrpt::utils::CStream::WriteBuffer().

int mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::x2idx ( double  x) const
inlineinherited

Transform a coordinate values into voxel indexes.

Definition at line 243 of file CDynamicGrid3D.h.

References mrpt::utils::CDynamicGrid3D< T >::m_resolution_xy, and mrpt::utils::CDynamicGrid3D< T >::m_x_min.

Referenced by insertIndividualReading().

int mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::y2idx ( double  y) const
inlineinherited
int mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::z2idx ( double  z) const
inlineinherited

Member Data Documentation

mrpt::utils::CLASSINIT mrpt::maps::CRandomFieldGridMap3D::_init_CRandomFieldGridMap3D
staticprotected

Definition at line 80 of file CRandomFieldGridMap3D.h.

const mrpt::utils::TRuntimeClassId mrpt::utils::CObject::classCObject
staticinherited

Definition at line 128 of file CObject.h.

mrpt::utils::TRuntimeClassId mrpt::maps::CRandomFieldGridMap3D::classCRandomFieldGridMap3D
static

Definition at line 80 of file CRandomFieldGridMap3D.h.

const mrpt::utils::TRuntimeClassId mrpt::utils::CSerializable::classCSerializable
staticinherited

Definition at line 42 of file CSerializable.h.

const mrpt::utils::TRuntimeClassId* mrpt::maps::CRandomFieldGridMap3D::classinfo
static

Definition at line 80 of file CRandomFieldGridMap3D.h.

bool mrpt::maps::CRandomFieldGridMap3D::ENABLE_GMRF_PROFILER
static

[default:false] Enables a profiler to show a performance report at application end.

Definition at line 82 of file CRandomFieldGridMap3D.h.

TInsertionOptions mrpt::maps::CRandomFieldGridMap3D::insertionOptions
const size_t mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::INVALID_VOXEL_IDX
staticinherited

Definition at line 182 of file CDynamicGrid3D.h.

Referenced by insertIndividualReading().

mrpt::graphs::ScalarFactorGraph mrpt::maps::CRandomFieldGridMap3D::m_gmrf
protected

Definition at line 197 of file CRandomFieldGridMap3D.h.

Referenced by insertIndividualReading(), and updateMapEstimation().

ConnectivityDescriptorPtr mrpt::maps::CRandomFieldGridMap3D::m_gmrf_connectivity
protected

Empty: default.

Definition at line 195 of file CRandomFieldGridMap3D.h.

Referenced by setVoxelsConnectivity().

std::vector<TRandomFieldVoxel > mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_map
mutableprotectedinherited
std::vector<std::deque<TObservationGMRF> > mrpt::maps::CRandomFieldGridMap3D::m_mrf_factors_activeObs
protected

Vector with the active observations and their respective Information, for each map cell.

Definition at line 226 of file CRandomFieldGridMap3D.h.

Referenced by insertIndividualReading(), and updateMapEstimation().

std::deque<TPriorFactorGMRF> mrpt::maps::CRandomFieldGridMap3D::m_mrf_factors_priors
protected

Vector with the precomputed priors for each GMRF model.

Definition at line 227 of file CRandomFieldGridMap3D.h.

double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_resolution_xy
protectedinherited

Definition at line 257 of file CDynamicGrid3D.h.

double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_resolution_z
protectedinherited

Definition at line 257 of file CDynamicGrid3D.h.

size_t mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_size_x
protectedinherited

Definition at line 258 of file CDynamicGrid3D.h.

Referenced by getAsVtkStructuredGrid(), and saveAsCSV().

size_t mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_size_x_times_y
protectedinherited

Definition at line 258 of file CDynamicGrid3D.h.

size_t mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_size_y
protectedinherited

Definition at line 258 of file CDynamicGrid3D.h.

Referenced by getAsVtkStructuredGrid(), and saveAsCSV().

size_t mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_size_z
protectedinherited

Definition at line 258 of file CDynamicGrid3D.h.

double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_x_max
protectedinherited

Definition at line 257 of file CDynamicGrid3D.h.

double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_x_min
protectedinherited

Definition at line 257 of file CDynamicGrid3D.h.

double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_y_max
protectedinherited

Definition at line 257 of file CDynamicGrid3D.h.

double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_y_min
protectedinherited

Definition at line 257 of file CDynamicGrid3D.h.

double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_z_max
protectedinherited

Definition at line 257 of file CDynamicGrid3D.h.

double mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_z_min
protectedinherited

Definition at line 257 of file CDynamicGrid3D.h.




Page generated by Doxygen 1.8.6 for MRPT 1.5.5 Git: e06b63d Fri Dec 1 14:41:11 2017 +0100 at sáb dic 2 13:00:21 CET 2017