nsol  0.4.1
Nsol - Neuroscience Objects Library
nsol::ColumnStats Class Reference

This class allows to compute stats for sections. More...

#include <ColumnStats.h>

+ Inheritance diagram for nsol::ColumnStats:
+ Collaboration diagram for nsol::ColumnStats:

Public Types

enum  TColumnStat {
  DENDRITIC_VOLUME = 0, AXON_VOLUME, NEURITIC_VOLUME, SOMA_VOLUME,
  VOLUME, DENDRITIC_SURFACE, AXON_SURFACE, NEURITIC_SURFACE,
  SOMA_SURFACE, SURFACE, DENDRITIC_LENGTH, AXON_LENGTH,
  NEURITIC_LENGTH, DENDRITIC_BIFURCATIONS, AXON_BIFURCATIONS, NEURITIC_BIFURCATIONS,
  COLUMN_NUM_STATS
}
 

Public Member Functions

 ColumnStats (const unsigned short id=0)
 
float getStat (TColumnStat stat, TAggregation miniColAgg=TOTAL, TAggregation neuronAgg=TOTAL) const
 
virtual ColumnStatsstats (void)
 Returns object as ColumnStats. More...
 
- Public Member Functions inherited from nsol::Column
unsigned int numberOfNeurons (const bool all=true, const Neuron::TMorphologicalType neuronType=Neuron::PYRAMIDAL, const unsigned int layer=0) const
 Method to get the number of neurons in the column. More...
 
virtual ColumnPtr asColumn (void)
 
 Column (unsigned short id=0)
 Default constructor. More...
 
 Column (const Column &other)
 Copy constructor. More...
 
virtual ~Column (void)
 Default destructur.
 
unsigned short & id (void)
 Method to get-set the column id. More...
 
unsigned short id (void) const
 Method to get the column id. More...
 
void addMiniColumn (MiniColumnPtr miniColumn)
 Method to add a mini column. More...
 
bool removeMiniColumn (MiniColumnPtr miniColumn)
 Method to remove a mini column. More...
 
void clearMiniColumns (void)
 Method to clear mini columns.
 
MiniColumnsminiColumns (void)
 Method to get minicolumns. More...
 
MiniColumns miniColumns (void) const
 Method to get minicolumns as const. More...
 
unsigned int numberOfMiniColumns (void) const
 Method to get the number of minicolumns. More...
 
Columnoperator= (const Column &other)
 
bool operator== (Column &other) const
 
bool operator!= (Column &other) const
 
- Public Member Functions inherited from nsol::Object
virtual MiniColumnPtr asMiniColumn (void)
 
virtual NeuronPtr asNeuron (void)
 
virtual NeuronMorphologyPtr asNeuronMorphology (void)
 
virtual SectionPtr asSection (void)
 
virtual NodePtr asNode (void)
 
virtual ObjectWithPropertiesproperties (void)
 
virtual ObjectPtr create (void)
 

Additional Inherited Members

- Protected Attributes inherited from nsol::Column
unsigned short _id
 Identifier of the column.
 
MiniColumns _miniColumns
 Container of minicolumns.
 

Detailed Description

This class allows to compute stats for sections.

Using this class instead of Column when constructing the hierarchy allows to call the method stats from base Column class and get the corresponding volume, surface and length.

Example:

