NPL
Neurological Programs and Libraries
|
Classes | |
class | Armijo |
Implementation of Armijo approximate line search algorithm. More... | |
class | BFGSOpt |
class | BSplineView |
This is a specialized viewer for computing the value of a cubic B-Spline interpolation from the parameters. Thus the input to the constructor or setArray must be a parameter image. More... | |
union | Bytes |
struct | cdouble_t |
struct | cfloat_t |
class | ChunkConstIter |
Constant iterator for NDArray. This is slightly different from order iterator in that the ROI may be broken down into chunks. When the end of a chunk is reached, no more iteration can be performed until nextChunk() is called. isEnd() will return false until nextChunk() is called while the current chunk is at the last available. Note that if setBreaks uses an array that is smaller than input dimension, then the whole of the dimension will be used. More... | |
class | ChunkIter |
This class is used to iterate through an N-Dimensional array. More... | |
class | ChunkSlicer |
This class is used to step through an ND array in order of dimensions, but unlike Slicer it breaks the NDArray into chunks. Iteration stops at the end of each chunk until nextChunk is called. By default only one chunk is used, equal to the entire image. Use setBreaks() to set the frequency of chunks. The input to setBreaks() is an array of integers, where the next chunk occurs when distbreak == 0, with the special property that break=0 indicates no breaks for the dimension. So for a 3D image, setBreaks({1,0,0}) will stop every time a new x-values is reached. Note that the affects the order of iteration, so x cannot be the fastest iterator. setChunkSize() is an alias for setBreaks. Note that in cases where breaksize != 0, for example image size = 5 and break = 3, chunk sizes will differ during the course of iteration! More... | |
class | Classifier |
Base class for all ND classifiers. More... | |
struct | Counter |
Very basic counter that iterates over an ND region. More... | |
struct | cquad_t |
class | DistCorrInfoComp |
The distortion correction MI Computer is used to compute the mutual information and gradient of mutual information between two images using nonrigid, unidirectional, B-spline transform. More... | |
class | ExpMax |
Expectation Maximization With Gaussian Mixture Model. More... | |
class | FlatConstIter |
Flat iterator iterator for NDArray. No information is kept about the current index. Just goes through all data. This casts the output to the type specified using T. More... | |
class | FlatIter |
Flat iterator for NDArray. No information is kept about the current ND index. Just goes through all data. This casts the output to the type specified using T. More... | |
class | GradientOpt |
class | Graph |
class | KDTree |
class | KDTreeNode |
class | KernelIter |
Iterator for an image, that allows for easy access to the neighbors of the current element/pixel. Neighbors can be accessed through offset(i) which simply provides the value of the i'th neighbor. To get that neighbors index you can use it.offset_index(i). For the center use it.center()/it.center_index(). [] may also be used in place of offset. To get the number of neighbors in the kernel use ksize(), so it.offset(0), it.offset(1), ..., it.offset(ksize()-1) are valid calls. More... | |
class | KMeans |
K-means classifier. More... | |
class | KSlicer |
This class is used to slice an image in along a dimension, and to step an arbitrary direction in an image. Order may be any size from 0 to the number of dimensions. The first member of order will be the fastest moving, and the last will be the slowest. Any not dimensions not included in the order vector will be slower than the last member of order. More... | |
class | LanczosInterp3DView |
The purpose of this class is to view an image as a continuous 3D+vector dimension image rather than a 4+D image. Therefore all dimensions above the third are cast as a vector and interpolation is only performed between 3D points, with the 4th dimension assumed to be non-spatial. The would be applicable if the upper dimensions are of a different type than the first 3. More... | |
class | LanczosInterpNDView |
The purpose of this class is to view an image as a continuous 3D+vector dimension image rather than a 4+D image. Therefore all dimensions above the third are cast as a vector and interpolation is only performed between 3D points, with the 4th dimension assumed to be non-spatial. The would be applicable if the upper dimensions are of a different type than the first 3. More... | |
class | LBFGSOpt |
Limited-Memory Broyden–Fletcher–Goldfarb–Shanno Algorithm based on "A
Limited Memory Algorithm for Bound Constrained Optimization" Richard H. Byrd, Peihuang Lu, Jorge Nocedal, and Ciyou Zhu http://dx.doi.org/10.1137/0916069. More... | |
class | LinInterp3DView |
The purpose of this class is to view an image as a continuous 3D+vector dimension image rather than a 4+D image. Therefore all dimensions above the third are cast as a vector and interpolation is only performed between 3D points, with the 4th dimension assumed to be non-spatial. The would be applicable if the upper dimensions are of a different type than the first 3. More... | |
class | LinInterpNDView |
The purpose of this class is to view an image as a continuous ND image and to sample at a continuous ND-position within. More... | |
class | MatMap |
class | Matrix |
class | MatrixP |
class | MatrixReorg |
Reorganizes input images into tall and wide matrices (matrices that span the total rows and cols, respectively). More... | |
class | 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... | |
class | MRImage |
MRImage can basically be used like an NDArray, with the addition of orientation related additions. More... | |
class | MRImageStore |
MRImageStore is a version of NDArray that has an orientation matrix. Right now it also has additional data that is unique to nifti. Eventually this class will be forked into a subclass, and this will only have the orientation. More... | |
class | NDArray |
Pure virtual interface to interact with an ND array. More... | |
class | NDArrayStore |
Basic storage unity for ND array. Creates a big chunk of memory. More... | |
class | NDConstIter |
Constant iterator for NDArray. Typical usage calls for NDConstIter it(array); it++; *it. More... | |
class | NDConstView |
This is a basic accessor class, which allows for accessing array data in the type specified by the template. More... | |
class | NDIter |
This class is used to iterate through an N-Dimensional array. More... | |
class | NDView |
This is a basic accessor class, which allows for accessing array data in the type specified by the template. More... | |
class | NNInterp3DView |
The purpose of this class is to view an image as a continuous 3D+vector dimension image rather than a 4+D image. Therefore all dimensions above the third are cast as a vector and interpolation is only performed between 3D points, with the 4th dimension assumed to be non-spatial. The would be applicable if the upper dimensions are of a different type than the first 3. More... | |
class | NNInterpNDView |
General purpose Nearest-Neighbor interpolator. More... | |
class | Optimizer |
class | Pixel3DView |
The purpose of this class is to view an image as a 3D image rather than a ND image. Therefore all dimensions above the third will be ignored and index 0 will be used. More... | |
class | Plotter |
Class for creating basic plots of arrays or functions. An example might be: More... | |
class | ProbDistCorrInfoComp |
The distortion correction MI Computer is used to compute the mutual information and gradient of mutual information between two images using nonrigid, unidirectional, B-spline transform. In this variant the moving image should be a probability map. More... | |
struct | RegrResult |
struct | rgb_t |
struct | rgba_t |
struct | Rigid3DTrans |
Struct for holding information about a rigid transform. Note that rotation R = Rx*Ry*Rz, where Rx, Ry, and Rz are the rotations about x, y and z aaxes, and the angles are stored (in radians) in the rotation member. More... | |
class | RigidCorrComp |
The Rigid Corr Computer is used to compute the correlation and gradient of correlation between two images. As the name implies, it is designed for 6 parameter rigid transforms. More... | |
class | RigidInfoComp |
The Rigid MI Computer is used to compute the mutual information and gradient of mutual information between two images. As the name implies, it is designed for 6 parameter rigid transforms. More... | |
class | Slicer |
This class is used to step through an ND array in order of dimensions. Order may be any size from 0 to the number of dimensions. The first member of order will be the fastest moving, and the last will be the slowest. Any not dimensions not included in the order vector will be slower than the last member of order. More... | |
class | StudentsT |
Student's T-distribution. A cache of the Probability Density Function and cumulative density function is created using the analytical PDF. More... | |
class | Vector3DConstIter |
This class is used to iterate through an 3D array, where each point then has has multiple higher dimensional variable. This is analogous to Vector3DView, where even if there are multiple higher dimensions they are all alligned into a single vector at each 3D point. This makes them easier to than simple iteration in N-dimensions. This is the constant version. More... | |
class | Vector3DConstView |
The purpose of this class is to view an image as a 3D+vector dimension image rather than a 4+D image. Therefore all dimensions above the third are cast as a vector. If there is demand I may create a matrixx verion as well. More... | |
class | Vector3DIter |
This class is used to iterate through an 3D array, where each point then has has multiple higher dimensional variable. This is analogous to Vector3DView, where even if there are multiple higher dimensions they are all alligned into a single vector at each 3D point. This makes them easier to than simple iteration in N-dimensions. More... | |
class | Vector3DView |
The purpose of this class is to view an image as a 3D+vector dimension image rather than a 4+D image. Therefore all dimensions above the third are cast as a vector. If there is demand I may create a matrixx verion as well. More... | |
class | Wolfe |
Implementation of Armijo approximate line search algorithm. More... | |
Typedefs | |
typedef char | rgba[4] |
template<class T > | |
using | OrderIter = NDIter< T > |
To maintain backward compatability, I have saved the OrderIter and OrderConstIter name, but eventually they may be deprecated. More... | |
template<class T > | |
using | OrderConstIter = NDConstIter< T > |
To maintain backward compatability, I have saved the OrderIter and OrderConstIter name, but eventually they may be deprecated. More... | |
template<typename T > | |
using | ptr = std::shared_ptr< T > |
Make the shared_ptr name shorter... More... | |
typedef std::vector< std::vector< std::array< float, 3 > > > | TrackSet |
typedef function< int(const VectorXd &x, double &v, VectorXd &g)> | ValGradFunc |
Value and Gradient Computation Function. More... | |
typedef function< int(const VectorXd &x, VectorXd &g)> | GradFunc |
Gradient Only Computation Function. More... | |
typedef function< int(const VectorXd &x, double &v)> | ValFunc |
Value Only Computation Function. More... | |
typedef function< int(const VectorXd &x, double v, const VectorXd &g, size_t iter)> | CallBackFunc |
Callback function. More... | |
Functions | |
double | linKern (double x) |
template<typename T > | |
T | clamp (T inf, T sup, T v) |
Clamps value to range of [inf, sup]. Values outside will be pulled to either sup or inf, whichever is closer. More... | |
template<typename T > | |
T | wrap (T inf, T sup, T v) |
Wraps and index based on the range [inf, sup] (when v is outside that) range. Thus inf = 1, sup = 5, v = 0 will wrap around to 4, and v = 6 would wrap around to 1. More... | |
double | rectWindow (double x, double a) |
Rectangle function centered at 0, with radius a, range should be = 2a. More... | |
double | sincWindow (double x, double a) |
Sinc function centered at 0, with radius a, range should be = 2a. More... | |
double | freqGaussian (double x, double sd) |
Gaussian function in the frequency domain. Note that the standard deviation is in the time domain. More... | |
double | hammingWindow (double x, double a) |
double | welchWindow (double x, double a) |
double | hannWindow (double x, double a) |
double | lanczosKern (double x, double a) |
Derivative of lanczos kernel with respect to x. More... | |
double | dLanczosKern (double x, double a) |
Derivative of lanczos kernel with respect to x. More... | |
double | linKern (double x, double a) |
double | dLinKern (double x, double a) |
double | B3kern (double x) |
3rd order B-Spline, radius 2 [-2,2] More... | |
double | B3kern (double x, double r) |
3rd order B-Spline, variable radius (w) More... | |
double | dB3kern (double x) |
3rd order B-Spline derivative, radius 2 [-2,2] More... | |
double | dB3kern (double x, double r) |
3rd order B-Spline, variable radius (w) More... | |
double | ddB3kern (double x) |
3rd order B-Spline, 2nd derivative, radius 2 [-2,2] More... | |
double | ddB3kern (double x, double r) |
3rd order B-Spline, variable radius (w) More... | |
double | cot (double v) |
Cotangent function. More... | |
double | csc (double v) |
Cosecant function. More... | |
double | sec (double v) |
Secand function. More... | |
double | degToRad (double rad) |
double | radToDeg (double rad) |
int | hob (int num) |
Highest order bit. More... | |
int64_t | round2 (int64_t in) |
Round up to the nearest power of 2. More... | |
std::list< int64_t > | factor (int64_t f) |
Provides a list of the prime-fractors of the input number. More... | |
int64_t | round357 (int64_t in) |
Rounds a number up to the nearest number that can be broken down into 3,5,7. More... | |
template<typename T > | |
void | writePlot (std::string filename, const std::vector< T > &data) |
Writes a plot to the given filename. This is a convience wrapper around Plotter, which for quick-and-dirty use might be too much setup. More... | |
template<typename T > | |
void | writePlot (std::string filename, const std::vector< T > &data, size_t xsize, size_t ysize) |
Writes a plot to the given filename. This is a convience wrapper around Plotter, which for quick-and-dirty use might be too much setup. More... | |
template<typename T > | |
union npl::Bytes | __attribute__ ((packed)) |
bool | little_endian () |
bool | big_endian () |
template<typename T > | |
void | swap (T *val) |
template<> | |
void | swap< signed char > (signed char *val) |
template<> | |
void | swap< char > (char *val) |
template<> | |
void | swap< uint8_t > (uint8_t *val) |
template<> | |
void | swap< cquad_t > (cquad_t *val) |
template<> | |
void | swap< cdouble_t > (cdouble_t *val) |
template<> | |
void | swap< cfloat_t > (cfloat_t *val) |
template<> | |
void | swap< rgba_t > (rgba_t *val) |
template<> | |
void | swap< rgb_t > (rgb_t *val) |
void | createChirp (int64_t sz, fftw_complex *chirp, int64_t origsz, double upratio, double alpha, bool center, bool fft) |
Fills the input array (chirp) with a chirp of the specified type. More... | |
void | chirpzFFT (size_t isize, size_t usize, fftw_complex *inout, size_t uppadsize, fftw_complex *buffer, fftw_complex *prechirp, fftw_complex *convchirp, fftw_complex *postchirp, bool debug=false) |
Comptues the chirpzFFT transform using FFTW for n log n performance. More... | |
void | chirpzFFT (size_t isize, size_t usize, fftw_complex *inout, fftw_complex *buffer, bool debug=false) |
Comptues the chirpzFFT transform using FFTW for n log n performance. More... | |
void | chirpzFFT (size_t isize, fftw_complex *in, fftw_complex *out, double a, bool debug=false) |
Comptues the chirpzFFT transform using FFTW for n log n performance. More... | |
void | chirpzFT_brute2 (size_t isize, fftw_complex *in, fftw_complex *out, double a, bool debug=false) |
Performs chirpz transform with a as fractional parameter by N^2 algorithm. More... | |
void | chirpzFT_brute (size_t len, fftw_complex *in, fftw_complex *out, double a) |
Performs chirpz transform with a as fractional parameter by N^2 algorithm. More... | |
void | chirpzFT_zoom (size_t isize, fftw_complex *in, fftw_complex *out, double a) |
Performs the chirpz-transform using linear intpolation and the FFT. For greater speed pre-allocate the buffer and use the other chirpzFT_zoom. More... | |
void | chirpzFT_zoom (size_t isize, fftw_complex *in, fftw_complex *out, fftw_complex *buffer, double a) |
Performs the chirpz-transform using linear intpolation and teh FFT. More... | |
void | writePlotAbsAng (std::string file, size_t insz, fftw_complex *in) |
Plots an array of complex points with the Real and Imaginary Parts. More... | |
void | writePlotReIm (std::string file, const std::vector< std::complex< double >> &in) |
Plots an array of complex points with the Real and Imaginary Parts. More... | |
void | writePlotReIm (std::string file, size_t insz, fftw_complex *in) |
Plots an array of complex points with the Real and Imaginary Parts. More... | |
void | zoom (size_t isize, fftw_complex *in, fftw_complex *out, double a) |
Performs a de-facto chirpz by interpolated zoom of a fourier-space line. More... | |
VectorXd | onDiskSVD (const MatrixReorg &A, int rank, size_t poweriters, double varthresh, double cvarthresh, MatrixXd *U=NULL, MatrixXd *V=NULL) |
Uses randomized subspace approximation to reduce the input matrix (made up of blocks stored on disk with a given prefix). This assumes that the matrix is a wide matrix (which is generally a good assumption in fMRI) and that it therefore is better to reduce the number of columns. More... | |
void | gicaCreateMatrices (size_t tcat, size_t scat, vector< std::string > masks, vector< std::string > inputs, std::string prefix, double maxmem, bool normts, bool verbose) |
Create on disk matrices based on an array of input images. The array will be concatinated in time tcat time and space scat time, with time as the faster dimension. More... | |
void | gicaReduceFull (std::string inpref, std::string outpref, double varthresh, double cvarthresh, size_t maxrank, bool verbose) |
Compute PCA for the given group, defined. More... | |
void | gicaReduceProb (std::string inpref, std::string outpref, double varthresh, double cvarthresh, size_t rank, size_t poweriters, bool verbose) |
Compute PCA for the given group, defined. More... | |
void | gicaTemporalICA (std::string reorgpref, std::string reducepref, std::string outpref, bool verbose) |
Perform ICA with each dimension as a separate timeseries. This is essentially unmixing in space and producing independent timeseries. More... | |
void | gicaSpatialICA (std::string reorgpref, std::string reducepref, std::string outpref, bool verbose) |
Perform ICA with each dimension as a separate timeseries. This is essentially unmixing in space and producing independent timeseries. More... | |
VectorXd | covSVD (const MatrixReorg &A, double varthresh, double cvarthresh, size_t maxrank, MatrixXd *U, MatrixXd *V) |
Computes the SVD from XXt using the JacobiSVD. More... | |
void | fmriGLM (ptr< const MRImage > fmri, const MatrixXd &X, ptr< MRImage > bimg, ptr< MRImage > Timg, ptr< MRImage > pimg) |
Performs general linear model analysis on a 4D image. More... | |
void | fmriBandPass (ptr< MRImage > inimg, double cuton, double cutoff) |
Takes the FFT of each line of the image, performs bandpass filtering on the line and then invert FFTs and writes back to the input image. More... | |
ptr< MRImage > | regressOut (ptr< const MRImage > inimg, const MatrixXd &X) |
Regresses out the given variables, creating time series which are uncorrelated with X. More... | |
MatrixXd | extractLabelAVG (ptr< const MRImage > fmri, ptr< const MRImage > labelmap) |
Creates a matrix of timeseries, then perfrorms principal components analysis on it to reduce the number of timeseries to outsz. Each unique non-zero label in the input image will be considered a group of measurements which will be reduced together. Thus if there are labels 0,1,2 there will be 2 columns in the output. More... | |
MatrixXd | extractLabelPCA (ptr< const MRImage > fmri, ptr< const MRImage > labelmap, size_t outsz) |
Creates a matrix of timeseries, then perfrorms principal components analysis on it to reduce the number of timeseries to outsz. Each unique non-zero label in the input image will be considered a group of measurements which will be reduced together. Thus if there are labels 0,1,2 there will be 2*outsz columns in the output. More... | |
MatrixXd | extractLabelICA (ptr< const MRImage > fmri, ptr< const MRImage > labelmap, size_t outsz) |
Creates a matrix of timeseries, then perfrorms principal components analysis on it to reduce the number of timeseries to outsz. Each unique non-zero label in the input image will be considered a group of measurements which will be reduced together. Thus if there are labels 0,1,2 there will be 2*outsz columns in the output. More... | |
void | interp (int64_t isize, fftw_complex *in, int64_t osize, fftw_complex *out) |
Interpolate the input array, filling the output array. More... | |
void | createChirp (int64_t sz, fftw_complex *chirp, int64_t origsz, double upratio, double alpha, double beta, bool fft) |
Fills the input array (chirp) with a chirp of the specified type. More... | |
void | fractional_ft (size_t isize, fftw_complex *in, fftw_complex *out, double a, size_t bsz=0, fftw_complex *buffer=NULL, bool nonfft=false) |
Comptues the Fractional Fourier transform using FFTW for nlogn performance. More... | |
template<typename T > | |
GraphDataT | getType () |
std::string | describeType (GraphDataT type) |
template<int D1, int D2> | |
std::ostream & | operator<< (std::ostream &os, const Matrix< D1, D2 > &b) |
std::ostream & | operator<< (std::ostream &os, const MatrixP &b) |
template<int D1, int D2> | |
Matrix< D1, D2 > | operator+= (Matrix< D1, D2 > &lhs, const Matrix< D1, D2 > &rhs) |
template<int D1, int D2> | |
Matrix< D1, D2 > | operator+ (const Matrix< D1, D2 > &lhs, const Matrix< D1, D2 > &rhs) |
template<int D1, int D2> | |
Matrix< D1, D2 > | operator- (const Matrix< D1, D2 > &lhs, const Matrix< D1, D2 > &rhs) |
template<int D1, int D2> | |
Matrix< D1, D2 > | operator- (const Matrix< D1, D2 > &rhs) |
template<int D1, int D2, int D3> | |
Matrix< D1, D3 > | operator* (const Matrix< D1, D2 > &lhs, const Matrix< D2, D3 > &rhs) |
template<int D1, int D2> | |
Matrix< D1+D2, D1+D2 > | join (const Matrix< D1, D1 > &tl, const Matrix< D1, D2 > &tr, const Matrix< D2, D1 > &bl, const Matrix< D2, D2 > &br) |
Join together 4 matrices from a blockwise decomposition. More... | |
template<int D1, int D2> | |
void | split (const Matrix< D1+D2, D1+D2 > &input, Matrix< D1, D1 > &tl, Matrix< D1, D2 > &tr, Matrix< D2, D1 > &bl, Matrix< D2, D2 > &br) |
double | det (const Matrix< 1, 1 > &trg) |
double | det (const Matrix< 2, 2 > &trg) |
double | det (const Matrix< 3, 3 > &trg) |
template<int DIM> | |
double | det (const Matrix< DIM, DIM > &trg) |
template<int D1, int D2> | |
double | norm (const Matrix< D1, D2 > &trg) |
template<int DIM> | |
double | norm (const Matrix< DIM, 1 > &trg) |
template<int DIM> | |
double | norm (const Matrix< 1, DIM > &trg) |
Matrix< 1, 1 > | inverse (const Matrix< 1, 1 > &trg) |
Matrix< 2, 2 > | inverse (const Matrix< 2, 2 > &trg) |
template<int DIM> | |
Matrix< DIM, DIM > | inverse (const Matrix< DIM, DIM > &trg) |
ptr< MRImage > | createMRImage (size_t ndim, const size_t *size, PixelT type) |
Creates a new MRImage with dimensions set by ndim, and size set by size. Output pixel type is decided by type variable. More... | |
ptr< MRImage > | createMRImage (const std::vector< size_t > &dim, PixelT type) |
Creates a new MRImage with dimensions set by ndim, and size set by size. Output pixel type is decided by type variable. More... | |
ptr< MRImage > | createMRImage (size_t ndim, const size_t *size, PixelT type, void *ptr, std::function< void(void *)> deleter) |
Creates a new MRImage with dimensions set by ndim, and size set by size. Output pixel type is decided by type variable. More... | |
ptr< MRImage > | createMRImage (const std::vector< size_t > &dim, PixelT type, void *ptr, std::function< void(void *)> deleter) |
Creates a new MRImage with dimensions set by ndim, and size set by size. Output pixel type is decided by type variable. More... | |
std::ostream & | operator<< (std::ostream &out, const MRImage &img) |
Writes out information about an MRImage. More... | |
void | gaussianSmooth1D (ptr< MRImage > inout, size_t dim, double stddev) |
Gaussian smooths an image in 1 direction. Questionable whether it works. Seems to shift image. More... | |
ptr< MRImage > | smoothDownsample (ptr< const MRImage > in, double sigma, double spacing=-1) |
Performs smoothing in each dimension, then downsamples so that pixel spacing is roughly equal to FWHM. More... | |
ptr< MRImage > | resample (ptr< const MRImage > in, double *spacing, double(*window)(double, double)=hannWindow) |
Performs fourier resampling using fourier transform and the provided window function. More... | |
ptr< MRImage > | shiftImage (ptr< MRImage > in, size_t len, double *vect) |
Uses fourier shift theorem to shift an image. More... | |
void | writeComplex (std::string basename, ptr< const MRImage > in, bool absPhase=false) |
Writes a pair of images, one real, one imaginary or if absPhase is set to true then an absolute image and a phase image. More... | |
ptr< MRImage > | fft_forward (ptr< const MRImage > in, const std::vector< size_t > &in_osize) |
Performs forward FFT transform in N dimensions. More... | |
ptr< MRImage > | fft_backward (ptr< const MRImage > in, const std::vector< size_t > &in_osize) |
Performs inverse FFT transform in N dimensions. More... | |
int | rotateImageShearKern (ptr< MRImage > inout, double rx, double ry, double rz, double(*kern)(double, double)=npl::lanczosKern) |
Rotates an image around the center using shear decomposition followed by kernel-based shearing. Rotation order is Rz, Ry, Rx, and about the center of the image. This means that 1D interpolation will be used. More... | |
int | rotateImageShearFFT (ptr< MRImage > inout, double rx, double ry, double rz, double(*window)(double, double)=npl::sincWindow) |
Rotates an image around the center using shear decomposition followed by FFT-based shearing. Rotation order is Rz, Ry, Rx, and about the center of the image. More... | |
ptr< MRImage > | rigidTransform (ptr< MRImage > in, double rx, double ry, double rz, double sx, double sy, double sz) |
Rigid Transforms an image. More... | |
ptr< MRImage > | diffOfGauss (ptr< const MRImage > in, double sd1, double sd2) |
Computes difference of gaussians. More... | |
double | overlapRatio (ptr< const MRImage > a, ptr< const MRImage > b) |
Computes the overlap of the two images' in 3-space. More... | |
ptr< MRImage > | resampleNN (ptr< const MRImage > in, ptr< const MRImage > atlas, PixelT type=UNKNOWN_TYPE) |
Performs nearest neighbor resasmpling of input to atlas. More... | |
ptr< MRImage > | resampleNN (ptr< const MRImage > in, double *newspace, PixelT type=UNKNOWN_TYPE) |
Performs nearest neighbor resasmpling of input to atlas. More... | |
ptr< MRImage > | randImage (PixelT type, double mean, double sd, size_t x, size_t y, size_t z, size_t t) |
Create random image, with gaussian distribution. More... | |
ptr< NDArray > | createNDArray (size_t ndim, const size_t *size, PixelT ptype) |
Creates a new NDArray with dimensions set by ndim, and size set by size. Output pixel type is decided by ptype variable. More... | |
ptr< NDArray > | createNDArray (const std::vector< size_t > &dim, PixelT ptype) |
Creates a new NDArray with dimensions set by ndim, and size set by size. Output pixel type is decided by ptype variable. More... | |
ptr< NDArray > | createNDArray (size_t ndim, const size_t *size, PixelT ptype, void *ptr, std::function< void(void *)> deleter) |
Creates a new NDArray with dimensions set by ndim, and size set by size. Output pixel type is decided by ptype variable. More... | |
ptr< NDArray > | createNDArray (const std::vector< size_t > &dim, PixelT ptype, void *ptr, std::function< void(void *)> deleter) |
Creates a new NDArray with dimensions set by ndim, and size set by size. Output pixel type is decided by ptype variable. More... | |
void | copyROI (ptr< const NDArray > in, const int64_t *inROIL, const size_t *inROIZ, ptr< NDArray > out, const int64_t *oROIL, const size_t *oROIZ, PixelT newtype) |
Copy an roi from one image to another image. ROI's must be the same size. More... | |
std::ostream & | operator<< (std::ostream &out, const NDArray &img) |
Writes out information about an MRImage. More... | |
std::string | pixelTtoString (PixelT type) |
Returns a string that is a descrption of the pixel type. More... | |
PixelT | stringToPixelT (std::string type) |
Returns a pixeltype as described by the string. More... | |
std::unordered_set< int64_t > | getLabels (ptr< const NDArray > in) |
Produces a std::unordered_set of labels within a labelmap. More... | |
bool | comparable (const NDArray *left, const NDArray *right, bool *elL=NULL, bool *elR=NULL) |
Returns whether two NDArrays have the same dimensions, and therefore can be element-by-element compared/operated on. elL is set to true if left is elevatable to right (ie all dimensions match or are missing or are unary). elR is the same but for the right. More... | |
ptr< NDArray > | derivative (ptr< const NDArray > in) |
Computes the derivative of the image. Computes all directional derivatives of the input image and the output image will have 1 higher dimension with derivative of 0 in the first volume 1 in the second and so on. More... | |
ptr< NDArray > | derivative (ptr< const NDArray > in, size_t dir) |
Computes the derivative of the image in the specified direction. More... | |
ptr< NDArray > | dilate (ptr< NDArray > in, size_t reps) |
Dilate an binary array repeatedly. More... | |
ptr< NDArray > | erode (ptr< NDArray > in, size_t reps) |
Erode an binary array repeatedly. More... | |
void | gaussianSmooth1D (ptr< NDArray > inout, size_t dim, double stddev) |
Smooths an image in 1 dimension. More... | |
void | shiftImageKern (ptr< NDArray > inout, size_t dd, double dist, double(*kern)(double, double)=npl::lanczosKern) |
Performs unidirectional shift in the direction of +dd, of distance (in units of pixels). Uses Lanczos interpolation. More... | |
void | shiftImageFFT (ptr< NDArray > inout, size_t dim, double dist, double(*window)(double, double)=npl::sincWindow) |
Performs unidirectional shift in the direction of +dd, of distance (in units of pixels), using FFT. More... | |
void | shearImageKern (ptr< NDArray > inout, size_t dim, size_t len, double *dist, double(*kern)(double, double)=npl::lanczosKern) |
Performs a shear on the image where the sheared dimension (dim) will be shifted depending on the index in other dimensions (dist). (in units of pixels). Uses Lanczos interpolation. More... | |
void | shearImageFFT (ptr< NDArray > inout, size_t dim, size_t len, double *dist, double(*window)(double, double)=npl::sincWindow) |
Performs a shear on the image where the sheared dimension (dim) will be shifted depending on the index in other dimensions (dist). (in units of pixels), using FFT. More... | |
int | shearDecompose (std::list< Eigen::Matrix3d > &bestshears, double Rx, double Ry, double Rz, double stepx=1, double stepy=1, double stepz=1) |
Decomposes a euler angle rotation using the rotation matrix made up of R = Rx*Ry*Rz. Note that this would be multiplying the input vector by Rz then Ry, then Rx. This does not support angles > PI/4. To do that, you should first do bulk rotation using 90 degree rotations (which requires not interpolation). More... | |
int | shearTest (double Rx, double Ry, double Rz, double sx=0, double sy=0, double sz=0) |
Tests shear results. If there is a solution (error is not NAN), then these should result small errors, so this checks that errors are small when possible. Note that the rotation matrix would be given by R = Rx*Ry*Rz. More... | |
ptr< NDArray > | linearRotate (double rx, double ry, double rz, ptr< const NDArray > in) |
Performs a rotation of the image first by rotating around z, then around y, then around x. (Rx*Ry*Rz) More... | |
void | rotateImageKern (ptr< NDArray > inout, double rx, double ry, double rz) |
Performs a rotation using 3D intperolation kernel (lanczos) More... | |
int | rotateImageShearKern (ptr< NDArray > inout, double rx, double ry, double rz, double(*kern)(double, double)=npl::lanczosKern) |
Performs a rotation using fourier shift and shears, using FFT for unidirectional shifts, using FFT. Rotation matrix R = Rx*Ry*Rz. More... | |
int | rotateImageShearFFT (ptr< NDArray > inout, double rx, double ry, double rz, double(*window)(double, double)=npl::sincWindow) |
Performs a rotation using fourier shift and shears, using FFT for unidirectional shifts, using FFT. Rotation matrix R = Rx*Ry*Rz. More... | |
ptr< NDArray > | pseudoPolar (ptr< const NDArray > in, size_t prdim) |
Computes the pseudopolar-gridded fourier transform on the input image, with prdim as the pseudo-radius direction. To sample the whole space you would need to call this once for each of the dimensions, or use the other function which does not take this argument, and returns a vector. More... | |
std::vector< ptr< NDArray > > | pseudoPolar (ptr< const NDArray > in) |
Computes the pseudopolar-gridded fourier transform on the input image returns a vector of pseudo-polar sampled image, one for each dimension as the pseudo-radius. More... | |
ptr< NDArray > | pseudoPolarZoom (ptr< const NDArray > inimg, size_t prdim) |
Computes the pseudopolar-gridded fourier transform on the input image, with prdim as the pseudo-radius direction. To sample the whole space you would need to call this once for each of the dimensions, or use the other function which does not take this argument, and returns a vector. This function skips the chirpz transform by interpolation-zooming. More... | |
void | fillCircle (ptr< NDArray > inout, double radius, double alpha) |
Sets the middle of the image += radius (in index space) to 1, everything else to 0. More... | |
void | fillLinear (ptr< NDArray > inout) |
Fills image with the linear index at each pixel. More... | |
void | fillZero (ptr< NDArray > inout) |
Fills image with the linear index at each pixel. More... | |
void | fillGaussian (ptr< NDArray > inout) |
Fills image with the linear index at each pixel. More... | |
ptr< NDArray > | concat (const vector< ptr< NDArray >> &images, size_t dir) |
Concatinates image in the direction specified by dir. So if dir is 0, and two images, sized [32, 32, 34] and [12, 32, 34] were passed in the input vector, then the output would be [44, 32, 34]. More... | |
ptr< NDArray > | concatElevate (const vector< ptr< NDArray >> &images) |
Concatinates images/arrays. 1 Extra dimension will be added, all the lower dimensions of the images must match. An example with lastdim = false would be 3 [32,32,32] images, which would result in 1 [32,32,32,3] image with the orienation matching from the first image. More... | |
ptr< NDArray > | sobelEdge (ptr< const NDArray > img) |
Increases the number of dimensions by 1 then places the edges in each dimension at indexes matching the direction of edge detection. So an input 3D image will produce a 4D image with volume 0 the x edges, volume 1 the y edges and volume 2 the z edges. More... | |
ptr< NDArray > | collapseSum (ptr< const NDArray > img, size_t dim, bool doabs=false) |
Creates a new image with the specified dimension collapsed and the values in each output point set to the sum of the values in the collapsed dimension. More... | |
ptr< NDArray > | relabelConnected (ptr< NDArray > input) |
Performs relabeling based on connected component using the two pass algorithm. More... | |
double | otsuThresh (ptr< const NDArray > in) |
Computes a threshold based on OTSU. More... | |
void | binarizeIP (ptr< NDArray > in, double t) |
Binarize an image to 0 or 1 based on whether it is greater than or less than the given threshold (t). In-place version (IP) More... | |
ptr< NDArray > | binarize (ptr< const NDArray > in, double t) |
Binarize an image to 0 or 1 based on whether it is greater than or less than the given threshold (t) More... | |
ptr< NDArray > | threshold (ptr< const NDArray > in, double t) |
Thresholds the image, changing everything below t to 0. More... | |
void | thresholdIP (ptr< NDArray > in, double t) |
Thresholds the image, changing everything below t to 0. More... | |
ptr< NDArray > | histEqualize (ptr< const NDArray > in) |
Computes a histogram, then spaces out intensities so that each intensity has equal volume/area in the image. More... | |
double | mse (ptr< const NDArray > a, ptr< const NDArray > b, ptr< const NDArray > mask=NULL) |
Computes the mean-squared-error between two images. They should be identically gridded. More... | |
double | dice (ptr< const NDArray > a, ptr< const NDArray > b, ptr< const NDArray > mask) |
Computes the dice coefficent between two labelmap images. They should be identically gridded. More... | |
double | corr (ptr< const NDArray > a, ptr< const NDArray > b, ptr< const NDArray > mask=NULL) |
Computes the correlation between two images. They should be identically gridded. More... | |
double | information (ptr< const NDArray > a, ptr< const NDArray > b, int bins=100, int krad=4, Metric m=METRIC_MI, ptr< const NDArray > mask=NULL) |
Computes the information based difference/similarity between two images. They should be identically gridded. More... | |
ptr< NDArray > | medianFilter (ptr< const NDArray > img) |
median filter More... | |
void | standardizeIP (ptr< NDArray > img) |
Standardizes image distribution (makes it mean = 0, variance = 1). This computation is done in place (IP) More... | |
ptr< NDArray > | standardize (ptr< const NDArray > img) |
Standardizes image distribution (makes it mean = 0, variance = 1). This computation is done in place (IP) More... | |
ptr< NDArray > | varianceT (ptr< const NDArray > img) |
Takes the variance of the higher dimensions and returns a 3D image. More... | |
ptr< NDArray > | createRandLabels (ptr< const NDArray > example, size_t nlabels, double sd) |
Create a random label map with the same size/orientation as the example image, and with nlabels unique labels, plus 0. More... | |
void | normalizeTS (ptr< NDArray > inout) |
Normalize timeseries' so that their mean is 1 and standard deviation is 0. More... | |
int | writeMRImage (ptr< const MRImage > img, std::string fn, bool nifti2=false) |
Writes out an MRImage to the file fn. Bool indicates whether to use nifti2 (rather than nifti1) format. More... | |
int | writeNDArray (ptr< const NDArray > img, std::string fn, bool nifti2=false) |
Writes out an MRImage to the file fn. Bool indicates whether to use nifti2 (rather than nifti1) format. More... | |
ptr< NDArray > | readNDArray (std::string filename, bool verbose=false, bool nopixeldata=false) |
Reads an array. Can read nifti's but orientation won't be read. More... | |
ptr< MRImage > | readMRImage (std::string filename, bool verbose=false, bool nopixeldata=false) |
Reads an MRI image. Right now only nift images are supported. later on, it will try to load image using different reader functions until one suceeds. More... | |
template<typename T , typename F > | |
ptr< T > | dPtrCast (const ptr< F > &in) |
Shorter name for dynamic_pointer_cast. More... | |
std::ostream & | operator<< (std::ostream &stream, const rgb_t &v) |
std::ostream & | operator<< (std::ostream &stream, const rgba_t &v) |
rgb_t | operator+ (const rgb_t &lhs, const double &rhs) |
rgb_t | operator+ (const double &lhs, const rgb_t &rhs) |
rgb_t | operator- (const rgb_t &lhs, const double &rhs) |
rgb_t | operator- (const double &lhs, const rgb_t &rhs) |
rgb_t | operator* (const rgb_t &lhs, const double &rhs) |
rgb_t | operator* (const double &lhs, const rgb_t &rhs) |
rgb_t | operator/ (const rgb_t &lhs, const double &rhs) |
rgb_t | operator/ (const double &lhs, const rgb_t &rhs) |
rgba_t | operator+ (const rgba_t &lhs, const double &rhs) |
rgba_t | operator+ (const double &lhs, const rgba_t &rhs) |
rgba_t | operator- (const rgba_t &lhs, const double &rhs) |
rgba_t | operator- (const double &lhs, const rgba_t &rhs) |
rgba_t | operator* (const rgba_t &lhs, const double &rhs) |
rgba_t | operator* (const double &lhs, const rgba_t &rhs) |
rgba_t | operator/ (const rgba_t &lhs, const double &rhs) |
rgba_t | operator/ (const double &lhs, const rgba_t &rhs) |
ptr< MRImage > | motionCorrect (ptr< const MRImage > input, size_t ref) |
Performs motion correction on a set of volumes. Each 3D volume is extracted and linearly registered with the ref volume. More... | |
Rigid3DTrans | corReg3D (ptr< const MRImage > fixed, ptr< const MRImage > moving, const std::vector< double > &sigmas) |
Performs correlation based registration between two 3D volumes. note that the two volumes should have identical sampling and identical orientation. If that is not the case, an exception will be thrown. More... | |
Rigid3DTrans | informationReg3D (ptr< const MRImage > fixed, ptr< const MRImage > moving, const std::vector< double > &sigmas, size_t nbins=128, size_t binradius=4, std::string metric="MI", double stopx=0.001) |
Performs information-based registration between two 3D volumes. note that the two volumes should have identical sampling and identical orientation. If that is not the case, an exception will be thrown. More... | |
ptr< MRImage > | infoDistCor (ptr< const MRImage > fixed, ptr< const MRImage > moving, bool otsu, int dir, double bspace, double jac, double tps, const std::vector< double > &sigmas, size_t nbins=128, size_t binradius=4, string metric="MI", size_t hist=8, double stopx=1e-5, double beta=0.5) |
Information based registration between two 3D volumes. note that the two volumes should have identical sampling and identical orientation. More... | |
int | cor3DDerivTest (double step, double tol, ptr< const MRImage > in1, ptr< const MRImage > in2) |
This function checks the validity of the derivative functions used to optimize between-image corrlation. More... | |
int | information3DDerivTest (double step, double tol, ptr< const MRImage > in1, ptr< const MRImage > in2) |
This function checks the validity of the derivative functions used to optimize between-image corrlation. More... | |
int | distcorDerivTest (double step, double tol, shared_ptr< const MRImage > in1, shared_ptr< const MRImage > in2, double regj=0, double regt=0) |
This function checks the validity of the derivative functions used to optimize between-image corrlation. More... | |
std::ostream & | operator<< (std::ostream &stream, const Rigid3DTrans &rigid) |
Prints a rigid transform. More... | |
double | sample_var (const Ref< const VectorXd > vec) |
Computes the statistical variance of a column vector. More... | |
void | regressOutLS (VectorXd &signal, const MatrixXd &X, const MatrixXd &covInv) |
Removes the effects of X from signal (y). Note that this takes both X and the pseudoinverse of X because the bulk of the computation will be on the pseudoinverse. More... | |
template<typename T > | |
void | fillGaussian (Ref< T > m) |
double | gaussianPDF (double mean, double sd, double x) |
1D Gaussian distribution function More... | |
double | gaussianCDF (double mean, double sd, double x) |
1D Gaussian cumulative distribution function More... | |
double | gammaPDF_MS (double mean, double sd, double x) |
PDF for the gamma distribution, if mean is negative then it is assumed that x should be negated as well. Unlike gammaPDF, this takes the mean and standard deviation (_MS) More... | |
double | mutualInformation (size_t len, double *a, double *b, size_t mbin) |
Computes mutual information between signal a and signal b which are of length len. Marginal bins used is mbin. More... | |
double | correlation (size_t len, double *a, double *b) |
Computes correlation between signal a and signal b which are of length len. More... | |
double | sample_var (int count, double sum, double sumsqr) |
Takes a count, sum and sumsqr and returns the sample variance. This is slightly different than the variance definition and I can never remember the exact formulation. More... | |
double | sample_corr (int count, double sum1, double sum2, double sumsq1, double sumsq2, double s1s2) |
Computes the sample correlation. More... | |
void | regress (RegrResult *out, const Ref< const VectorXd > y, const Ref< const MatrixXd > X, const Ref< const VectorXd > covInv, const Ref< const MatrixXd > Xinv, const StudentsT &distrib) |
Computes the Ordinary Least Square predictors, beta for. More... | |
void | regress (RegrResult *out, const Ref< const VectorXd > y, const Ref< const MatrixXd > X) |
Computes the Ordinary Least Square predictors, beta for. More... | |
void | randomizePowerIterationSVD (const Ref< const MatrixXd > A, size_t subsize, size_t poweriters, MatrixXd &U, VectorXd &E, MatrixXd &V) |
void | randomizePowerIterationSVD (const Ref< const MatrixXd > A, double tol, size_t startrank, size_t maxrank, size_t poweriters, MatrixXd &U, VectorXd &E, MatrixXd &V) |
MatrixXd | pca (const Ref< const MatrixXd > X, double varth=1, int odim=-1) |
Computes the Principal Components of input matrix X. More... | |
MatrixXd | rpiPCA (const Ref< const MatrixXd > X, double varth, int odim) |
Computes the Principal Components of input matrix X using the randomized power iteration SVD algorithm. More... | |
MatrixXd | symICA (const Ref< const MatrixXd > Xin, MatrixXd *unmix=NULL) |
Computes the Independent Components of input matrix X using symmetric decorrlation. Note that you should run PCA on X before running ICA. More... | |
MatrixXd | asymICA (const Ref< const MatrixXd > Xin, MatrixXd *unmix=NULL) |
Computes the Independent Components of input matrix X using sequential component extraction. Note that you should run PCA on X before running ICA. More... | |
MatrixXd | pseudoInverse (const Ref< const MatrixXd > X) |
Computes the pseudoinverse of the input matrix. More... | |
VectorXd | shootingRegr (const Ref< const MatrixXd > X, const Ref< const VectorXd > y, double gamma) |
Performs LASSO regression using the 'shooting' algorithm of. More... | |
VectorXd | activeShootingRegr (const Ref< const MatrixXd > X, const Ref< const VectorXd > y, double gamma) |
Performs LASSO regression using the 'activeShooting' algorithm of. More... | |
MatrixXd | pcacov (const Ref< const MatrixXd > cov, double varth) |
Computes the Principal Components of input matrix X using the covariance matrix. More... | |
void | expMax1D (const Ref< const VectorXd > data, vector< std::function< double(double, double, double)>> pdfs, Ref< VectorXd > mean, Ref< VectorXd > sd, Ref< VectorXd > prior, std::string plotfile="") |
Computes the mean and standard deviation of multiple distributions based on 1D data. The probability distribution functions should be passed in through a vector of function objects (pdfs) taking mu/sd/x. More... | |
void | gaussGammaMixtureModel (const Ref< const VectorXd > data, Ref< VectorXd > mu, Ref< VectorXd > sd, Ref< VectorXd > prior, std::string plotfile) |
Computes the mean and standard deviation of multiple distributions based on 1D data. This is a special version in which a negative gamma, a gaussian and positive gamma. The means of the negative and positive gamma are relative to the center of the gaussian. More... | |
void | approxKMeans (const Ref< const MatrixXd > samples, size_t nclass, MatrixXd &means) |
Approximates k-means using the algorithm of: More... | |
int | fastSearchFindDP (const Eigen::MatrixXf &samples, double thresh, double outthresh, Eigen::VectorXi &classes, bool brute=false) |
Algorithm of unsupervised learning (clustering) based on density. More... | |
int | findDensityPeaks (const Eigen::MatrixXf &samples, double thresh, Eigen::VectorXf &rho, Eigen::VectorXf &delta, Eigen::VectorXi &parent) |
Computes Density and Peak computation for Fast Search and Find of Density Peaks algorithm. More... | |
int | findDensityPeaks_brute (const Eigen::MatrixXf &samples, double thresh, Eigen::VectorXf &rho, Eigen::VectorXf &delta, Eigen::VectorXi &parent) |
Computes Density and Peak computation for Fast Search and Find of Density Peaks algorithm. This is a slower, non-bin based version. More... | |
TrackSet | readTracks (std::string filename, std::string ref="") |
Reads tracks into a vector of tracks, where each track is a vector of float[3]. More... | |
TrackSet | readDFT (std::string tfile, std::string ref="") |
Reads a BrainSuite DFT file. Throws INVALID_ARGUMENT if the magic is wrong. More... | |
TrackSet | readTrk (std::string filename, std::string ref="") |
Reads a trackvis trk file. Throws INVALID_ARGUMENT if the magic is wrong. More... | |
std::string | dirname (std::string path) |
Returns the directory name for the given file. More... | |
bool | isTxt (std::string filename) |
Reads a file and returns true if its entirely made up of printable ascii. More... | |
bool | fileExists (std::string filename) |
Returns true if a file exists and is possible to open. More... | |
std::string | chomp (std::string str) |
Removes whitespace at the beginning and end of a string. More... | |
std::vector< std::string > | 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 > > | 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 > > | readNumericCSV (std::string filename, char comment= '#') |
This function parses an input and returns a list of rows. More... | |
double | gammaPDF (double x, double k, double theta) |
Gamma distribution, used by Cannonical HRF from SPM. More... | |
double | 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 | cannonHrf (double t) |
The cannoical HRF with all default parameters. More... | |
std::vector< double > | 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 | 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 | 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 | fwhm_to_sd (double fwhm) |
Computes the standard deviation from FWHM (because I can never remember the ratio) More... | |
double | sd_to_fwhm (double sd) |
Computes the FWHM from from standard deviation (because I can never remember the ratio) More... | |
int | testgrad (double &error, const VectorXd &x, double stepsize, double tol, const ValFunc &valfunc, const ValGradFunc &valgradfunc) |
Tests a gradient function using the value function. More... | |
int | testgrad (double &error, const VectorXd &x, double stepsize, double tol, const ValFunc &valfunc, const GradFunc &gradfunc) |
Tests a gradient function using the value function. More... | |
int | gRosenbrock_G (const VectorXd &x, VectorXd &gradient) |
Implements generized rosenbrock gradient. More... | |
int | gRosenbrock_V (const VectorXd &x, double &v) |
Implements generized rosenbrock value. More... | |
void | gRosenbrock_callCounts (size_t &vcalls, size_t &gcalls) |
Returns the number of times the Value and Gradient functions for the Generalized Rosenbrock Function were called. More... | |
int | noopCallback (const VectorXd &x, double value, const VectorXd &grad, size_t iter) |
Callback that does nothing. More... | |
Variables | |
class npl::MatMap | __attribute__ |
const size_t | MAXDIM = 10 |
Defines the maximum supported dimension by image, used for stack-allocations. More... | |
using npl::ptr = typedef std::shared_ptr<T> |
Make the shared_ptr name shorter...
T | Type we are pointing at |
Definition at line 42 of file npltypes.h.
typedef char npl::rgba[4] |
Definition at line 29 of file basic_plot.h.
typedef std::vector<std::vector<std::array<float,3> > > npl::TrackSet |
enum npl::CoordinateT |
enum npl::GraphDataT |
enum npl::GraphStoreT |
enum npl::Metric |
Information-based Metric to use.
Enumerator | |
---|---|
METRIC_MI | |
METRIC_VI | |
METRIC_NMI | |
METRIC_COR | |
METRIC_REDUNDANCY | |
METRIC_NMIMETRIC | |
METRIC_DUALTC |
Definition at line 33 of file npltypes.h.
enum npl::PixelT |
enum npl::SliceOrderT |
|
inline |
3rd order B-Spline, radius 2 [-2,2]
x | Distance from center |
Definition at line 251 of file basic_functions.h.
|
inline |
3rd order B-Spline, variable radius (w)
x | Distance from center |
r | Radius |
Definition at line 281 of file basic_functions.h.
|
inline |
Definition at line 40 of file byteswap.h.
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)
len | Length of input/output buffer |
iobuff | Input/Output Buffer of values (input stimulus, output signal) |
dt | Timestep for simulation |
learn | The weight of the current point, the previous moving average value is weighted (1-learn), setting learn to 1 removes all habituation This limits the effect of habituation. |
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.
t | Time of sampled value |
rdelay | Delay of onset (default 6) |
udelay | Delay of undershot (relative to onset, default 16) |
rdisp | Dispersion of response (default 1) |
udisp | Dispersion of undershoot (default 1) |
puRatio | Ratio of response to undershoot (default 6) |
onset | Onset time (default 0) |
total | Kernel time (default 32) |
double npl::cannonHrf | ( | double | t | ) |
The cannoical HRF with all default parameters.
t | Time from stimulus |
void npl::chirpzFFT | ( | size_t | isize, |
size_t | usize, | ||
fftw_complex * | inout, | ||
size_t | uppadsize, | ||
fftw_complex * | buffer, | ||
fftw_complex * | prechirp, | ||
fftw_complex * | convchirp, | ||
fftw_complex * | postchirp, | ||
bool | debug = false |
||
) |
Comptues the chirpzFFT transform using FFTW for n log n performance.
This version needs for chirps to already been calculated. This is useful if you are running a large number of inputs with the same alpha
isize | Size of input/output |
usize | Size that we should upsample input to |
inout | Input array, length sz |
uppadsize | Padded+upsampled array size |
buffer | Complex buffer used for upsampling, size = uppadsize |
prechirp | Pre-multiply chirp. |
convchirp | Chirp that we need to convolve with |
postchirp | Post-multiply chirp. |
debug | whether to write out diagnostic plots |
void npl::chirpzFFT | ( | size_t | isize, |
size_t | usize, | ||
fftw_complex * | inout, | ||
fftw_complex * | buffer, | ||
bool | debug = false |
||
) |
Comptues the chirpzFFT transform using FFTW for n log n performance.
This version needs for chirps to already been calculated. This is useful if you are running a large number of inputs with the same alpha
isize | Size of input/output |
usize | Size that we should upsample input to |
inout | Input array, length sz |
buffer | Complex buffer used for upsampling, size = uppadsize |
debug | whether to write out diagnostic plots |
void npl::chirpzFFT | ( | size_t | isize, |
fftw_complex * | in, | ||
fftw_complex * | out, | ||
double | a, | ||
bool | debug = false |
||
) |
Comptues the chirpzFFT transform using FFTW for n log n performance.
isize | Size of input/output |
in | Input array, may be the same as out, length sz |
out | Output array, may be the same as input, length sz |
a | Ratio of the output frequency spectrum to sample. |
debug | whether to write out diagnostic plots |
void npl::chirpzFT_brute | ( | size_t | len, |
fftw_complex * | in, | ||
fftw_complex * | out, | ||
double | a | ||
) |
Performs chirpz transform with a as fractional parameter by N^2 algorithm.
len | Length of input array |
in | Input Array (length = len) |
out | Output Array (length = len) |
a | Fraction/Alpha To raise exp() term to |
void npl::chirpzFT_brute2 | ( | size_t | isize, |
fftw_complex * | in, | ||
fftw_complex * | out, | ||
double | a, | ||
bool | debug = false |
||
) |
Performs chirpz transform with a as fractional parameter by N^2 algorithm.
isize | Length of input array |
in | Input Array (length = len) |
out | Output Array (length = len) |
a | Fraction/Alpha To raise exp() term to |
debug | Write out debugging information (including plots!) |
void npl::chirpzFT_zoom | ( | size_t | isize, |
fftw_complex * | in, | ||
fftw_complex * | out, | ||
double | a | ||
) |
Performs the chirpz-transform using linear intpolation and the FFT. For greater speed pre-allocate the buffer and use the other chirpzFT_zoom.
isize | Input size |
in | Input line |
out | Output line |
a | Zoom factor (alpha) |
void npl::chirpzFT_zoom | ( | size_t | isize, |
fftw_complex * | in, | ||
fftw_complex * | out, | ||
fftw_complex * | buffer, | ||
double | a | ||
) |
Performs the chirpz-transform using linear intpolation and teh FFT.
isize | Input size |
in | Input line |
out | Output line |
buffer | Buffer, should be size isize |
a | Zoom factor (alpha) |
std::string npl::chomp | ( | std::string | str | ) |
Removes whitespace at the beginning and end of a string.
str | string to chomp |
|
inline |
Clamps value to range of [inf, sup]. Values outside will be pulled to either sup or inf, whichever is closer.
T | Value of inf/sup/v/output |
inf | Lower bound (infinum) |
sup | Upper bound (supremum) |
v | Value to clamp |
Definition at line 41 of file basic_functions.h.
void npl::convolve | ( | std::vector< double > & | signal, |
double(*)(double) | foo, | ||
double | tr, | ||
double | length | ||
) |
Convolves a signal and a function using loops (not fast) No wrapping is done.
for ii in 0...N-1 for jj in 0...M-1 if jj-ii valid: s[ii] = s[ii]*kern[jj-ii]
signal | Input signal sampled every (tr) |
foo | Function to sample backwards |
tr | Sampling time of input signal |
length | Number of samples to draw from foo |
|
inline |
Cotangent function.
v | angle in radians |
Definition at line 372 of file basic_functions.h.
VectorXd npl::covSVD | ( | const MatrixReorg & | A, |
double | varthresh, | ||
double | cvarthresh, | ||
size_t | maxrank, | ||
MatrixXd * | U, | ||
MatrixXd * | V | ||
) |
Computes the SVD from XXt using the JacobiSVD.
A | MatrixReorg object that can be used to load images on disk |
varthresh | stop after the eigenvalues reach this ratio of the maximum |
cvarthresh | stop after the sum of eigenvalues reaches this ratio of total |
maxrank | use no more than the given rank when reducing |
U | Output U matrix, if null then ignored |
V | Output V matrix, if null then ignored |
void npl::createChirp | ( | int64_t | sz, |
fftw_complex * | chirp, | ||
int64_t | origsz, | ||
double | upratio, | ||
double | alpha, | ||
bool | center, | ||
bool | fft | ||
) |
Fills the input array (chirp) with a chirp of the specified type.
sz | Size of output array |
chirp | Output array |
origsz | Original size, decides maximum frequency reached |
upratio | Ratio of upsampling performed. This may be different than sz/origsz |
alpha | Positive term in exp |
center | Whether to center, or start at 0 |
fft | Whether to fft the output (put it in frequency domain) |
void npl::createChirp | ( | int64_t | sz, |
fftw_complex * | chirp, | ||
int64_t | origsz, | ||
double | upratio, | ||
double | alpha, | ||
double | beta, | ||
bool | fft | ||
) |
Fills the input array (chirp) with a chirp of the specified type.
sz | Size of output array |
chirp | Output array |
origsz | Original size, decides maximum frequency reached |
upratio | Ratio of upsampling performed. This may be different than sz/origsz |
alpha | Positive term in exp |
beta | Negative term in exp |
fft | Whether to fft the output (put it in frequency domain) |
|
inline |
Cosecant function.
v | angle in radians |
Definition at line 385 of file basic_functions.h.
|
inline |
3rd order B-Spline derivative, radius 2 [-2,2]
x | Distance from center |
Definition at line 294 of file basic_functions.h.
|
inline |
3rd order B-Spline, variable radius (w)
x | Distance from center |
r | Radius |
Definition at line 320 of file basic_functions.h.
|
inline |
3rd order B-Spline, 2nd derivative, radius 2 [-2,2]
x | Distance from center |
Definition at line 333 of file basic_functions.h.
|
inline |
3rd order B-Spline, variable radius (w)
x | Distance from center |
r | Radius |
Definition at line 359 of file basic_functions.h.
|
inline |
Definition at line 405 of file basic_functions.h.
std::string npl::describeType | ( | GraphDataT | type | ) |
double npl::det | ( | const Matrix< 1, 1 > & | trg | ) |
Definition at line 625 of file matrix_deprecated.h.
double npl::det | ( | const Matrix< 2, 2 > & | trg | ) |
Definition at line 630 of file matrix_deprecated.h.
double npl::det | ( | const Matrix< 3, 3 > & | trg | ) |
Definition at line 635 of file matrix_deprecated.h.
double npl::det | ( | const Matrix< DIM, DIM > & | trg | ) |
Definition at line 650 of file matrix_deprecated.h.
std::string npl::dirname | ( | std::string | path | ) |
Returns the directory name for the given file.
path | Input path |
|
inline |
Derivative of lanczos kernel with respect to x.
x | Distance from center (0) |
a | Radius |
Definition at line 208 of file basic_functions.h.
|
inline |
Definition at line 229 of file basic_functions.h.
Shorter name for dynamic_pointer_cast.
F | Cast from this type |
T | Cast to this type |
in | Input pointer (type F*) |
Definition at line 54 of file npltypes.h.
Creates a matrix of timeseries, then perfrorms principal components analysis on it to reduce the number of timeseries to outsz. Each unique non-zero label in the input image will be considered a group of measurements which will be reduced together. Thus if there are labels 0,1,2 there will be 2 columns in the output.
Note that labelmap and fmri should be in the same pixel space (except for dimension 3)
fmri | FMRI image with timeseres to extract |
labelmap | Labelmap used to identify relevent input timeseries |
MatrixXd npl::extractLabelICA | ( | ptr< const MRImage > | fmri, |
ptr< const MRImage > | labelmap, | ||
size_t | outsz | ||
) |
Creates a matrix of timeseries, then perfrorms principal components analysis on it to reduce the number of timeseries to outsz. Each unique non-zero label in the input image will be considered a group of measurements which will be reduced together. Thus if there are labels 0,1,2 there will be 2*outsz columns in the output.
Note that labelmap and fmri should be in the same pixel space (except for dimension 3)
fmri | FMRI image with timeseres to extract |
labelmap | Labelmap used to identify relevent input timeseries |
outsz | Number of output timeseres ti append to design |
MatrixXd npl::extractLabelPCA | ( | ptr< const MRImage > | fmri, |
ptr< const MRImage > | labelmap, | ||
size_t | outsz | ||
) |
Creates a matrix of timeseries, then perfrorms principal components analysis on it to reduce the number of timeseries to outsz. Each unique non-zero label in the input image will be considered a group of measurements which will be reduced together. Thus if there are labels 0,1,2 there will be 2*outsz columns in the output.
Note that labelmap and fmri should be in the same pixel space (except for dimension 3)
fmri | FMRI image with timeseres to extract |
labelmap | Labelmap used to identify relevent input timeseries |
outsz | Number of output timeseres ti append to design |
|
inline |
Provides a list of the prime-fractors of the input number.
f | input number |
Definition at line 463 of file basic_functions.h.
bool npl::fileExists | ( | std::string | filename | ) |
Returns true if a file exists and is possible to open.
filename | to read |
Takes the FFT of each line of the image, performs bandpass filtering on the line and then invert FFTs and writes back to the input image.
inimg | Input image |
cuton | Minimum frequency (may be 0) |
cutoff | Maximum frequency in band (may be INFINITY) |
void npl::fmriGLM | ( | ptr< const MRImage > | fmri, |
const MatrixXd & | X, | ||
ptr< MRImage > | bimg, | ||
ptr< MRImage > | Timg, | ||
ptr< MRImage > | pimg | ||
) |
Performs general linear model analysis on a 4D image.
fmri | Input 4D image. |
X | Regressors |
bimg | Output betas for each voxel (should have same |
Timg | Output t-score image |
pimg | Output p-valeu image |
void npl::fractional_ft | ( | size_t | isize, |
fftw_complex * | in, | ||
fftw_complex * | out, | ||
double | a, | ||
size_t | bsz = 0 , |
||
fftw_complex * | buffer = NULL , |
||
bool | nonfft = false |
||
) |
Comptues the Fractional Fourier transform using FFTW for nlogn performance.
The definition of the fractional fourier transform is:
where
isize | size of input/output |
in | Input array, may be the same as output, length sz |
out | Output array, may be the same as input, length sz |
bsz | Buffer size |
a | Fraction, 1 = fourier transform, 2 = reverse, 3 = inverse fourier transform, 4 = identity |
buffer | Buffer to do computations in, may be null, in which case new memory will be allocated and deallocated during processing. Note that if the provided buffer is not sufficient size a new buffer will be allocated and deallocated, and a warning will be produced |
nonfft | Whether to use brute force method (non-fft) |
|
inline |
Gaussian function in the frequency domain. Note that the standard deviation is in the time domain.
x | distance from center |
sd | standard deviation |
Definition at line 117 of file basic_functions.h.
|
inline |
double npl::gammaPDF | ( | double | x, |
double | k, | ||
double | theta | ||
) |
Gamma distribution, used by Cannonical HRF from SPM.
x | Position |
k | Shape parameter |
theta | Scale parameter |
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.
3 column format:
onset duration value
1 column format (value of 1 is assumed):
onsert
spec | |
tr | |
ntimes | |
t0 |
GraphDataT npl::getType | ( | ) |
void npl::gicaCreateMatrices | ( | size_t | tcat, |
size_t | scat, | ||
vector< std::string > | masks, | ||
vector< std::string > | inputs, | ||
std::string | prefix, | ||
double | maxmem, | ||
bool | normts, | ||
bool | verbose | ||
) |
Create on disk matrices based on an array of input images. The array will be concatinated in time tcat time and space scat time, with time as the faster dimension.
tcat | Number of images to concatinate in time (faster moving in inputs) |
scat | Number of images to concatinate in space (slower moving in inputs) |
masks | Array of all image masks, 1 per spatial concatination |
inputs | Input files, should be tcat*scat in size |
prefix | Prefix of output matrices. Will create prefix_tall_0, prefix_tall_1 ... |
maxmem | Maximum memory per individual tall file, this is used to limit the loaded memory at a time. There will be more file overhead for smaller memory (though not much) |
normts | Whether to normalize the timeseries, within each input image before writing to flat matrices |
verbose | Print more information during reorganization |
void npl::gicaReduceFull | ( | std::string | inpref, |
std::string | outpref, | ||
double | varthresh, | ||
double | cvarthresh, | ||
size_t | maxrank, | ||
bool | verbose | ||
) |
Compute PCA for the given group, defined.
The basic idea is to split the rows into digesteable chunks, then perform the SVD on each of them.
A = [A1 A2 A3 ... ] A = [UEV1 UEV2 .... ] A = [UE1 UE2 UE3 ...] diag([V1, V2, V3...])
UE1 should have far fewer columns than rows so that where A is RxC, with R < C, [UE1 ... ] should have be R x LN with LN < R
Say we are concatinating S subjects each with T timepoints, then A is STxC, assuming a rank of L then [UE1 ... ] will be ST x SL
Even if L = T / 2 then this is a 1/4 savings in the SVD computation
inpref | input prefix of reorganized data matrices |
outpref | output prefix for U,E,V matrices |
varthresh | threshold for singular values, everything smaller than this ratio of the leading singular value will be treated as zero |
cvarthresh | threshold for singular values, everything after this ratio of the total sum of singular values will be treated as zero |
maxrank | maximum rank to use in reduction |
verbose | whether to print debuging information |
void npl::gicaReduceProb | ( | std::string | inpref, |
std::string | outpref, | ||
double | varthresh, | ||
double | cvarthresh, | ||
size_t | rank, | ||
size_t | poweriters, | ||
bool | verbose | ||
) |
Compute PCA for the given group, defined.
The basic idea is to split the rows into digesteable chunks, then perform the SVD on each of them.
A = [A1 A2 A3 ... ] A = [UEV1 UEV2 .... ] A = [UE1 UE2 UE3 ...] diag([V1, V2, V3...])
UE1 should have far fewer columns than rows so that where A is RxC, with R < C, [UE1 ... ] should have be R x LN with LN < R
Say we are concatinating S subjects each with T timepoints, then A is STxC, assuming a rank of L then [UE1 ... ] will be ST x SL
Even if L = T / 2 then this is a 1/4 savings in the SVD computation
inpref | input prefix of reorganized data matrices |
outpref | output prefix for U,E,V matrices |
rank | number of rows to estimate full matrix |
poweriters | number of power iterations to perform do better distringuish between close singular values 2-3 are probably sufficient for most cases |
varthresh | threshold for singular values, everything smaller than this ratio of the leading singular value will be treated as zero |
cvarthresh | threshold for singular values, everything after this ratio of the total sum of singular values will be treated as zero |
verbose | whether to print debuging information |
void npl::gicaSpatialICA | ( | std::string | reorgpref, |
std::string | reducepref, | ||
std::string | outpref, | ||
bool | verbose | ||
) |
Perform ICA with each dimension as a separate timeseries. This is essentially unmixing in space and producing independent timeseries.
reorgpref | Prefix of tall input file *_tall_[0-9]* |
reducepref | Prefix input files *Umat, *Vmat *Evec files |
outpref | Output file prefix *_SpaceIC *TimeIC etc |
verbose | Whether to print more debugging information |
void npl::gicaTemporalICA | ( | std::string | reorgpref, |
std::string | reducepref, | ||
std::string | outpref, | ||
bool | verbose | ||
) |
Perform ICA with each dimension as a separate timeseries. This is essentially unmixing in space and producing independent timeseries.
reorgpref | Prefix of tall input file *_tall_[0-9]* |
reducepref | Prefix input files *Umat, *Vmat *Evec files |
outpref | Output file prefix *_SpaceIC *TimeIC etc |
verbose | Whether to print more debugging information |
|
inline |
Definition at line 132 of file basic_functions.h.
|
inline |
Definition at line 170 of file basic_functions.h.
|
inline |
Highest order bit.
num | Input, output will be this with the highest order bit set |
Definition at line 424 of file basic_functions.h.
void npl::interp | ( | int64_t | isize, |
fftw_complex * | in, | ||
int64_t | osize, | ||
fftw_complex * | out | ||
) |
Interpolate the input array, filling the output array.
isize | Size of in |
in | Values to interpolate |
osize | Size of out |
out | Output array, filled with interpolated values of in |
Definition at line 735 of file matrix_deprecated.h.
Definition at line 740 of file matrix_deprecated.h.
Definition at line 757 of file matrix_deprecated.h.
bool npl::isTxt | ( | std::string | filename | ) |
Reads a file and returns true if its entirely made up of printable ascii.
filename | name of file to read |
Matrix<D1+D2,D1+D2> npl::join | ( | const Matrix< D1, D1 > & | tl, |
const Matrix< D1, D2 > & | tr, | ||
const Matrix< D2, D1 > & | bl, | ||
const Matrix< D2, D2 > & | br | ||
) |
Join together 4 matrices from a blockwise decomposition.
D1 | |
D2 |
tl | |
tr | |
bl | |
br |
Definition at line 554 of file matrix_deprecated.h.
|
inline |
Derivative of lanczos kernel with respect to x.
x | Distance from center (0) |
a | Radius |
Definition at line 189 of file basic_functions.h.
|
inline |
Definition at line 222 of file basic_functions.h.
|
inline |
Definition at line 28 of file byteswap.h.
double npl::norm | ( | const Matrix< D1, D2 > & | trg | ) |
Definition at line 676 of file matrix_deprecated.h.
double npl::norm | ( | const Matrix< DIM, 1 > & | trg | ) |
Definition at line 684 of file matrix_deprecated.h.
double npl::norm | ( | const Matrix< 1, DIM > & | trg | ) |
Definition at line 693 of file matrix_deprecated.h.
VectorXd npl::onDiskSVD | ( | const MatrixReorg & | A, |
int | rank, | ||
size_t | poweriters, | ||
double | varthresh, | ||
double | cvarthresh, | ||
MatrixXd * | U = NULL , |
||
MatrixXd * | V = NULL |
||
) |
Uses randomized subspace approximation to reduce the input matrix (made up of blocks stored on disk with a given prefix). This assumes that the matrix is a wide matrix (which is generally a good assumption in fMRI) and that it therefore is better to reduce the number of columns.
To achieve this, we transpose the algorithm of 4.4 from Halko N, Martinsson P-G, Tropp J A. Finding structure with randomness: Probabilistic algorithms for constructing approximate matrix decompositions. 2009;1–74. Available from: http://arxiv.org/abs/0909.4061
A | MatrixReorg object that can be used to load images on disk |
rank | Number of output columns (output rank) |
poweriters | Number of power iterations to perform. 2 passes over A are required for each iteration, but iteration drives error to 0 at an exponential rate |
varthresh | stop after the eigenvalues reach this ratio of the maximum |
cvarthresh | stop after the sum of eigenvalues reaches this ratio of total |
U | Output U matrix, if null then ignored |
V | Output V matrix, if null then ignored |
Matrix<D1, D3> npl::operator* | ( | const Matrix< D1, D2 > & | lhs, |
const Matrix< D2, D3 > & | rhs | ||
) |
Definition at line 527 of file matrix_deprecated.h.
Matrix<D1, D2> npl::operator+ | ( | const Matrix< D1, D2 > & | lhs, |
const Matrix< D1, D2 > & | rhs | ||
) |
Definition at line 491 of file matrix_deprecated.h.
Matrix<D1, D2> npl::operator+= | ( | Matrix< D1, D2 > & | lhs, |
const Matrix< D1, D2 > & | rhs | ||
) |
Definition at line 480 of file matrix_deprecated.h.
Matrix<D1, D2> npl::operator- | ( | const Matrix< D1, D2 > & | lhs, |
const Matrix< D1, D2 > & | rhs | ||
) |
Definition at line 503 of file matrix_deprecated.h.
Definition at line 515 of file matrix_deprecated.h.
std::ostream& npl::operator<< | ( | std::ostream & | stream, |
const rgb_t & | v | ||
) |
std::ostream& npl::operator<< | ( | std::ostream & | stream, |
const rgba_t & | v | ||
) |
std::ostream& npl::operator<< | ( | std::ostream & | os, |
const Matrix< D1, D2 > & | b | ||
) |
Definition at line 452 of file matrix_deprecated.h.
std::ostream& npl::operator<< | ( | std::ostream & | os, |
const MatrixP & | b | ||
) |
Definition at line 465 of file matrix_deprecated.h.
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.
Note that repeated white space characters will be removed but other delimiters wont be
TODO handle ", " which should technically be ignored and maybe \, but not \, etc
line | string holding the line |
delim | character delimiter[s] |
|
inline |
Definition at line 411 of file basic_functions.h.
TrackSet npl::readDFT | ( | std::string | tfile, |
std::string | ref = "" |
||
) |
Reads a BrainSuite DFT file. Throws INVALID_ARGUMENT if the magic is wrong.
tfile | trk file |
ref | Reference image |
ptr<MRImage> npl::readMRImage | ( | std::string | filename, |
bool | verbose = false , |
||
bool | nopixeldata = false |
||
) |
Reads an MRI image. Right now only nift images are supported. later on, it will try to load image using different reader functions until one suceeds.
filename | Name of input file to read |
verbose | Whether to print out information as the file is read |
nopixeldata | Don't actually read the pixel data, just the header and create the image. So if you want to copy an image's orientation and structure, this would be the way to do it without wasting time actually reading. |
ptr<NDArray> npl::readNDArray | ( | std::string | filename, |
bool | verbose = false , |
||
bool | nopixeldata = false |
||
) |
Reads an array. Can read nifti's but orientation won't be read.
filename | Name of input file to read |
verbose | Whether to print out information as the file is read |
nopixeldata | Don't actually read the pixel data, just the header and create the image. So if you want to copy an image's orientation and structure, this would be the way to do it without wasting time actually reading. |
std::vector<std::vector<double> > npl::readNumericCSV | ( | std::string | filename, |
char | comment = '#' |
||
) |
This function parses an input and returns a list of rows.
This function reads a text file of the form: DvDvDvD....Dv[D] by deciding whether white space or commas or semi-colons is the delimiter and then proceeding to read each line. It does this by looking at the first 10 lines and comparing the line based on each possible deliminter. out
filename | file to read |
comment | lines with this first non-white space character will be ignored |
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.
This function reads a text file of the form: DvDvDvD....Dv[D] by deciding whether white space or commas or semi-colons is the delimiter and then proceeding to read each line. It does this by looking at the first 10 lines and comparing the line based on each possible deliminter. out
filename | file to read |
delim | Output: Delimiter found (this gets set). |
comment | lines with this first non-white space character will be ignored |
TrackSet npl::readTracks | ( | std::string | filename, |
std::string | ref = "" |
||
) |
Reads tracks into a vector of tracks, where each track is a vector of float[3].
filename | File storing tracks |
ref | Matching image used to construct the tracks (for orientation information). This is mandatory for DFT files, which lack orientation information of their own |
TrackSet npl::readTrk | ( | std::string | filename, |
std::string | ref = "" |
||
) |
Reads a trackvis trk file. Throws INVALID_ARGUMENT if the magic is wrong.
filename | trk file |
ref | Reference image (in case the RAS is not valid) |
|
inline |
Rectangle function centered at 0, with radius a, range should be = 2a.
x | distance from center |
a | radius |
Definition at line 80 of file basic_functions.h.
Regresses out the given variables, creating time series which are uncorrelated with X.
inimg | Input 4D image |
X | matrix of covariates |
|
inline |
Round up to the nearest power of 2.
in | Number to round |
Definition at line 446 of file basic_functions.h.
|
inline |
Rounds a number up to the nearest number that can be broken down into 3,5,7.
in | Input number |
Definition at line 485 of file basic_functions.h.
|
inline |
|
inline |
Secand function.
v | angle in radians |
Definition at line 398 of file basic_functions.h.
|
inline |
Sinc function centered at 0, with radius a, range should be = 2a.
x | distance from center |
a | radius |
Definition at line 97 of file basic_functions.h.
void npl::split | ( | const Matrix< D1+D2, D1+D2 > & | input, |
Matrix< D1, D1 > & | tl, | ||
Matrix< D1, D2 > & | tr, | ||
Matrix< D2, D1 > & | bl, | ||
Matrix< D2, D2 > & | br | ||
) |
Definition at line 591 of file matrix_deprecated.h.
void npl::swap | ( | T * | val | ) |
Definition at line 52 of file byteswap.h.
Definition at line 106 of file byteswap.h.
Definition at line 126 of file byteswap.h.
|
inline |
Definition at line 71 of file byteswap.h.
Definition at line 86 of file byteswap.h.
Definition at line 153 of file byteswap.h.
Definition at line 146 of file byteswap.h.
|
inline |
Definition at line 63 of file byteswap.h.
|
inline |
Definition at line 78 of file byteswap.h.
|
inline |
Definition at line 152 of file basic_functions.h.
|
inline |
Wraps and index based on the range [inf, sup] (when v is outside that) range. Thus inf = 1, sup = 5, v = 0 will wrap around to 4, and v = 6 would wrap around to 1.
T | Value of inf/sup/v |
inf | lower bound (inclusive) |
sup | upper bound (inclusive) |
v | valueto wrap. Output will be the position wrapped. |
Definition at line 59 of file basic_functions.h.
Writes out an MRImage to the file fn. Bool indicates whether to use nifti2 (rather than nifti1) format.
img | Image to write. |
fn | Filename |
nifti2 | Whether the use nifti2 format |
Writes out an MRImage to the file fn. Bool indicates whether to use nifti2 (rather than nifti1) format.
img | Image to write. |
fn | Filename |
nifti2 | Whether the use nifti2 format |
void npl::writePlot | ( | std::string | filename, |
const std::vector< T > & | data | ||
) |
Writes a plot to the given filename. This is a convience wrapper around Plotter, which for quick-and-dirty use might be too much setup.
T | Type of data to plot (will be cast to double) |
filename | |
data | Vector of data to plot |
Definition at line 229 of file basic_plot.h.
void npl::writePlot | ( | std::string | filename, |
const std::vector< T > & | data, | ||
size_t | xsize, | ||
size_t | ysize | ||
) |
Writes a plot to the given filename. This is a convience wrapper around Plotter, which for quick-and-dirty use might be too much setup.
T | Type of data to plot (will be cast to double) |
filename | |
data | Vector of 1D data to plot |
xsize | size output image (only matters for raster images *.tga) |
ysize | size output image (only matters for raster images *.tga) |
Definition at line 252 of file basic_plot.h.
void npl::writePlotAbsAng | ( | std::string | file, |
size_t | insz, | ||
fftw_complex * | in | ||
) |
Plots an array of complex points with the Real and Imaginary Parts.
Writes a 2D plot of the complex array where both absolute value and angle * values are plotted together.
file | Filename |
insz | Size of in |
in | Array input |
file | Filename base |
insz | Size of in array |
in | Array of complex values |
void npl::writePlotReIm | ( | std::string | file, |
const std::vector< std::complex< double >> & | in | ||
) |
Plots an array of complex points with the Real and Imaginary Parts.
file | Filename |
in | Array input |
void npl::writePlotReIm | ( | std::string | file, |
size_t | insz, | ||
fftw_complex * | in | ||
) |
Plots an array of complex points with the Real and Imaginary Parts.
Writes a 2D plot of the complex array where both real and imaginary values are plotted together.
file | Filename |
insz | Size of in |
in | Array input |
file | Filename base |
insz | Size of in array |
in | Array of complex values |
void npl::zoom | ( | size_t | isize, |
fftw_complex * | in, | ||
fftw_complex * | out, | ||
double | a | ||
) |
Performs a de-facto chirpz by interpolated zoom of a fourier-space line.
isize | Size of input array |
in | Input array (which should be in the fourier domain) |
out | Output array |
a | Zoom factor (should be -1 <= a <= 1) |
class npl::MatMap npl::__attribute__ |