Particle Identification and Tracking
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
utilities::Wrapper_i_hdf Class Reference

Wrapper class for eating data from hdf files, take 2. More...

#include <wrapper_i_hdf.h>

+ Inheritance diagram for utilities::Wrapper_i_hdf:
+ Collaboration diagram for utilities::Wrapper_i_hdf:

Public Types

enum  DATA_DIMS { TWO_D = 0, THREE_D }
 
typedef enum
utilities::Wrapper_i_hdf::DATA_DIMS 
DATA_DIMS
 

Public Member Functions

int get_value (int &out, int ind, D_TYPE type, int frame) const
 Returns the value of the type specified from the particle selected. More...
 
float get_value (float &out, int ind, D_TYPE type, int frame) const
 Returns the value of the type specified from the particle selected. More...
 
std::complex< float > get_value (std::complex< float > &out, int ind, D_TYPE type, int frame) const
 Returns the value of the type specified from the particle selected. More...
 
std::set< D_TYPEget_data_types () const
 Returns a set of the data types. More...
 
int get_num_entries (unsigned int frame) const
 Return the number of entries the specified frame. More...
 
int get_num_entries () const
 Return the total number of entries in the wrapper. More...
 
int get_num_frames () const
 Return the number of frames. More...
 
bool contains_type (D_TYPE type) const
 Returns if the wrapper contains the specified data type. More...
 
Tuplef get_dims () const
 Returns the dimension of each 'frame' of the data in the wrapper. More...
 
 ~Wrapper_i_hdf ()
 
 Wrapper_i_hdf ()
 Constructor. More...
 
bool initialize (const std::string &fname, const std::set< utilities::D_TYPE > &dtypes, int comp_number, unsigned int start=0, int frames=0)
 Initialize. More...
 
bool initialize (const std::string &fname, const std::set< utilities::D_TYPE > &dtypes, int comp_number, unsigned int start, int f_count, bool two_d_data)
 Initialize. More...
 
bool initialize (const std::string &fname, const std::set< std::pair< utilities::D_TYPE, int > > &dtypes, unsigned int start, int f_count, bool two_d_data)
 Initialize. More...
 
bool initialize (int f_count)
 Initialize. More...
 
float get_xy_scale () const
 returns the scaling between pixels and microns. More...
 
unsigned int get_start_offset () const
 Returns the starting plane. More...
 
bool set_file_name (const std::string &fname)
 Set fname. More...
 
bool add_dtype (utilities::D_TYPE dtype, int comp_key)
 Set a data type/comp number pair. More...
 
bool set_twoD (bool twod_data)
 Set a data type/comp number pair. More...
 
Meta data handling functions
const Md_storeget_Md_store (unsigned int j) const
 Returns a pointer to plane j's meta data store. More...
 
Md_storeget_Md_store (unsigned int j)
 Returns a pointer to plane j's meta data store. More...
 
void set_Md_store (unsigned int j, Md_store *in)
 Sets the Md_store for plane j. More...
 
void set_Md_store_size (unsigned int j)
 Sets the size of the md_stores_ vector. More...
 
unsigned int get_Md_store_size ()
 Gets the size of the md_stores_ vector. More...
 
void clear_Md_store (unsigned int j)
 Deletes plane j's Md_store. More...
 

Private Member Functions

void clean_data ()
 Deletes all allocated data. More...
 
bool priv_init (int f_count=0)
 Private initialization function. More...
 
void make_dtype_pairs (int comp_nuber)
 Turns a set of data types in to a set of pairs assuming they all have the same computation number. More...
 
void make_dtype_set ()
 Extracts the set of data types from a set of (D_TYPE,comp_num) pairs. More...
 

Static Private Member Functions

static std::string format_name (int in)
 

Private Attributes

std::string file_name_
 name for the data file More...
 
std::set< std::pair
< utilities::D_TYPE, int > > 
data_types_
 Set of pairs of data types and the computation number to be used for that data type. More...
 
std::set< utilities::D_TYPEdata_types_set_
 Set of data types in the wrapper. More...
 
