nsol  0.4.1
Nsol - Neuroscience Objects Library
nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES > Class Template Reference
+ Collaboration diagram for nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >:

Public Member Functions

NeuronPtr readNeuron (const std::string &fileName, bool reposition_=false)
 Creates a new Neuron that contains the NeuronMorphology described in an ASC file Calls readMorphology( 2 ) More...
 
NeuronMorphologyPtr readMorphology (const std::string &fileName, bool reposition_=false)
 Creates a NeuronMorphology and loads info described in ASC file. More...
 

Protected Member Functions

void _ReadNeurite (NeuritePtr neuritePointer, NsolVector< NodePtr > *repositionNodes_, bool reposition_)
 Reads a Neurite from an ASC file. More...
 
void _ReadSoma (NeuronMorphologyPtr neuronMorphology, NsolVector< NodePtr > *repositionNodes_, bool reposition_)
 Reads soma points from an ASC file. More...
 
int _countBrackets (const std::string &line)
 Calculates the total amount of opening minus closing brackets. More...
 
void _eraseComent (std::string &line)
 Modifies a string by removing any comments there may be (after ';' character) More...
 
NodePtr _parseDataLine (const std::string &line)
 Creates a new NodePtr using the information contained in a data line. More...
 

Protected Attributes

unsigned int nodeId
 
std::ifstream inFile
 

Detailed Description

template<ASC_READER_TEMPLATE_CLASSES>
class nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >

Definition at line 67 of file AscReader.h.

Member Function Documentation

template<ASC_READER_TEMPLATE_CLASSES >
int nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_countBrackets ( const std::string &  line)
protected

Calculates the total amount of opening minus closing brackets.

Parameters
linestring to be analysed
Returns
total opening minus closing brackets count

Definition at line 520 of file AscReader.h.

Referenced by nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_ReadNeurite(), and nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_ReadSoma().

+ Here is the caller graph for this function:

template<ASC_READER_TEMPLATE_CLASSES >
void nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_eraseComent ( std::string &  line)
protected

Modifies a string by removing any comments there may be (after ';' character)

Parameters
linereference to string to be modified

Erases all characters from the first instance of ';' onwards

Definition at line 543 of file AscReader.h.

Referenced by nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_ReadNeurite(), nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_ReadSoma(), and nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::readMorphology().

+ Here is the caller graph for this function:

template<ASC_READER_TEMPLATE_CLASSES >
NodePtr nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_parseDataLine ( const std::string &  line)
protected

Creates a new NodePtr using the information contained in a data line.

Parameters
linestring to be analysed
Returns
pointer to Node containing all info in received string

Pareses data line into auxiliary variables

Removes opening bracket

Creates a new node with the info that was gathered

Definition at line 497 of file AscReader.h.

Referenced by nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_ReadNeurite(), and nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_ReadSoma().

+ Here is the caller graph for this function:

template<ASC_READER_TEMPLATE_CLASSES >
void nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_ReadNeurite ( NeuritePtr  neuritePointer,
NsolVector< NodePtr > *  repositionNodes_,
bool  reposition_ 
)
protected

Reads a Neurite from an ASC file.

Parameters
neuritePointerneuritePtr where info will be loaded
repositionNodes_auxiliary vector for recalculation purposes
reposition_sets soma center to ( 0.0, 0.0, 0.0 ) if true; it will only serve to add all new nodes to repositionNodes_ for later recalculation

Reads file, line by line, until end of current neurite is reached

Removes comment

Checks whether the line contains node info

Parses the line and creates a new node

Adds nodes for later recalculation of position if reposition_ is active

Adds first node to the first section of the neurite

Adds new node to the current section

Lines with character '|' mark the beginning of a new section at the same level in the hierarchy.

Creates a new section, updates the parent section stack, and increments branch count by one

Checks whether the line contains spine data (not implemented)

Updates parent section stack whenever hierarchy level is changed

Skips markers (not implemented)

If end of hierarchy level is reached, updates parent Section stack, branch and bifurcation counters, and creates the new section to be worked on

Definition at line 321 of file AscReader.h.

References nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_countBrackets(), nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_eraseComent(), nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_parseDataLine(), nsol::NeuronMorphologySection::addChild(), nsol::NeuronMorphologySection::addNode(), nsol::NeuronMorphologySection::firstNode(), nsol::Log::log(), nsol::NeuronMorphologySection::neurite(), and nsol::NeuronMorphologySection::parent().

Referenced by nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::readMorphology().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<ASC_READER_TEMPLATE_CLASSES >
void nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_ReadSoma ( NeuronMorphologyPtr  neuronMorphology,
NsolVector< NodePtr > *  repositionNodes_,
bool  reposition_ 
)
protected

Reads soma points from an ASC file.

Parameters
neuronMorphologyNeuronMorphologyPtr where soma nodes will be added
repositionNodes_auxiliary vector for recalculation purposes
reposition_sets soma center to ( 0.0, 0.0, 0.0 ) if true; it will only serve to add all new nodes to repositionNodes_ for later recalculation

Reads file, line by line, until end of current Soma contour is reached

Removes comment

Updates current hierarchy level

Detection of data lines

Parses line to a new node

Adds nodes for later recalculation of position if reposition_ is active

Adds the new node to the soma

Definition at line 455 of file AscReader.h.

References nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_countBrackets(), nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_eraseComent(), nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_parseDataLine(), nsol::Soma::addNode(), and nsol::NeuronMorphology::soma().

Referenced by nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::readMorphology().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<ASC_READER_TEMPLATE_CLASSES >
NeuronMorphologyPtr nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::readMorphology ( const std::string &  fileName,
bool  reposition_ = false 
)

Creates a NeuronMorphology and loads info described in ASC file.

Parameters
fileNamepath to ASC file to be read
reposition_sets soma center to ( 0.0, 0.0, 0.0 ) if true
Returns
pointer to the NeuronMorphology created; nullptr if failure on ASC read

Opening file check

Reads file, line by line

Removes commentaries

Puts line in lower letters to match the line types

Checks whether a new basal dendrite is being declared

Creates a pointer to a new basal dendrite and loads all corresponding info from the ASC file

Checks whether a new apical dendrite is being declared

Creates a pointer to a new apical dendrite and loads all corresponding info from the ASC file

Checks whether a new soma has been declared If multiple soma contours are present, their points will be loaded into a single soma

Checks whether a new axon has been declared

Creates a pointer to a new axon and loads all corresponding info from the ASC file

All other bracketed directives are ignored

Moves soma center to ( 0.0, 0.0, 0.0 ) if reposition_ is active, accordingly recalculating position for all nodes

Definition at line 212 of file AscReader.h.

References nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_eraseComent(), nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_ReadNeurite(), nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::_ReadSoma(), nsol::NeuronMorphology::addNeurite(), nsol::Soma::center(), nsol::Log::log(), and nsol::NeuronMorphology::soma().

Referenced by nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::readNeuron().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<ASC_READER_TEMPLATE_CLASSES >
NeuronPtr nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::readNeuron ( const std::string &  fileName,
bool  reposition_ = false 
)

Creates a new Neuron that contains the NeuronMorphology described in an ASC file Calls readMorphology( 2 )

Parameters
fileNamepath to ASC file to read
reposition_sets soma center to ( 0.0, 0.0, 0.0 ) if true
Returns
pointer to the Neuron created; nullptr if failure on ASC read

Definition at line 194 of file AscReader.h.

References nsol::AscReaderTemplated< ASC_READER_TEMPLATE_CLASSES >::readMorphology().

+ Here is the call graph for this function:


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