Stimfit
0.13.15
|
Represents the data within a file. More...
#include <recording.h>
Public Member Functions | |
Recording () | |
Default constuctor. | |
Recording (const Channel &c_Channel) | |
Constructor. | |
Recording (const std::vector< Channel > &ChannelList) | |
Constructor. | |
Recording (std::size_t c_n_channels, std::size_t c_n_sections=0, std::size_t c_n_points=0) | |
Constructor. | |
virtual | ~Recording () |
Destructor. | |
std::size_t | GetChannelSize (std::size_t n_channel) const |
Retrieves the number of sections in a channel. | |
const std::vector< Channel > & | get () const |
Retrieves the channels (read-only). | |
std::vector< Channel > & | get () |
Retrieves the channels (read and write). | |
const std::string & | GetFileDescription () const |
Retrieves the file description. | |
const std::string & | GetGlobalSectionDescription () const |
Retrieves the common section description. | |
const std::string & | GetScaling () const |
Retrieves the scaling as a string. | |
const std::string & | GetTime () |
Retrieves the time of recording as a string. | |
const std::string & | GetDate () |
Retrieves the date of recording as a string. | |
struct tm | GetDateTime () const |
Retrieves the date of recording as a string. | |
const std::string & | GetComment () const |
Retrieves a comment string. | |
const std::string & | GetXUnits () const |
Retrieves the x units. | |
std::size_t | size () const |
Retrieves the size of the channel array. | |
double | GetXScale () const |
Retrieves the x scaling (sampling interval). | |
double | GetSR () const |
Retrieves the sampling rate ( 1 / x-scale ) | |
std::size_t | GetCurChIndex () const |
Retrieves the index of the current channel. | |
std::size_t | GetSecChIndex () const |
Retrieves the index of the second channel. | |
std::size_t | GetCurSecIndex () const |
Retrieves the index of the current section. | |
const std::vector< std::size_t > & | GetSelectedSections () const |
Retrieves the indices of the selected sections (read-only). | |
std::vector< std::size_t > & | GetSelectedSectionsW () |
Retrieves the indices of the selected sections (read and write). | |
const Vector_double & | GetSelectBase () const |
Retrieves the stored baseline values of the selected sections (read-only). | |
Vector_double & | GetSelectBaseW () |
Retrieves the stored baseline values of the selected sections (read and write). | |
const Section & | cursec () const |
Retrieves the currently accessed section in the active channel (read-only) | |
Section & | cursec () |
Retrieves the currently accessed section in the active channel (read and write) | |
const Section & | secsec () const |
Retrieves the currently accessed section in the second (reference) channel (read-only) | |
const Channel & | curch () const |
Retrieves the active channel (read-only) | |
Channel & | curch () |
Retrieves active channel (read and write) | |
const Channel & | secch () const |
Retrieves the second (reference) channel (read-only) | |
const Channel & | at (std::size_t n_c) const |
Range-checked access to a channel (read-only). | |
Channel & | at (std::size_t n_c) |
Range-checked access to a channel (read and write). | |
void | SetFileDescription (const std::string &value) |
Sets the file description. | |
void | SetGlobalSectionDescription (const std::string &value) |
Sets the common section description. | |
void | SetScaling (const std::string &value) |
Sets the scaling as a string. | |
int | SetTime (const std::string &value) |
Sets the time of recording as a string. | |
int | SetTime (int hour, int minute, int sec) |
int | SetDate (const std::string &value) |
Sets the date of recording as a string. | |
int | SetDate (int year, int month, int mday) |
void | SetDateTime (const struct tm &value) |
Sets the date and time of recording as struct tm. | |
void | SetDateTime (int year, int month, int mday, int hour, int minute, int sec) |
void | SetComment (const std::string &value) |
Sets a comment string. | |
void | SetGlobalYUnits (std::size_t n_channel, const std::string &value) |
Sets the y units for a channel. | |
void | SetXUnits (const std::string &value) |
Sets the x units. | |
void | SetXScale (double value) |
Sets the x scaling. | |
void | SetCurChIndex (std::size_t value) |
Sets the index of the current channel. | |
void | SetSecChIndex (std::size_t value) |
Sets the index of the second channel. | |
void | SetCurSecIndex (std::size_t value) |
Sets the index of the current section. | |
virtual void | resize (std::size_t c_n_channels) |
Resize the Recording to a new number of channels. | |
virtual void | InsertChannel (Channel &c_Channel, std::size_t pos) |
Insert a Channel at a given position. | |
void | CopyAttributes (const Recording &c_Recording) |
Copy descriptive attributes from another Recording to this Recording. | |
void | MakeAverage (Section &AverageReturn, Section &SigReturn, std::size_t channel, const std::vector< std::size_t > §ion_index, bool isSig, const std::vector< int > &shift) const |
Calculates an average of several traces. | |
void | AddRec (const Recording &toAdd) |
Add a Recording at the end of this Recording. | |
void | SelectTrace (std::size_t sectionToSelect, std::size_t base_start, std::size_t base_end) |
Selects a section. | |
bool | UnselectTrace (std::size_t sectionToUnselect) |
Unselects a section if it was selected before. | |
Channel & | operator[] (std::size_t at) |
Unchecked channel access (read and write) | |
const Channel & | operator[] (std::size_t at) const |
Unchecked channel access (read-only) |
Represents the data within a file.
Contains an array of channels that can be accessed either via at() (range-checked, will throw an exception if out of range) or the []-operator (range unchecked). Moreover all the metadata such as time, date, samling rate and comments are stored here.
Definition at line 39 of file recording.h.
Recording::Recording | ( | const Channel & | c_Channel | ) | [explicit] |
Recording::Recording | ( | const std::vector< Channel > & | ChannelList | ) | [explicit] |
Constructor.
ChannelList | A vector of channels from which to construct a new Recording. |
Recording::Recording | ( | std::size_t | c_n_channels, |
std::size_t | c_n_sections = 0 , |
||
std::size_t | c_n_points = 0 |
||
) | [explicit] |
Constructor.
Setting the number of channels and sections at construction time will avoid unnecessary memory re-allocations.
c_n_channels | The number of channels. |
c_n_sections | The number of sections. |
c_n_points | The number of sampling points per section. |
void Recording::AddRec | ( | const Recording & | toAdd | ) |
const Channel& Recording::at | ( | std::size_t | n_c | ) | const |
Range-checked access to a channel (read-only).
Will throw std::out_of_range if out of range.
n_c | The index of the channel. |
Channel& Recording::at | ( | std::size_t | n_c | ) |
Range-checked access to a channel (read and write).
Will throw std::out_of_range if out of range.
n_c | The index of the channel. |
void Recording::CopyAttributes | ( | const Recording & | c_Recording | ) |
const Channel& Recording::curch | ( | ) | const [inline] |
Retrieves the active channel (read-only)
Definition at line 194 of file recording.h.
Channel& Recording::curch | ( | ) | [inline] |
Retrieves active channel (read and write)
Definition at line 199 of file recording.h.
const Section& Recording::cursec | ( | ) | const [inline] |
Retrieves the currently accessed section in the active channel (read-only)
Definition at line 179 of file recording.h.
Section& Recording::cursec | ( | ) | [inline] |
Retrieves the currently accessed section in the active channel (read and write)
Definition at line 184 of file recording.h.
const std::vector<Channel>& Recording::get | ( | ) | const [inline] |
Retrieves the channels (read-only).
Definition at line 79 of file recording.h.
std::vector<Channel>& Recording::get | ( | ) | [inline] |
Retrieves the channels (read and write).
Definition at line 84 of file recording.h.
std::size_t Recording::GetChannelSize | ( | std::size_t | n_channel | ) | const |
Retrieves the number of sections in a channel.
n_channel | The index of the channel (range-checked). |
const std::string& Recording::GetComment | ( | ) | const [inline] |
Retrieves a comment string.
Definition at line 119 of file recording.h.
std::size_t Recording::GetCurChIndex | ( | ) | const [inline] |
Retrieves the index of the current channel.
Definition at line 144 of file recording.h.
std::size_t Recording::GetCurSecIndex | ( | ) | const [inline] |
Retrieves the index of the current section.
Definition at line 154 of file recording.h.
const std::string& Recording::GetDate | ( | ) |
Retrieves the date of recording as a string.
struct tm Recording::GetDateTime | ( | ) | const [inline, read] |
Retrieves the date of recording as a string.
Definition at line 114 of file recording.h.
const std::string& Recording::GetFileDescription | ( | ) | const [inline] |
Retrieves the file description.
Definition at line 89 of file recording.h.
const std::string& Recording::GetGlobalSectionDescription | ( | ) | const [inline] |
Retrieves the common section description.
Definition at line 94 of file recording.h.
const std::string& Recording::GetScaling | ( | ) | const [inline] |
Retrieves the scaling as a string.
Definition at line 99 of file recording.h.
std::size_t Recording::GetSecChIndex | ( | ) | const [inline] |
Retrieves the index of the second channel.
Definition at line 149 of file recording.h.
const Vector_double& Recording::GetSelectBase | ( | ) | const [inline] |
Retrieves the stored baseline values of the selected sections (read-only).
Definition at line 169 of file recording.h.
Vector_double& Recording::GetSelectBaseW | ( | ) | [inline] |
Retrieves the stored baseline values of the selected sections (read and write).
Definition at line 174 of file recording.h.
const std::vector<std::size_t>& Recording::GetSelectedSections | ( | ) | const [inline] |
Retrieves the indices of the selected sections (read-only).
Definition at line 159 of file recording.h.
std::vector<std::size_t>& Recording::GetSelectedSectionsW | ( | ) | [inline] |
Retrieves the indices of the selected sections (read and write).
Definition at line 164 of file recording.h.
double Recording::GetSR | ( | ) | const [inline] |
Retrieves the sampling rate ( 1 / x-scale )
Definition at line 139 of file recording.h.
const std::string& Recording::GetTime | ( | ) |
Retrieves the time of recording as a string.
double Recording::GetXScale | ( | ) | const [inline] |
Retrieves the x scaling (sampling interval).
Definition at line 134 of file recording.h.
const std::string& Recording::GetXUnits | ( | ) | const [inline] |
Retrieves the x units.
Definition at line 124 of file recording.h.
virtual void Recording::InsertChannel | ( | Channel & | c_Channel, |
std::size_t | pos | ||
) | [virtual] |
void Recording::MakeAverage | ( | Section & | AverageReturn, |
Section & | SigReturn, | ||
std::size_t | channel, | ||
const std::vector< std::size_t > & | section_index, | ||
bool | isSig, | ||
const std::vector< int > & | shift | ||
) | const |
Calculates an average of several traces.
AverageReturn | The average will be returned in this variable by passing a reference. AverageReturn has to have the correct size upon entering this function already, it won't be resized. |
SigReturn | The standard deviation will be returned in this variable by passing a reference if isSig == true. SigReturn has to have the correct size upon entering this function already, it won't be resized. |
channel | The index of the channel to be used. |
section_index | A vector containing the indices of the sections to be used for the average. |
isSig | Set to true if the standard deviation should be calculated as well. |
shift | A vector indicating by how many data points each section should be shifted before averaging. |
Channel& Recording::operator[] | ( | std::size_t | at | ) | [inline] |
Unchecked channel access (read and write)
Use at() for range-checked access.
at | The channel index. |
Definition at line 360 of file recording.h.
const Channel& Recording::operator[] | ( | std::size_t | at | ) | const [inline] |
Unchecked channel access (read-only)
Use at() for range-checked access.
at | The channel index. |
Definition at line 366 of file recording.h.
virtual void Recording::resize | ( | std::size_t | c_n_channels | ) | [virtual] |
const Channel& Recording::secch | ( | ) | const [inline] |
Retrieves the second (reference) channel (read-only)
Definition at line 204 of file recording.h.
const Section& Recording::secsec | ( | ) | const [inline] |
Retrieves the currently accessed section in the second (reference) channel (read-only)
Definition at line 189 of file recording.h.
void Recording::SelectTrace | ( | std::size_t | sectionToSelect, |
std::size_t | base_start, | ||
std::size_t | base_end | ||
) |
Selects a section.
sectionToSelect | The index of the section to be selected. |
base_start | Start index for baseline |
base_end | End index for baseline |
void Recording::SetComment | ( | const std::string & | value | ) | [inline] |
Sets a comment string.
value | A string containing a comment. |
Definition at line 262 of file recording.h.
void Recording::SetCurChIndex | ( | std::size_t | value | ) |
Sets the index of the current channel.
value | The index of the current channel. |
void Recording::SetCurSecIndex | ( | std::size_t | value | ) |
Sets the index of the current section.
value | The index of the current section. |
int Recording::SetDate | ( | const std::string & | value | ) |
Sets the date of recording as a string.
value | A string containing the date of recording. |
void Recording::SetDateTime | ( | const struct tm & | value | ) | [inline] |
Sets the date and time of recording as struct tm.
value | has type struct tm |
Definition at line 256 of file recording.h.
void Recording::SetFileDescription | ( | const std::string & | value | ) | [inline] |
Sets the file description.
value | The file description. |
Definition at line 225 of file recording.h.
void Recording::SetGlobalSectionDescription | ( | const std::string & | value | ) | [inline] |
Sets the common section description.
value | The common section description. |
Definition at line 230 of file recording.h.
void Recording::SetGlobalYUnits | ( | std::size_t | n_channel, |
const std::string & | value | ||
) |
Sets the y units for a channel.
n_channel | The channel index for which to set the units. |
value | A string containing the y units. |
void Recording::SetScaling | ( | const std::string & | value | ) | [inline] |
Sets the scaling as a string.
value | A string containing the description. |
Definition at line 237 of file recording.h.
void Recording::SetSecChIndex | ( | std::size_t | value | ) |
Sets the index of the second channel.
value | The index of the second channel. |
int Recording::SetTime | ( | const std::string & | value | ) |
Sets the time of recording as a string.
value | A string containing the time of recording. |
void Recording::SetXScale | ( | double | value | ) |
Sets the x scaling.
Note that setting the global x-scale will set it for all sections
value | The x scaling. |
void Recording::SetXUnits | ( | const std::string & | value | ) | [inline] |
Sets the x units.
value | A string containing the x units. |
Definition at line 273 of file recording.h.
std::size_t Recording::size | ( | ) | const [inline] |
Retrieves the size of the channel array.
Definition at line 129 of file recording.h.
bool Recording::UnselectTrace | ( | std::size_t | sectionToUnselect | ) |
Unselects a section if it was selected before.
sectionToUnselect | The index of the section to be unselected. |