Data_map d_mapi_
 Data map for integer data. More...
 
Data_map d_mapf_
 Data map for float data. More...
 
Data_map d_mapc_
 Data map for complex<float> data. More...
 
std::vector< std::vector< int * > > data_i_
 Data structure for integer data. More...
 
std::vector< std::vector
< float * > > 
data_f_
 Data structure for float data. More...
 
std::vector< std::vector
< std::complex< float > * > > 
data_c_
 Data structure for complex<float> data. More...
 
std::vector< int > frame_c_
 the number of particles in each frame More...
 
unsigned int frame_count_
 The number of frames. More...
 
unsigned int total_part_count_
 The total number of particles in all frames. More...
 
bool two_d_data_
 If we are reading in 2D data. More...
 
std::vector< float > frame_zdata_
 A vector of the z-position of each frame. More...
 
unsigned int start_
 first frame to read in More...
 
bool locked_
 if the parameters are locked More...
 

Detailed Description

Wrapper class for eating data from hdf files, take 2.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
TWO_D 
THREE_D 

Constructor & Destructor Documentation

Wrapper_i_hdf::~Wrapper_i_hdf ( )

References clean_data().

Wrapper_i_hdf::Wrapper_i_hdf ( )

Constructor.

Member Function Documentation

bool Wrapper_i_hdf::add_dtype ( utilities::D_TYPE  dtype,
int  comp_key 
)

Set a data type/comp number pair.

Returns true if successful

References data_types_, data_types_set_, and locked_.

void Wrapper_i_hdf::clean_data ( )
private

Deletes all allocated data.

References data_c_, data_f_, data_i_, and locked_.

Referenced by ~Wrapper_i_hdf().

void Wrapper_in::clear_Md_store ( unsigned int  j)
inherited

Deletes plane j's Md_store.

References utilities::Wrapper_in::md_stores_.

bool Wrapper_i_hdf::contains_type ( D_TYPE  type) const
virtual

Returns if the wrapper contains the specified data type.

Implements utilities::Wrapper_in.

References data_types_set_.

Referenced by get_value().

string Wrapper_i_hdf::format_name ( int  in)
staticprivate

Referenced by priv_init().

std::set< D_TYPE > Wrapper_i_hdf::get_data_types ( ) const
virtual

Returns a set of the data types.

Use the other version

Implements utilities::Wrapper_in.

References data_types_set_.

Tuplef Wrapper_i_hdf::get_dims ( ) const
virtual

Returns the dimension of each 'frame' of the data in the wrapper.

Implements utilities::Wrapper_in.

References file_name_.

Referenced by main().

const Md_store * Wrapper_in::get_Md_store ( unsigned int  j) const
inherited

Returns a pointer to plane j's meta data store.

Const version

References utilities::Wrapper_in::md_stores_.

Referenced by tracking::Master_box::get_Md_store(), and tracking::hash_case::init().

Md_store * Wrapper_in::get_Md_store ( unsigned int  j)
inherited

Returns a pointer to plane j's meta data store.

Const version

References utilities::Wrapper_in::md_stores_.

unsigned int Wrapper_in::get_Md_store_size ( )
inherited

Gets the size of the md_stores_ vector.

References utilities::Wrapper_in::md_stores_.

int Wrapper_i_hdf::get_num_entries ( unsigned int  frame) const
virtual

Return the number of entries the specified frame.

Implements utilities::Wrapper_in.

References frame_c_.

int Wrapper_i_hdf::get_num_entries ( ) const
virtual

Return the total number of entries in the wrapper.

Implements utilities::Wrapper_in.

References total_part_count_.

int Wrapper_i_hdf::get_num_frames ( ) const
virtual

Return the number of frames.

Implements utilities::Wrapper_in.

References frame_count_.

Referenced by main().

unsigned int utilities::Wrapper_i_hdf::get_start_offset ( ) const
inline

Returns the starting plane.

This may be needed to put data back into hdf files properly. Although, processing only part of the file seems like it would lead to madness and chaos.

References start_.

