Particle Identification and Tracking
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
tracking::Hash_shelf Class Reference

Class to implement the hash table. More...

#include <hash_shelf.h>

+ Collaboration diagram for tracking::Hash_shelf:

Public Member Functions

utilities::Tuplef get_img_dims () const
 Returns the image dimensions of the shelf. More...
 
void push (particle *p)
 add the particle_base to the hash_shelf More...
 
virtual unsigned int hash_function (const particle *p) const
 Generates the hash value based on a pointer to a particle object. More...
 
 Hash_shelf (utilities::Tuplef imgsz, float upb, int i_frame, bool own_part, int max_part_indx_=0, float z_offset=0)
 Constructor. More...
 
virtual ~Hash_shelf ()
 Destructor. More...
 
virtual void print () const
 Print function. More...
 
int get_plane_num () const
 returns the plane number of this shelf More...
 
void shelf_to_list (std::list< const particle * > &tmp) const
 Converts the whole shelf to a list of const pointers. More...
 
void shelf_to_list (std::list< particle * > &tmp) const
 Converts the whole shelf to a list. More...
 
void compute_mean_forward_disp (utilities::Tuplef &cum_disp)
 Computes the mean displacement of a frame. More...
 
const utilities::Tuplefget_mean_forward_disp () const
 Getter function for mean forward displacement from the previous shelf in a case. More...
 
const utilities::Tuplefget_cum_forward_disp () const
 Getter function for mean forward displacement from the first shelf in a case. More...
 
void set_next_shelf (Hash_shelf *next)
 Sets the pointer to the next shelf in a case. More...
 
bool step_forwards (int n, const Hash_shelf *&next) const
 Returns true if there is a shelf n steps forward and passes a pointer to it out as a reference, if there is not a shelf, returns false. More...
 
void fill_in_neighborhood ()
 Fills in the neighbor vectors for the particles in the shelf. More...
 
void pass_fun_to_part (void(particle::*fun)())
 Passes functions down the pyramid, this one for void, argument-less functions non-const. More...
 
void pass_fun_to_part (void(particle::*fun)() const) const
 Passes functions down the pyramid, this one for void, argument-less functions, const. More...
 
virtual void output_to_wrapper (utilities::Wrapper_out &wrapper) const
 for outputting to a wrapper More...
 
void compute_corr (tracking::Corr &) const
 passes a Corr object down the pyramid More...
 
void compute_accum (Accumulator &in) const
 Passes an Accumulator object down the pyramid. More...
 
void test ()
 Testing function to verify that the hash function. More...
 
std::list< particle_track * > * shelf_to_list () const
 This needs to remain beaause of the way that track_list and the linking code is written. More...
 
Get Region

appends the region of (2*range +1) on a side from the hash table centered on the box (n,m) deals with boxes with in range of the edges by truncating the volume returned.

Functions that use this need to keep track of this them selves

void get_region_px (int n, std::vector< const particle * > &out, float range_in_units) const
 gets a region where range is set by a distance in real space /pram n the hash_box to center on /pram out a vector that the particles in the region will be added to /pram range_in_units the distance around the central box in data units to extract More...
 
void get_region (int n, hash_box *box, int range) const
 gets a region around box n and puts the results into a hash_box. More...
 
void get_region (particle *n, hash_box *box, int range) const
 gets a region around box containing particle n and puts the results into a hash_box. More...
 
void get_region (int n, std::list< particle * > &out_list, int range) const
 gets a region around box n and puts the particles in to the list handed in More...
 
void get_region (int n, std::vector< const particle * > &out_vector, int range) const
 gets a region around box n and puts the particles in to the vector handed in. More...
 

Public Attributes

const utilities::Md_storemd_store_
 Pointer to a Md_store object. More...
 

Private Member Functions

int tuple_to_indx (const utilities::Tuplei &cord) const
 converts a coordinate tuple in the hash shelf to an index More...
 
utilities::Tuplei indx_to_tuple (int indx) const
 converts an index in the hash shelf to a coordinate tuple More...
 