/*
* Copyright (c) 2014-2017 GMRV/URJC.
*
* This file is part of nsol <https://github.com/gmrvvis/nsol>
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License version 3.0 as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
/*
* Example to show how to use stats and cached stats
*/
#include <nsol/nsol.h>
void computeMiniColumnStats( nsol::MiniColumnPtr column );
void printMiniColumnStats( nsol::MiniColumnPtr column );
#ifndef NSOL_USE_BRION
int main ( int /* argc */, char ** /* argv */ )
{
std::cout << "Brion support not built-in" << std::endl;
return 0;
}
#else
#include <sys/time.h>
int main ( int argc, char ** argv )
{
std::cout << std::endl;
if ( argc < 3 )
{
std::cerr << "Error. Usage: " << argv[0]
<< " blue_config_input_file target" << std::endl;
return -1;
}
brion::BlueConfig blueConfig( argv[1] );
nsol::BrionReaderStats readerWithStats;
nsol::Columns columnsWithStats;
nsol::NeuronsMap neuronsWithStats;
readerWithStats.loadBlueConfigHierarchy( columnsWithStats, neuronsWithStats,
blueConfig, argv[2] );
nsol::MiniColumnPtr miniColumnWithStats =
columnsWithStats[0]->miniColumns( )[0];
nsol::BrionReaderCachedStats readerWithCachedStats;
nsol::Columns columnsWithCachedStats;
nsol::NeuronsMap neuronsWithCachedStats;
readerWithCachedStats.loadBlueConfigHierarchy( columnsWithCachedStats,
neuronsWithCachedStats,
blueConfig, argv[2] );
nsol::MiniColumnPtr miniColumnWithCachedStats =
columnsWithCachedStats[0]->miniColumns( )[0];
NSOL_CHECK_THROW( miniColumnWithStats->stats( ),
"no stats in minicolumn" );
NSOL_CHECK_THROW( miniColumnWithCachedStats->stats( ),
"no stats in minicolumn" );
std::cout << "Number of neurons: "
<< miniColumnWithStats->neurons().size() << std::endl;
std::cout << std::endl;
for ( unsigned int layer = 0 ; layer < 7; layer++ )
{
std::cout << layer << " pyr: " <<
miniColumnWithStats->numberOfNeurons( false,
layer )
<< " inter: " <<
miniColumnWithStats->numberOfNeurons( false,
layer )
<< std::endl;
}
return 0;
}
void computeMiniColumnStats( nsol::MiniColumnPtr miniColumn )
{
NSOL_DEBUG_CHECK( miniColumn , "miniColumn is null" );
NSOL_DEBUG_CHECK( miniColumn->stats( ) , "no stats" );
miniColumn->stats( )->getStat( nsol::MiniColumnStats::DENDRITIC_VOLUME );
miniColumn->stats( )->getStat( nsol::MiniColumnStats::AXON_VOLUME );
miniColumn->stats( )->getStat( nsol::MiniColumnStats::NEURITIC_VOLUME );
miniColumn->stats( )->getStat( nsol::MiniColumnStats::SOMA_VOLUME );
miniColumn->stats( )->getStat( nsol::MiniColumnStats::VOLUME );
// Surface
miniColumn->stats( )->getStat( nsol::MiniColumnStats::DENDRITIC_SURFACE );
miniColumn->stats( )->getStat( nsol::MiniColumnStats::AXON_SURFACE );
miniColumn->stats( )->getStat( nsol::MiniColumnStats::NEURITIC_SURFACE );
miniColumn->stats( )->getStat( nsol::MiniColumnStats::SOMA_SURFACE );
miniColumn->stats( )->getStat( nsol::MiniColumnStats::SURFACE );
// Length
miniColumn->stats( )->getStat( nsol::MiniColumnStats::DENDRITIC_LENGTH );
miniColumn->stats( )->getStat( nsol::MiniColumnStats::AXON_LENGTH );
miniColumn->stats( )->getStat( nsol::MiniColumnStats::NEURITIC_LENGTH
);
// Bifurcations
miniColumn->stats( )->getStat( nsol::MiniColumnStats::DENDRITIC_BIFURCATIONS );
miniColumn->stats( )->getStat( nsol::MiniColumnStats::AXON_BIFURCATIONS );
miniColumn->stats( )->getStat( nsol::MiniColumnStats::NEURITIC_BIFURCATIONS );
}
#define COMPUTE_AND_PRINT2( __MSG__, __METHOD__ ) \
std::cout << __MSG__ \
<< miniColumn->stats( )->__METHOD__( nsol::TAggregation::TOTAL ) \
<< std::endl; \
#define COMPUTE_AND_PRINT( __MSG__, _S_ ) \
std::cout << __MSG__ \
<< miniColumn->stats( )->getStat( _S_, nsol::TAggregation::TOTAL ) \
<< "\tmin: " \
<< miniColumn->stats( )->getStat( _S_, nsol::TAggregation::MIN ) \
<< "\tmax: " \
<< miniColumn->stats( )->getStat( _S_, nsol::TAggregation::MAX ) \
<< "\tmean: " \
<< miniColumn->stats( )->getStat( _S_, nsol::TAggregation::MEAN ) \
<< "\tvariance: " \
<< miniColumn->stats( )->getStat( _S_, nsol::TAggregation::VARIANCE ) \
<< "\tstd dev.: " \
<< miniColumn->stats( )->getStat( _S_, nsol::TAggregation::STD_DEV ) \
<< std::endl; \
void printMiniColumnStats( nsol::MiniColumnPtr miniColumn )
{
NSOL_DEBUG_CHECK( miniColumn , "miniColumn is null" );
NSOL_DEBUG_CHECK( miniColumn->stats( ) , "no stats" );
COMPUTE_AND_PRINT( "\tDendritic surface:\t",
nsol::MiniColumnStats::DENDRITIC_SURFACE );
COMPUTE_AND_PRINT( "\tAxon surface:\t\t",
nsol::MiniColumnStats::AXON_SURFACE );
COMPUTE_AND_PRINT( "\tNeuritic surface:\t",
nsol::MiniColumnStats::NEURITIC_SURFACE );
COMPUTE_AND_PRINT( "\tSoma surface:\t\t",
nsol::MiniColumnStats::SOMA_SURFACE );
COMPUTE_AND_PRINT( "\tMiniColumn surface:\t",
nsol::MiniColumnStats::SURFACE );
std::cout << std::endl;
COMPUTE_AND_PRINT( "\tDendritic volume:\t",
nsol::MiniColumnStats::DENDRITIC_SURFACE );
COMPUTE_AND_PRINT( "\tAxon volume:\t\t",
nsol::MiniColumnStats::AXON_VOLUME );
COMPUTE_AND_PRINT( "\tNeuritic volume:\t",
nsol::MiniColumnStats::NEURITIC_VOLUME );
COMPUTE_AND_PRINT( "\tSoma volume:\t\t",
nsol::MiniColumnStats::SOMA_VOLUME );
COMPUTE_AND_PRINT( "\tMiniColumn volume:\t",
nsol::MiniColumnStats::VOLUME );
std::cout << std::endl;
COMPUTE_AND_PRINT( "\tDendritic length:\t",
nsol::MiniColumnStats::DENDRITIC_LENGTH );
COMPUTE_AND_PRINT( "\tAxon length:\t\t",
nsol::MiniColumnStats::AXON_LENGTH );
COMPUTE_AND_PRINT( "\tNeuritic length:\t",
nsol::MiniColumnStats::NEURITIC_LENGTH );
std::cout << std::endl;
COMPUTE_AND_PRINT( "\tDendritic bifurcations:\t",
nsol::MiniColumnStats::DENDRITIC_BIFURCATIONS );
COMPUTE_AND_PRINT( "\tAxon bifurcations:\t",
nsol::MiniColumnStats::AXON_BIFURCATIONS );
COMPUTE_AND_PRINT( "\tNeuritic bifurcations:\t",
nsol::MiniColumnStats::NEURITIC_BIFURCATIONS );
std::cout << std::endl;
}
#endif // NSOL_USE_BRION

Definition at line 39 of file ColumnStats.h.

Member Function Documentation

virtual ColumnStats* nsol::ColumnStats::stats ( void  )
virtual

Returns object as ColumnStats.

Returns
pointer to ColumnStats object

Reimplemented from nsol::Column.


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