ITK
4.4.0
Insight Segmentation and Registration Toolkit
|
#include <itkCSVFileReaderBase.h>
A base class that contains common methods used for parsing csv files.
CSVFileReaderBase is a base abstract class for reading csv files. It contains the methods GetDataDimension() which is used to count the number of rows and columns in the file data set. Only after this method is called should calls to the GetNextField() method be made. The method ConvertStringToValueType() can be used to convert a string obtained from GetNextField() to some desired numeric type. The Parse() method is what is used to do the full processing, that is, reading the file and parsing the data into some object. It is pure virtual as a different parsing method would be needed for parsing into different types of objects.
The user would need to specify if there are row and column headers in the file using the HasRowHeaders and HasColumnHeaders flags. Also, if row and/or column headers are enclosed in "" or any other string delimiter character being used, the user can set the option of turning the string delimiter character on with the UseStringDelimiterCharacter flag. This is also especially useful if headers such as "This,Header" contain commas or other field delimiter characters within them.
If the csv file has row and column headers, they do not necessarily need to be enclosed in "" or other string delimiter characters as long as you specify that row and/or column headers exist in the file. Turning on the HasRowHeaders or HasColumnHeaders flags will tell the reader to recognize them as headers.
The PrepareForParsing() method does not need to be called explicitly as it is called in the GetDataDimension() method.
Definition at line 63 of file itkCSVFileReaderBase.h.
Public Types | |
typedef CSVFileReaderBase | Self |
typedef LightProcessObject | Superclass |
Public Types inherited from itk::LightProcessObject | |
typedef SmartPointer< const Self > | ConstPointer |
typedef SmartPointer< Self > | Pointer |
typedef LightProcessObject | Self |
typedef Object | Superclass |
Public Types inherited from itk::Object | |
typedef SmartPointer< const Self > | ConstPointer |
typedef SmartPointer< Self > | Pointer |
typedef Object | Self |
typedef LightObject | Superclass |
Public Types inherited from itk::LightObject | |
typedef SmartPointer< const Self > | ConstPointer |
typedef SmartPointer< Self > | Pointer |
typedef LightObject | Self |
Public Member Functions | |
void | GetDataDimension (SizeValueType &rows, SizeValueType &columns) |
virtual char | GetFieldDelimiterCharacter () |
virtual bool | GetHasColumnHeaders () const |
virtual bool | GetHasRowHeaders () const |
virtual const char * | GetNameOfClass () const |
void | GetNextField (std::string &) |
virtual char | GetStringDelimiterCharacter () |
virtual bool | GetUseStringDelimiterCharacter () const |
virtual void | SetFieldDelimiterCharacter (char _arg) |
virtual void | SetFileName (const char *_arg) |
virtual void | SetHasColumnHeaders (bool _arg) |
virtual void | SetHasRowHeaders (bool _arg) |
virtual void | SetStringDelimiterCharacter (char _arg) |
virtual void | SetUseStringDelimiterCharacter (bool _arg) |
virtual void | HasRowHeadersOn () |
virtual void | HasRowHeadersOff () |
virtual void | HasColumnHeadersOn () |
virtual void | HasColumnHeadersOff () |
virtual void | UseStringDelimiterCharacterOn () |
virtual void | UseStringDelimiterCharacterOff () |
Public Member Functions inherited from itk::LightProcessObject | |
virtual void | AbortGenerateDataOff () |
virtual void | AbortGenerateDataOn () |
virtual ::itk::LightObject::Pointer | CreateAnother (void) const |
virtual const bool & | GetAbortGenerateData () |
virtual void | SetAbortGenerateData (bool _arg) |
virtual void | UpdateOutputData () |
void | UpdateProgress (float amount) |
virtual void | SetProgress (float _arg) |
virtual const float & | GetProgress () |
Public Member Functions inherited from itk::Object | |
unsigned long | AddObserver (const EventObject &event, Command *) |
unsigned long | AddObserver (const EventObject &event, Command *) const |
virtual void | DebugOff () const |
virtual void | DebugOn () const |
Command * | GetCommand (unsigned long tag) |
bool | GetDebug () const |
MetaDataDictionary & | GetMetaDataDictionary (void) |
const MetaDataDictionary & | GetMetaDataDictionary (void) const |
virtual ModifiedTimeType | GetMTime () const |
virtual const TimeStamp & | GetTimeStamp () const |
bool | HasObserver (const EventObject &event) const |
void | InvokeEvent (const EventObject &) |
void | InvokeEvent (const EventObject &) const |
virtual void | Modified () const |
virtual void | Register () const |
void | RemoveAllObservers () |
void | RemoveObserver (unsigned long tag) |
void | SetDebug (bool debugFlag) const |
void | SetMetaDataDictionary (const MetaDataDictionary &rhs) |
virtual void | SetReferenceCount (int) |
virtual void | UnRegister () const |
Public Member Functions inherited from itk::LightObject | |
virtual void | Delete () |
virtual int | GetReferenceCount () const |
itkCloneMacro (Self) | |
void | Print (std::ostream &os, Indent indent=0) const |
std::string | m_FileName |
char | m_FieldDelimiterCharacter |
char | m_StringDelimiterCharacter |
bool | m_UseStringDelimiterCharacter |
bool | m_HasRowHeaders |
bool | m_HasColumnHeaders |
std::ifstream | m_InputStream |
int | m_EndOfColumnHeadersLine |
std::string | m_Line |
template<class TData > | |
TData | ConvertStringToValueType (const std::string str) |
virtual void | Parse ()=0 |
CSVFileReaderBase () | |
virtual | ~CSVFileReaderBase () |
void | PrintSelf (std::ostream &os, Indent indent) const |
void | PrepareForParsing () |
CSVFileReaderBase (const Self &) | |
void | operator= (const Self &) |
Additional Inherited Members | |
Static Public Member Functions inherited from itk::LightProcessObject | |
static Pointer | New () |
Protected Types inherited from itk::LightObject | |
typedef int | InternalReferenceCountType |
Protected Member Functions inherited from itk::LightProcessObject | |
virtual void | GenerateData () |
LightProcessObject () | |
~LightProcessObject () | |
Protected Attributes inherited from itk::LightObject | |
InternalReferenceCountType | m_ReferenceCount |
SimpleFastMutexLock | m_ReferenceCountLock |
Standard class typedefs
Definition at line 67 of file itkCSVFileReaderBase.h.
Definition at line 68 of file itkCSVFileReaderBase.h.
|
protected |
Converting a string to other numeric value types. This is a template method in a non-templated class so it needs to be defined within the .h. The only way it would be possible to have the definition in the .cxx source file would be either to include the .cxx file or to use the export keyword, which will be removed from the c++ language.
|
inlineprotectedvirtual |
Converting a string to other numeric value types. This is a template method in a non-templated class so it needs to be defined within the .h. The only way it would be possible to have the definition in the .cxx source file would be either to include the .cxx file or to use the export keyword, which will be removed from the c++ language.
Definition at line 170 of file itkCSVFileReaderBase.h.
|
private |
Converting a string to other numeric value types. This is a template method in a non-templated class so it needs to be defined within the .h. The only way it would be possible to have the definition in the .cxx source file would be either to include the .cxx file or to use the export keyword, which will be removed from the c++ language.
|
inline |
Converting a string to other numeric value types. This is a template method in a non-templated class so it needs to be defined within the .h. The only way it would be possible to have the definition in the .cxx source file would be either to include the .cxx file or to use the export keyword, which will be removed from the c++ language.
Definition at line 135 of file itkCSVFileReaderBase.h.
void itk::CSVFileReaderBase::GetDataDimension | ( | SizeValueType & | rows, |
SizeValueType & | columns | ||
) |
Counts the number of rows and columns in a file and prepares the file for iterative reading using the GetNextField() method.
|
virtual |
Get the field delimiter character.
|
virtual |
Get the value of the HasColumnHeaders flag.
|
virtual |
Get the value of the HasRowHeaders flag.
|
virtual |
Run-time type information (and related methods)
Reimplemented from itk::LightProcessObject.
Reimplemented in itk::CSVArray2DFileReader< TData >.
void itk::CSVFileReaderBase::GetNextField | ( | std::string & | ) |
Gets the next entry in the file. Returns a string. This function must always only be called after GetDataDimension().
|
virtual |
Get the string delimiter character.
|
virtual |
Get the value of the UseStringDelimiterCharacter flag.
|
virtual |
Boolean macros for setting HasRowHeaders, HasColumnHeaders and UseStringDelimiterCharacter. They can conveniently be set by appending On() or Off() to each of the variable names.
|
virtual |
Boolean macros for setting HasRowHeaders, HasColumnHeaders and UseStringDelimiterCharacter. They can conveniently be set by appending On() or Off() to each of the variable names.
|
virtual |
Boolean macros for setting HasRowHeaders, HasColumnHeaders and UseStringDelimiterCharacter. They can conveniently be set by appending On() or Off() to each of the variable names.
|
virtual |
Boolean macros for setting HasRowHeaders, HasColumnHeaders and UseStringDelimiterCharacter. They can conveniently be set by appending On() or Off() to each of the variable names.
|
private |
Converting a string to other numeric value types. This is a template method in a non-templated class so it needs to be defined within the .h. The only way it would be possible to have the definition in the .cxx source file would be either to include the .cxx file or to use the export keyword, which will be removed from the c++ language.
|
pure virtual |
This method must be defined in derived classes to parse the entire file into some object. The GetNextField() method only gets one string at a time. This method would store those strings or convert them using ConvertStringToValueType() and store the numeric values into the object.
Implemented in itk::CSVArray2DFileReader< TData >.
|
protected |
Check that all essential components are present and plugged in.
|
protectedvirtual |
Print method
Reimplemented from itk::LightProcessObject.
|
virtual |
Set the field delimiter character. It is possible to set another character as a field delimiter character such as ';'. The default delimiter character is ','
|
virtual |
Set the name of the file to be read
|
virtual |
Set the HasColumnHeaders flag to indicate existence of column headers in the file.
|
virtual |
Set the HasRowHeaders flag to indicate existence of row headers in the file.
|
virtual |
Set the string delimiter character if it is in use.
|
virtual |
Set the UseStringDelimiterCharacter flag on if column or row headers in the file are enclosed in "" or other characters.
|
virtual |
Boolean macros for setting HasRowHeaders, HasColumnHeaders and UseStringDelimiterCharacter. They can conveniently be set by appending On() or Off() to each of the variable names.
|
virtual |
Boolean macros for setting HasRowHeaders, HasColumnHeaders and UseStringDelimiterCharacter. They can conveniently be set by appending On() or Off() to each of the variable names.
|
protected |
Converting a string to other numeric value types. This is a template method in a non-templated class so it needs to be defined within the .h. The only way it would be possible to have the definition in the .cxx source file would be either to include the .cxx file or to use the export keyword, which will be removed from the c++ language.
Definition at line 166 of file itkCSVFileReaderBase.h.
|
protected |
Converting a string to other numeric value types. This is a template method in a non-templated class so it needs to be defined within the .h. The only way it would be possible to have the definition in the .cxx source file would be either to include the .cxx file or to use the export keyword, which will be removed from the c++ language.
Definition at line 160 of file itkCSVFileReaderBase.h.
|
protected |
Converting a string to other numeric value types. This is a template method in a non-templated class so it needs to be defined within the .h. The only way it would be possible to have the definition in the .cxx source file would be either to include the .cxx file or to use the export keyword, which will be removed from the c++ language.
Definition at line 159 of file itkCSVFileReaderBase.h.
|
protected |
Converting a string to other numeric value types. This is a template method in a non-templated class so it needs to be defined within the .h. The only way it would be possible to have the definition in the .cxx source file would be either to include the .cxx file or to use the export keyword, which will be removed from the c++ language.
Definition at line 164 of file itkCSVFileReaderBase.h.
|
protected |
Converting a string to other numeric value types. This is a template method in a non-templated class so it needs to be defined within the .h. The only way it would be possible to have the definition in the .cxx source file would be either to include the .cxx file or to use the export keyword, which will be removed from the c++ language.
Definition at line 163 of file itkCSVFileReaderBase.h.
|
protected |
Converting a string to other numeric value types. This is a template method in a non-templated class so it needs to be defined within the .h. The only way it would be possible to have the definition in the .cxx source file would be either to include the .cxx file or to use the export keyword, which will be removed from the c++ language.
Definition at line 165 of file itkCSVFileReaderBase.h.
|
protected |
Converting a string to other numeric value types. This is a template method in a non-templated class so it needs to be defined within the .h. The only way it would be possible to have the definition in the .cxx source file would be either to include the .cxx file or to use the export keyword, which will be removed from the c++ language.
Definition at line 167 of file itkCSVFileReaderBase.h.
|
protected |
Converting a string to other numeric value types. This is a template method in a non-templated class so it needs to be defined within the .h. The only way it would be possible to have the definition in the .cxx source file would be either to include the .cxx file or to use the export keyword, which will be removed from the c++ language.
Definition at line 161 of file itkCSVFileReaderBase.h.
|
protected |
Converting a string to other numeric value types. This is a template method in a non-templated class so it needs to be defined within the .h. The only way it would be possible to have the definition in the .cxx source file would be either to include the .cxx file or to use the export keyword, which will be removed from the c++ language.
Definition at line 162 of file itkCSVFileReaderBase.h.