utilities::Tuplei range_indx_to_tuple (int indx, const utilities::Tuplei &side) const
 converts an arbitrary More...
 
void priv_init ()
 private initialization function More...
 
void make_region_corners (const utilities::Tuplei &center, utilities::Tuplei &bottom_corner, utilities::Tuplei &top_corner, utilities::Tuplei &region_sides, const int range) const
 does the computation to get a region of size 2*range +1 around the center More...
 

Private Attributes

std::vector< hash_box * > hash_
 Main data structure. More...
 
int plane_number_
 stores the plane number of the shelf More...
 
utilities::Tuplef mean_forward_disp_
 The mean displacement of the plane. More...
 
utilities::Tuplef cumulative_disp_
 Cumlative displacement vector. More...
 
Hash_shelfnext_
 Pointer to the next shelf in the case. More...
 
unsigned int particle_count_
 number of particles in shelf. More...
 
int max_part_indx_
 Number of particles in the input wrapper. More...
 
utilities::Tuplei hash_dims_
 Dimensions of the hash table. More...
 
utilities::Tuplei hash_cum_dim_
 The cumulative dimensions for index to cord conversions. More...
 
utilities::Tuplef img_dims_
 Dimensions of the image. More...
 
float upb_
 size of the side of each hash box More...
 
float z_offset_
 The z-off set of the shelf. More...
 
bool own_part_
 bool if the hash_box objects in this hash shelf are to own their particles. More...
 

Detailed Description

Class to implement the hash table.

This class contains hash_box objects and in contained by Hash_case objects.

Constructor & Destructor Documentation

Hash_shelf::Hash_shelf ( utilities::Tuplef  imgsz,
float  upb,
int  i_frame,
bool  own_part,
int  max_part_indx_ = 0,
float  z_offset = 0 
)

Constructor.

References priv_init().

Hash_shelf::~Hash_shelf ( )
virtual

Destructor.

References hash_, and md_store_.

Member Function Documentation

void Hash_shelf::compute_accum ( Accumulator in) const

Passes an Accumulator object down the pyramid.

References hash_.

void Hash_shelf::compute_corr ( tracking::Corr in) const
void Hash_shelf::compute_mean_forward_disp ( utilities::Tuplef cum_disp)

Computes the mean displacement of a frame.

This is done to deal with possible flows in the sample. Particles with out forward tracking data are ignored.

References utilities::Tuple< T, length >::clear(), cumulative_disp_, tracking::particle_base::get_disp(), tracking::particle_track::get_next(), hash_, and mean_forward_disp_.

void Hash_shelf::fill_in_neighborhood ( )

Fills in the neighbor vectors for the particles in the shelf.

Todo:
change this to use not hash_box objects as containers

References tracking::particle_base::add_to_neighborhood(), tracking::particle_base::get_max_range(), get_region(), hash_, tracking::particle_base::sort_neighborhood(), and upb_.

const utilities::Tuplef& tracking::Hash_shelf::get_cum_forward_disp ( ) const
inline

Getter function for mean forward displacement from the first shelf in a case.

References cumulative_disp_.

Referenced by tracking::particle_track::distancesq_corrected(), tracking::particle_track::get_corrected_disp(), and tracking::particle_track::get_corrected_pos().

utilities::Tuplef tracking::Hash_shelf::get_img_dims ( ) const
inline

Returns the image dimensions of the shelf.

References img_dims_.

const utilities::Tuplef& tracking::Hash_shelf::get_mean_forward_disp ( ) const
inline

Getter function for mean forward displacement from the previous shelf in a case.

References mean_forward_disp_.

int tracking::Hash_shelf::get_plane_num ( ) const
inline

returns the plane number of this shelf

References plane_number_.

void tracking::Hash_shelf::get_region ( int  n,
hash_box box,
int  range 
) const

gets a region around box n and puts the results into a hash_box.

This is here because it gets used in some places deep in the code. These should be gotten rid of /pram n the hash_box to center on /pram box the hash_box to add particles to /pram range how big of a region to extract