int Wrapper_i_hdf::get_value ( int &  out,
int  ind,
D_TYPE  type,
int  frame 
) const
virtual

Returns the value of the type specified from the particle selected.

Parameters
out[out] the value
ind[in] the index of the particle
type[in] the D_TYPE
frame[in] the frame the particle is in
Returns
the value

Implements utilities::Wrapper_in.

References contains_type(), d_mapi_, data_i_, utilities::DT2str_s(), utilities::V_INT, and utilities::v_type().

float Wrapper_i_hdf::get_value ( float &  out,
int  ind,
D_TYPE  type,
int  frame 
) const
virtual

Returns the value of the type specified from the particle selected.

Parameters
out[out] the value
ind[in] the index of the particle
type[in] the D_TYPE
frame[in] the frame the particle is in
Returns
the value

Implements utilities::Wrapper_in.

References contains_type(), d_mapf_, utilities::D_ZPOS, data_f_, utilities::DT2str_s(), frame_zdata_, two_d_data_, utilities::V_FLOAT, and utilities::v_type().

std::complex< float > Wrapper_i_hdf::get_value ( std::complex< float > &  out,
int  ind,
D_TYPE  type,
int  frame 
) const
virtual

Returns the value of the type specified from the particle selected.

Parameters
out[out] the value
ind[in] the index of the particle
type[in] the D_TYPE
frame[in] the frame the particle is in
Returns
the value

Implements utilities::Wrapper_in.

References contains_type(), d_mapc_, data_c_, utilities::DT2str_s(), utilities::V_COMPLEX, and utilities::v_type().

float Wrapper_i_hdf::get_xy_scale ( ) const

returns the scaling between pixels and microns.

This should be pushed up to the next level, but I am lazy.

/todo make it actually ask the hdf for the calibration,

bool Wrapper_i_hdf::initialize ( const std::string &  fname,
const std::set< utilities::D_TYPE > &  dtypes,
int  comp_number,
unsigned int  start = 0,
int  frames = 0 
)

Initialize.

Returns true if successful

Parameters
fname[in] name of hdf file to read in
dtypes[in] a set of D_TYPES to extract from the hdf file
comp_number[in] the computation number to read
start[in] the first frame to read from
frames[in] the number of frames to read

Referenced by main().

bool Wrapper_i_hdf::initialize ( const std::string &  fname,
const std::set< utilities::D_TYPE > &  dtypes,
int  comp_number,
unsigned int  start,
int  f_count,
bool  two_d_data 
)

Initialize.

Returns true if successful

Parameters
fname[in] name of hdf file to read in
dtypes[in] a set of D_TYPES to extract from the hdf file
comp_number[in] the computation number to read
start[in] the first frame to read from
f_count[in] the number of frames to read
two_d_data[in] if this is 2D data

References data_types_set_, file_name_, fname, make_dtype_pairs(), priv_init(), start_, and two_d_data_.

bool Wrapper_i_hdf::initialize ( const std::string &  fname,
const std::set< std::pair< utilities::D_TYPE, int > > &  dtypes,
unsigned int  start,
int  f_count,
bool  two_d_data 
)

Initialize.

Returns true if successful

Parameters
fname[in] name of hdf file to read in
dtypes[in] a set of (D_TYPES,comp_number) pairs to extract from the hdf file
start[in] the first frame to read from
f_count[in] the number of frames to read
two_d_data[in] if this is 2D data

References data_types_, file_name_, fname, make_dtype_set(), priv_init(), start_, and two_d_data_.

bool Wrapper_i_hdf::initialize ( int  f_count)

Initialize.

Assumes fname, and the data type/comp_key mapping is already set. Returns true if successful..

References priv_init().

void Wrapper_i_hdf::make_dtype_pairs ( int  comp_nuber)
private

Turns a set of data types in to a set of pairs assuming they all have the same computation number.

References data_types_, and data_types_set_.

Referenced by initialize().

void Wrapper_i_hdf::make_dtype_set ( )
private

Extracts the set of data types from a set of (D_TYPE,comp_num) pairs.

