ITK  4.2.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
itk::CSVArray2DFileReader< TData > Class Template Reference

#include <itkCSVArray2DFileReader.h>

+ Inheritance diagram for itk::CSVArray2DFileReader< TData >:
+ Collaboration diagram for itk::CSVArray2DFileReader< TData >:

List of all members.

Public Types

typedef
Array2DDataObjectType::Pointer 
Array2DDataObjectPointer
typedef
itk::CSVArray2DDataObject
< TData > 
Array2DDataObjectType
typedef SmartPointer< const SelfConstPointer
typedef SmartPointer< SelfPointer
typedef CSVArray2DFileReader Self
typedef CSVFileReaderBase Superclass
typedef TData ValueType
- Public Types inherited from itk::CSVFileReaderBase
- Public Types inherited from itk::LightProcessObject
- Public Types inherited from itk::Object
- Public Types inherited from itk::LightObject

Public Member Functions

virtual ::itk::LightObject::Pointer CreateAnother (void) const
virtual Array2DDataObjectTypeGetArray2DDataObject ()
virtual const char * GetNameOfClass () const
virtual Array2DDataObjectPointer GetOutput ()
void Parse ()
virtual void Update ()
- Public Member Functions inherited from itk::CSVFileReaderBase
void GetDataDimension (SizeValueType &rows, SizeValueType &columns)
virtual char GetFieldDelimiterCharacter ()
virtual bool GetHasColumnHeaders () const
virtual bool GetHasRowHeaders () 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 ()
template<class TData >
TData ConvertStringToValueType (const std::string str)
- Public Member Functions inherited from itk::LightProcessObject
virtual void AbortGenerateDataOff ()
virtual void AbortGenerateDataOn ()
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
CommandGetCommand (unsigned long tag)
bool GetDebug () const
MetaDataDictionaryGetMetaDataDictionary (void)
const MetaDataDictionaryGetMetaDataDictionary (void) const
virtual unsigned long GetMTime () const
virtual const TimeStampGetTimeStamp () 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

Static Public Member Functions

static Pointer New ()

Protected Member Functions

 CSVArray2DFileReader ()
void PrintSelf (std::ostream &os, Indent indent) const
virtual ~CSVArray2DFileReader ()
 CSVFileReaderBase ()
virtual ~CSVFileReaderBase ()
void PrepareForParsing ()
- Protected Member Functions inherited from itk::LightProcessObject
 LightProcessObject ()
 ~LightProcessObject ()
virtual void GenerateData ()
- Protected Member Functions inherited from itk::Object
 Object ()
bool PrintObservers (std::ostream &os, Indent indent) const
virtual void SetTimeStamp (const TimeStamp &time)
virtual ~Object ()
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 LightObject ()
virtual void PrintHeader (std::ostream &os, Indent indent) const
virtual void PrintTrailer (std::ostream &os, Indent indent) const
virtual ~LightObject ()

Private Member Functions

 CSVArray2DFileReader (const Self &)
void operator= (const Self &)

Private Attributes

Array2DDataObjectPointer m_Array2DDataObject

Additional Inherited Members

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

Detailed Description

template<class TData>
class itk::CSVArray2DFileReader< TData >

Parses csv files and stores the data in a itkCSVArray2DDataObject.

CSVArray2DFileReader is used for reading csv files. This reader should only be used for parsing numeric data fields. The Parse() method in this class parses the data from the file into a itkCSVArray2DDataObject. As the Array2D object only holds one data type, all the data, other than the row and column headers, will be cast to a single data type. Row and column headers will be parsed into std vectors of strings.

The user would need to specify the file name using the SetFileName() method. The field delimiter character is set to ',' by default but other field delimiter characters may be set using SetFieldDelimiterCharacter(). If there are row and column headers in the file, the user must specify whether or not they exist using the HasRowHeaders and HasColumnHeaders flags. Also, if row and/or column headers are enclosed in "" or within other string delimiter characters 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 HasColumnHeaders flags will tell the reader that the first line contains column headers and turning on HasRowHeaders will tell the reader to recognize the first field in all subsequent lines as row headers. After all the inputs have been set, the user then calls the Parse() method. The user can then get the results by instantiating a itkCSVArray2DDataObject and assigning it using the GetOutput() method.

Below is an example of how this class can be used to read and parse the data from an input file:

typedef itk::CSVArray2DFileReader<double> ReaderType; ReaderType::Pointer reader = ReaderType::New();

