Particle Identification and Tracking
|
Class to implement the hash table. More...
#include <hash_shelf.h>
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::Tuplef & | get_mean_forward_disp () const |
Getter function for mean forward displacement from the previous shelf in a case. More... | |
const utilities::Tuplef & | get_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_store * | md_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 ¢er, utilities::Tuplei &bottom_corner, utilities::Tuplei &top_corner, utilities::Tuplei ®ion_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_shelf * | next_ |
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... | |
Class to implement the hash table.
This class contains hash_box objects and in contained by Hash_case objects.
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().
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 |
passes a Corr object down the pyramid
References tracking::Corr::add_plane_temperature(), utilities::Md_store::contains_key(), tracking::Corr::get_max_range(), utilities::Md_store::get_value(), hash_, hash_dims_, md_store_, range_indx_to_tuple(), TEMPERATURE_STRING, tuple_to_indx(), and upb_.
Referenced by main().
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.
References tracking::particle_base::add_to_neighborhood(), tracking::particle_base::get_max_range(), get_region(), hash_, tracking::particle_base::sort_neighborhood(), and upb_.
|
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().
|
inline |
Returns the image dimensions of the shelf.
References img_dims_.
|
inline |
Getter function for mean forward displacement from the previous shelf in a case.
References mean_forward_disp_.
|
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().
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().
|
virtual |
Generates the hash value based on a pointer to a particle object.
References tracking::particle_base::get_position(), hash_cum_dim_, hash_dims_, and upb_.
Referenced by get_region(), and push().
|
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().
|
private |
does the computation to get a region of size 2*range +1 around the center
References hash_dims_.
Referenced by get_region().
|
virtual |
for outputting to a wrapper
References utilities::Wrapper_out::add_meta_data_comp(), utilities::Wrapper_out::add_meta_store(), utilities::Wrapper_out::close_group(), cumulative_disp_, hash_, max_part_indx_, md_store_, mean_forward_disp_, utilities::Wrapper_out::open_group(), particle_count_, and plane_number_.
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().
|
virtual |
Print function.
References hash_dims_, and particle_count_.
|
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) |
add the particle_base to the hash_shelf
p | pointer to the particle to add |
References utilities::D_XPOS, utilities::D_YPOS, tracking::particle_base::get_ind(), tracking::particle_track::get_value(), hash_, hash_function(), max_part_indx_, own_part_, particle_count_, tracking::particle_base::print(), and tracking::hash_box::push().
Referenced by tracking::hash_case::init().
|
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().
|
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().
|
private |
Cumlative displacement vector.
Referenced by compute_mean_forward_disp(), get_cum_forward_disp(), and output_to_wrapper().
|
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().
|
private |
The cumulative dimensions for index to cord conversions.
Referenced by hash_function(), indx_to_tuple(), priv_init(), and tuple_to_indx().
|
private |
Dimensions of the hash table.
Referenced by compute_corr(), hash_function(), indx_to_tuple(), make_region_corners(), print(), priv_init(), test(), and tuple_to_indx().
|
private |
Dimensions of the image.
Referenced by get_img_dims(), and priv_init().
|
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().
|
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().
|
private |
Pointer to the next shelf in the case.
Referenced by set_next_shelf(), and step_forwards().
|
private |
|
private |
number of particles in shelf.
Minor memory hit, but useful to know
Referenced by output_to_wrapper(), print(), and push().
|
private |
stores the plane number of the shelf
Referenced by get_plane_num(), and output_to_wrapper().
|
private |
size of the side of each hash box
Referenced by compute_corr(), fill_in_neighborhood(), get_region_px(), hash_function(), and priv_init().
|
private |
The z-off set of the shelf.