Referenced by fill_in_neighborhood(), get_region_px(), and test().

void Hash_shelf::get_region ( particle n,
hash_box box,
int  range 
) const

gets a region around box containing particle n and puts the results into a hash_box.

This is here because it gets used in some places deep in the code. These should be gotten rid of

/pram n particle in hash_box to center on /pram box the hash_box to add particles to /pram range how big of a region to extract

References tracking::hash_box::append(), hash_, hash_function(), indx_to_tuple(), make_region_corners(), range_indx_to_tuple(), and tuple_to_indx().

void Hash_shelf::get_region ( int  n,
std::list< particle * > &  out_list,
int  range 
) const

gets a region around box n and puts the particles in to the list handed in

/pram n hash_box to center on /pram out_list list the particles are added to /pram range how big of a region to extract

References tracking::hash_box::begin(), tracking::hash_box::end(), hash_, indx_to_tuple(), make_region_corners(), range_indx_to_tuple(), and tuple_to_indx().

void Hash_shelf::get_region ( int  n,
std::vector< const particle * > &  out_vector,
int  range 
) const

gets a region around box n and puts the particles in to the vector handed in.

There is something funny going on with const correctness with this

/pram n hash_box to center on /pram out_vector list the particles are added to /pram range how big of a region to extract

References tracking::hash_box::begin(), tracking::hash_box::end(), hash_, indx_to_tuple(), make_region_corners(), range_indx_to_tuple(), and tuple_to_indx().

void Hash_shelf::get_region_px ( int  n,
std::vector< const particle * > &  out,
float  range_in_units 
) const

gets a region where range is set by a distance in real space /pram n the hash_box to center on /pram out a vector that the particles in the region will be added to /pram range_in_units the distance around the central box in data units to extract

References get_region(), and upb_.

Referenced by tracking::hash_box::compute_corr().

unsigned int Hash_shelf::hash_function ( const particle p) const
virtual

Generates the hash value based on a pointer to a particle object.

Todo:
figure out why this is public and fix it

References tracking::particle_base::get_position(), hash_cum_dim_, hash_dims_, and upb_.

Referenced by get_region(), and push().

Tuplei Hash_shelf::indx_to_tuple ( int  indx) const
private

converts an index in the hash shelf to a coordinate tuple

References hash_, hash_cum_dim_, and hash_dims_.

Referenced by get_region(), and test().

void Hash_shelf::make_region_corners ( const utilities::Tuplei center,
utilities::Tuplei bottom_corner,
utilities::Tuplei top_corner,
utilities::Tuplei region_sides,
const int  range 
) const
private

does the computation to get a region of size 2*range +1 around the center

References hash_dims_.

Referenced by get_region().

void Hash_shelf::output_to_wrapper ( utilities::Wrapper_out wrapper) const
virtual
void Hash_shelf::pass_fun_to_part ( void(particle::*)()  fun)

Passes functions down the pyramid, this one for void, argument-less functions non-const.

References hash_.

Referenced by pass_fun_to_part().

void Hash_shelf::pass_fun_to_part ( void(particle::*)() const  fun) const

Passes functions down the pyramid, this one for void, argument-less functions, const.

References hash_, and pass_fun_to_part().

void Hash_shelf::print ( ) const
virtual

Print function.

References hash_dims_, and particle_count_.

void Hash_shelf::priv_init ( )
private

private initialization function

References hash_, hash_cum_dim_, hash_dims_, img_dims_, max_hash_dim_prod, and upb_.

Referenced by Hash_shelf().

void Hash_shelf::push ( particle p)
Tuplei Hash_shelf::range_indx_to_tuple ( int  indx,
const utilities::Tuplei side 
) const
private

converts an arbitrary

Referenced by compute_corr(), and get_region().

void Hash_shelf::set_next_shelf ( Hash_shelf next)

Sets the pointer to the next shelf in a case.

References next_.

void Hash_shelf::shelf_to_list ( std::list< const particle * > &  tmp) const

