NPL
Neurological Programs and Libraries
utility.h File Reference
#include <string>
#include <cmath>
#include <list>
#include <vector>

Go to the source code of this file.

Classes

class  npl::MemMap
 Memory map class. The basic gyst is that this works like a malloc except that data may be initialized by file contents or left empty. This is useful for matrix manipulation where files need to be opened and closed a good bit. More...
 

Namespaces

 npl
 

Macros

#define __FUNCTION_STR__   std::string(__PRETTY_FUNCTION__)
 

Functions

std::string npl::dirname (std::string path)
 Returns the directory name for the given file. More...
 
bool npl::isTxt (std::string filename)
 Reads a file and returns true if its entirely made up of printable ascii. More...
 
bool npl::fileExists (std::string filename)
 Returns true if a file exists and is possible to open. More...
 
std::string npl::chomp (std::string str)
 Removes whitespace at the beginning and end of a string. More...
 
std::vector< std::string > npl::parseLine (std::string line, std::string delim)
 Given a delimiter splits the line based on the delmiter and removes extra white space as necessary. More...
 
std::vector< std::vector< std::string > > npl::readStrCSV (std::string filename, char &delim, char comment= '#')
 This function parses an input and returns a list of rows. More...
 
std::vector< std::vector< double > > npl::readNumericCSV (std::string filename, char comment= '#')
 This function parses an input and returns a list of rows. More...
 
double npl::gammaPDF (double x, double k, double theta)
 Gamma distribution, used by Cannonical HRF from SPM. More...
 
double npl::cannonHrf (double t, double rdelay, double udelay, double rdisp, double udisp, double puRatio, double onset, double total)
 Cannonical hemodynamic response funciton from SPM. delay of response (relative to onset) = 6 delay of undershoot (relative to onset) = 16 dispersion of response = 1 dispersion of undershoot = 1 ratio of response to undershoot = 6 onset (seconds) = 0 length of kernel (seconds) = 32. More...
 
double npl::cannonHrf (double t)
 The cannoical HRF with all default parameters. More...
 
std::vector< double > npl::getRegressor (std::vector< std::vector< double >> &spec, double tr, size_t ntimes, double t0)
 Takes a 1 or 3 column format of regressor and produces a timeseries sampeled every tr, starting at time t0, and running for ntimes. More...
 
void npl::boldsim (size_t len, double *iobuff, double dt, double learn)
 In place simulation of BOL timeseries using the balloon model. Habituation is accomplished by subtracting exponential moving average of u, thus if u tends to be on a lot, the effective u will be lower, if it turns on for the first time in a long time, the spike will be greater. Learn is the weight of the current point, the previous moving average value is weighted (1-learn) More...
 
void npl::convolve (std::vector< double > &signal, double(*foo)(double), double tr, double length)
 Convolves a signal and a function using loops (not fast) No wrapping is done. More...
 
double npl::fwhm_to_sd (double fwhm)
 Computes the standard deviation from FWHM (because I can never remember the ratio) More...
 
double npl::sd_to_fwhm (double sd)
 Computes the FWHM from from standard deviation (because I can never remember the ratio) More...
 

Macro Definition Documentation

#define __FUNCTION_STR__   std::string(__PRETTY_FUNCTION__)

Definition at line 20 of file utility.h.