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

Classes

struct  TReadNeuriteStackElem
 Auxiliary elements to read branching neurite sections. More...
 
struct  TSwcLine
 Contains processed information of an SWC line element. More...
 

Public Member Functions

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

Protected Types

enum  TSwcNodeType { SWC_SOMA = 1, SWC_AXON = 2, SWC_BASAL = 3, SWC_APICAL = 4 }
 SWC element types.
 

Protected Member Functions

void _ReadNeurite (NeuritePtr neuritePointer, const std::map< unsigned int, TSwcLine > &lines, unsigned int initId, NsolVector< NodePtr > *nodes_=nullptr, bool reposition_=false)
 Reads a Neurite from a processed SWC file, calls _ReadSection. More...
 
void _ReadSection (NeuritePtr neuritePointer, NeuronMorphologySectionPtr sectionPointer, NodePtr nodePointer, std::stack< TReadNeuriteStackElem > *sectionFirstNodes, const std::map< unsigned int, TSwcLine > &lines, NsolVector< NodePtr > *nodes_, bool reposition_)
 Creates and calculates sections, as well as bifurcation and branch counts. More...
 

Detailed Description

template<SWC_READER_TEMPLATE_CLASSES>
class nsol::SwcReaderTemplated< SWC_READER_TEMPLATE_CLASSES >

Definition at line 68 of file SwcReader.h.

Member Function Documentation

template<SWC_READER_TEMPLATE_CLASSES >
void nsol::SwcReaderTemplated< SWC_READER_TEMPLATE_CLASSES >::_ReadNeurite ( NeuritePtr  neuritePointer,
const std::map< unsigned int, TSwcLine > &  lines,
unsigned int  initId,
NsolVector< NodePtr > *  nodes_ = nullptr,
bool  reposition_ = false 
)
protected

Reads a Neurite from a processed SWC file, calls _ReadSection.

Parameters
neuritePointerneuritePtr where info will be loaded
linesprocessed SWC file line information stored as map
initIdnode ID of the first node in the neurite to read
nodes_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 nodes_ for later recalculation

Creates first Node in first Secion

Loads first Section in Neurite

Creates and loads all Sections in Neurite

Creates first Node of new Section

Loads Section and stores first Nodes of other Sections to load

Definition at line 418 of file SwcReader.h.

References nsol::SwcReaderTemplated< SWC_READER_TEMPLATE_CLASSES >::_ReadSection(), nsol::NeuronMorphologySection::addChild(), nsol::NeuronMorphologySection::addNode(), nsol::NeuronMorphologySection::firstNode(), nsol::NeuronMorphologySection::neurite(), and nsol::NeuronMorphologySection::parent().

Referenced by nsol::SwcReaderTemplated< SWC_READER_TEMPLATE_CLASSES >::readMorphology().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<SWC_READER_TEMPLATE_CLASSES >
void nsol::SwcReaderTemplated< SWC_READER_TEMPLATE_CLASSES >::_ReadSection ( NeuritePtr  neuritePointer,
NeuronMorphologySectionPtr  sectionPointer,
NodePtr  nodePointer,
std::stack< TReadNeuriteStackElem > *  sectionFirstNodes,
const std::map< unsigned int, TSwcLine > &  lines,
NsolVector< NodePtr > *  nodes_,
bool  reposition_ 
)
protected

Creates and calculates sections, as well as bifurcation and branch counts.

Parameters
neuritePointerpointer to Neurite where section is located
sectionPointerpointer to Section where data will be loaded
nodePointerpointer to first Node in section
sectionFirstNodespointer to stack where new first nodes for new sections found will be stored
linesprocessed SWC file line information stored as map
nodes_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 nodes_ for later recalculation

Stores first node for later position recalculation

Loads all nodes in section

Stores nodes for later position recalculation

End of section reached; first nodes of branching sections will be added to stack

Branch count updated

Plus new bifurcation

Adds first nodes of new branches to stack

Definition at line 467 of file SwcReader.h.

References nsol::NeuronMorphologySection::addNode(), and nsol::Node::id().

Referenced by nsol::SwcReaderTemplated< SWC_READER_TEMPLATE_CLASSES >::_ReadNeurite().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Creates a NeuronMorphology and loads info described in SWC file.

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

Opening file check

Reads file, line by line

Skips comment lines

Verifies there are 7 fields ( or more, if comments are present )

Loads info in struct TSwcLine

Adds children to TSwcLine elements created

Adds soma nodes to neuronMorphology->Soma

Adds nodes for later recalculation of position if reposition_ is active

Adds non-soma childrens of soma nodes to vector for later use

Initiates read process for each neurite, via first node

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

Definition at line 222 of file SwcReader.h.

References nsol::SwcReaderTemplated< SWC_READER_TEMPLATE_CLASSES >::_ReadNeurite(), nsol::NeuronMorphology::addNeurite(), nsol::Soma::addNode(), nsol::Soma::center(), nsol::Log::log(), and nsol::NeuronMorphology::soma().

Referenced by nsol::SwcReaderTemplated< SWC_READER_TEMPLATE_CLASSES >::readNeuron().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

Parameters
fileNamepath to SWC 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 SWC read

Definition at line 203 of file SwcReader.h.

References nsol::SwcReaderTemplated< SWC_READER_TEMPLATE_CLASSES >::readMorphology().

+ Here is the call graph for this function:


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