std::string filename = "NameOfFile.csv"; reader->SetFileName( filename ); reader->SetFieldDelimiterCharacter( ',' ); reader->SetStringDelimiterCharacter( '"' ); reader->HasColumnHeadersOn(); reader->HasRowHeadersOn(); reader->UseStringDelimiterCharacterOn();

reader->Parse();

Definition at line 78 of file itkCSVArray2DFileReader.h.


Member Typedef Documentation

Definition at line 95 of file itkCSVArray2DFileReader.h.

template<class TData >
typedef itk::CSVArray2DDataObject<TData> itk::CSVArray2DFileReader< TData >::Array2DDataObjectType

DataFrame Object types

Definition at line 91 of file itkCSVArray2DFileReader.h.

template<class TData >
typedef SmartPointer<const Self> itk::CSVArray2DFileReader< TData >::ConstPointer

Reimplemented from itk::LightProcessObject.

Definition at line 85 of file itkCSVArray2DFileReader.h.

template<class TData >
typedef SmartPointer<Self> itk::CSVArray2DFileReader< TData >::Pointer

Reimplemented from itk::LightProcessObject.

Definition at line 84 of file itkCSVArray2DFileReader.h.

template<class TData >
typedef CSVArray2DFileReader itk::CSVArray2DFileReader< TData >::Self

Standard class typedefs

Reimplemented from itk::CSVFileReaderBase.

Definition at line 82 of file itkCSVArray2DFileReader.h.

template<class TData >
typedef CSVFileReaderBase itk::CSVArray2DFileReader< TData >::Superclass

Reimplemented from itk::CSVFileReaderBase.

Definition at line 83 of file itkCSVArray2DFileReader.h.

template<class TData >
typedef TData itk::CSVArray2DFileReader< TData >::ValueType

The value type of the dataset.

Definition at line 98 of file itkCSVArray2DFileReader.h.


Constructor & Destructor Documentation

template<class TData >
itk::CSVArray2DFileReader< TData >::CSVArray2DFileReader ( )
protected
template<class TData >
virtual itk::CSVArray2DFileReader< TData >::~CSVArray2DFileReader ( )
inlineprotectedvirtual

Definition at line 121 of file itkCSVArray2DFileReader.h.

template<class TData >
itk::CSVArray2DFileReader< TData >::CSVArray2DFileReader ( const Self )
private

Member Function Documentation

template<class TData >
virtual::itk::LightObject::Pointer itk::CSVArray2DFileReader< TData >::CreateAnother ( void  ) const
virtual

Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.

Reimplemented from itk::LightProcessObject.

template<class TData >
virtual Array2DDataObjectType* itk::CSVArray2DFileReader< TData >::GetArray2DDataObject ( )
virtual

This method can be used to get the data frame object once the data from the file has been parsed.

template<class TData >
virtual const char* itk::CSVArray2DFileReader< TData >::GetNameOfClass ( ) const
virtual

Run-time type information (and related methods)

Reimplemented from itk::CSVFileReaderBase.

template<class TData >
virtual Array2DDataObjectPointer itk::CSVArray2DFileReader< TData >::GetOutput ( )
virtual

Aliased to the GetDataFrameObject() method to be consistent with the rest of the pipeline

template<class TData >
static Pointer itk::CSVArray2DFileReader< TData >::New ( )
static

Standard New method.

Reimplemented from itk::LightProcessObject.

template<class TData >
void itk::CSVArray2DFileReader< TData >::operator= ( const Self )
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.

Reimplemented from itk::CSVFileReaderBase.

template<class TData >
void itk::CSVArray2DFileReader< TData >::Parse ( )
virtual

Parses the data from the file. Gets all the fields and parses row and column headers, if any, into std::vectors of strings and parses the numeric data into an Array2D object. The vectors and the Array2D object are part of the Array2DDataFrameobject.

Implements itk::CSVFileReaderBase.

template<class TData >
void itk::CSVArray2DFileReader< TData >::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
protectedvirtual

Print the reader.

Reimplemented from itk::CSVFileReaderBase.

template<class TData >
virtual void itk::CSVArray2DFileReader< TData >::Update ( )
virtual

Aliased to the Parse() method to be consistent with the rest of the pipeline.


Member Data Documentation

template<class TData >
Array2DDataObjectPointer itk::CSVArray2DFileReader< TData >::m_Array2DDataObject
private

Definition at line 128 of file itkCSVArray2DFileReader.h.


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