Converts the whole shelf to a list of const pointers.

References hash_.

Referenced by tracking::Track_shelf::init().

void Hash_shelf::shelf_to_list ( std::list< particle * > &  tmp) const

Converts the whole shelf to a list.

References hash_.

list< particle_track * > * Hash_shelf::shelf_to_list ( ) const

This needs to remain beaause of the way that track_list and the linking code is written.

References hash_.

bool Hash_shelf::step_forwards ( int  n,
const Hash_shelf *&  next 
) const

Returns true if there is a shelf n steps forward and passes a pointer to it out as a reference, if there is not a shelf, returns false.

References next_.

void Hash_shelf::test ( )

Testing function to verify that the hash function.

References get_region(), hash_dims_, indx_to_tuple(), and tuple_to_indx().

Referenced by main().

int Hash_shelf::tuple_to_indx ( const utilities::Tuplei cord) const
private

converts a coordinate tuple in the hash shelf to an index

References hash_cum_dim_, and hash_dims_.

Referenced by compute_corr(), get_region(), and test().

Member Data Documentation

utilities::Tuplef tracking::Hash_shelf::cumulative_disp_
private

Cumlative displacement vector.

Referenced by compute_mean_forward_disp(), get_cum_forward_disp(), and output_to_wrapper().

std::vector<hash_box*> tracking::Hash_shelf::hash_
private

Main data structure.

This is an vector of hash boxes. For simplicity the strcuture is stored as a 1-D array and the class takes care of the 1D<->2D conversion

Referenced by compute_accum(), compute_corr(), compute_mean_forward_disp(), fill_in_neighborhood(), get_region(), indx_to_tuple(), output_to_wrapper(), pass_fun_to_part(), priv_init(), push(), shelf_to_list(), and ~Hash_shelf().

utilities::Tuplei tracking::Hash_shelf::hash_cum_dim_
private

The cumulative dimensions for index to cord conversions.

Referenced by hash_function(), indx_to_tuple(), priv_init(), and tuple_to_indx().

utilities::Tuplei tracking::Hash_shelf::hash_dims_
private
utilities::Tuplef tracking::Hash_shelf::img_dims_
private

Dimensions of the image.

Referenced by get_img_dims(), and priv_init().

int tracking::Hash_shelf::max_part_indx_
private

Number of particles in the input wrapper.

needed to use filters and to write back out to the same file

Referenced by output_to_wrapper(), and push().

const utilities::Md_store* tracking::Hash_shelf::md_store_

Pointer to a Md_store object.

The input wrapper owns this, if it is deleted before the hash shelf is done, we are in trouble.

Referenced by compute_corr(), tracking::hash_case::init(), output_to_wrapper(), and ~Hash_shelf().

utilities::Tuplef tracking::Hash_shelf::mean_forward_disp_
private

The mean displacement of the plane.

The definition of velocity is $v_i = x_{i +1} - x_i$ hence the 'forward' velocity

Referenced by compute_mean_forward_disp(), get_mean_forward_disp(), and output_to_wrapper().

Hash_shelf* tracking::Hash_shelf::next_
private

Pointer to the next shelf in the case.

Referenced by set_next_shelf(), and step_forwards().

bool tracking::Hash_shelf::own_part_
private

bool if the hash_box objects in this hash shelf are to own their particles.

this needs to be kept track of because boxes are created on the fly.

Referenced by push().

unsigned int tracking::Hash_shelf::particle_count_
private

number of particles in shelf.

Minor memory hit, but useful to know

Referenced by output_to_wrapper(), print(), and push().

int tracking::Hash_shelf::plane_number_
private

stores the plane number of the shelf

Referenced by get_plane_num(), and output_to_wrapper().

float tracking::Hash_shelf::upb_
private

size of the side of each hash box

Referenced by compute_corr(), fill_in_neighborhood(), get_region_px(), hash_function(), and priv_init().

float tracking::Hash_shelf::z_offset_
private

The z-off set of the shelf.


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