References data_types_, and data_types_set_.

Referenced by initialize().

bool Wrapper_i_hdf::priv_init ( int  f_count = 0)
private
bool Wrapper_i_hdf::set_file_name ( const std::string &  fname)

Set fname.

Returns true if successful.

References file_name_, fname, and locked_.

void Wrapper_in::set_Md_store ( unsigned int  j,
Md_store in 
)
inherited

Sets the Md_store for plane j.

When the pointer is assigned the wrapper takes ownership of the pointer and will clean it up.

References utilities::Wrapper_in::md_stores_.

Referenced by iden::Iden::fill_wrapper(), iden::Iden::fill_wrapper_avg(), main(), priv_init(), and iden::Iden::process_frame().

void Wrapper_in::set_Md_store_size ( unsigned int  j)
inherited
bool Wrapper_i_hdf::set_twoD ( bool  twod_data)

Set a data type/comp number pair.

Returns true if successful

References locked_, and two_d_data_.

Member Data Documentation

Data_map utilities::Wrapper_i_hdf::d_mapc_
private

Data map for complex<float> data.

Referenced by get_value(), and priv_init().

Data_map utilities::Wrapper_i_hdf::d_mapf_
private

Data map for float data.

Referenced by get_value(), and priv_init().

Data_map utilities::Wrapper_i_hdf::d_mapi_
private

Data map for integer data.

Referenced by get_value(), and priv_init().

std::vector<std::vector<std::complex<float>*> > utilities::Wrapper_i_hdf::data_c_
private

Data structure for complex<float> data.

First dimension is data type, second is frame, third in particle index

Referenced by clean_data(), get_value(), and priv_init().

std::vector<std::vector<float*> > utilities::Wrapper_i_hdf::data_f_
private

Data structure for float data.

First dimension is data type, second is frame, third in particle index

Referenced by clean_data(), get_value(), and priv_init().

std::vector<std::vector<int*> > utilities::Wrapper_i_hdf::data_i_
private

Data structure for integer data.

First dimension is data type, second is frame, third in particle index

Referenced by clean_data(), get_value(), and priv_init().

std::set<std::pair<utilities::D_TYPE,int> > utilities::Wrapper_i_hdf::data_types_
private

Set of pairs of data types and the computation number to be used for that data type.

Referenced by add_dtype(), initialize(), make_dtype_pairs(), make_dtype_set(), and priv_init().

std::set<utilities::D_TYPE> utilities::Wrapper_i_hdf::data_types_set_
private

Set of data types in the wrapper.

This is mostly redundant, but useful.

Referenced by add_dtype(), contains_type(), get_data_types(), initialize(), make_dtype_pairs(), and make_dtype_set().

std::string utilities::Wrapper_i_hdf::file_name_
private

name for the data file

Referenced by get_dims(), initialize(), priv_init(), and set_file_name().

std::vector<int> utilities::Wrapper_i_hdf::frame_c_
private

the number of particles in each frame

Referenced by get_num_entries(), and priv_init().

unsigned int utilities::Wrapper_i_hdf::frame_count_
private

The number of frames.

Referenced by get_num_frames(), and priv_init().

std::vector<float> utilities::Wrapper_i_hdf::frame_zdata_
private

A vector of the z-position of each frame.

For 2D data this is the center of the plane, for 3D this provides if we have any drift.

Referenced by get_value(), and priv_init().

bool utilities::Wrapper_i_hdf::locked_
private

if the parameters are locked

Referenced by add_dtype(), clean_data(), priv_init(), set_file_name(), and set_twoD().

unsigned int utilities::Wrapper_i_hdf::start_
private

first frame to read in

Referenced by get_start_offset(), initialize(), and priv_init().

unsigned int utilities::Wrapper_i_hdf::total_part_count_
private

The total number of particles in all frames.

Referenced by get_num_entries(), and priv_init().

bool utilities::Wrapper_i_hdf::two_d_data_
private

If we are reading in 2D data.

Referenced by get_value(), initialize(), priv_init(), and set_twoD().


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