NPL
Neurological Programs and Libraries
npl::MatrixReorg Class Reference

Reorganizes input images into tall and wide matrices (matrices that span the total rows and cols, respectively). More...

#include <fmri_inference.h>

Public Member Functions

 MatrixReorg (std::string prefix="", size_t maxd=(1<< 30), bool verbose=true)
 Constructor. More...
 
int createMats (size_t timeblocks, size_t spaceblocks, const std::vector< std::string > &masknames, const std::vector< std::string > &filenames, bool normts=true)
 Creates two sets of matrices from a set of input images. The matrices (images) are ordered in column major order. In each column the mask is loaded then each image in the column is loaded and the masked timepoints extracted. More...
 
int checkMats ()
 Loads existing matrices by first reading ${prefix}_tall_0, ${prefix}_wide_0, and ${prefix}_mask_*, and checking that all the dimensions can be made to match (by loading the appropriate number of matrices/masks). More...
 
int ntall () const
 
const vector< int > & tallMatCols () const
 
int tallMatRows () const
 
std::string tallMatName (size_t ii) const
 
std::string inColMaskName (size_t ii) const
 
void preMult (Eigen::Ref< MatrixXd > out, const Eigen::Ref< const MatrixXd > in, bool transpose=false) const
 
void postMult (Eigen::Ref< MatrixXd > out, const Eigen::Ref< const MatrixXd > in, bool transpose=false) const
 
int rows () const
 
int cols () const
 
std::string mask_name (size_t ii) const
 
std::string info_name () const
 
std::string tall_name (size_t ii) const
 

Detailed Description

Reorganizes input images into tall and wide matrices (matrices that span the total rows and cols, respectively).

Only use tall mats, I think I might drop wide mats eventually TODO allow for JUST tall or JUST wide construction

Definition at line 270 of file fmri_inference.h.

Constructor & Destructor Documentation

npl::MatrixReorg::MatrixReorg ( std::string  prefix = "",
size_t  maxd = (1<< 30),
bool  verbose = true 
)

Constructor.

Parameters
prefixPrefix for matrix files to be written PREFIX_tall_[0-9]* and * PREFIX_wide_[0-9]*
maxdMaximum number of doubles to include in a block, this should be sized to fit into memory
verbosePrint information

Member Function Documentation

int npl::MatrixReorg::checkMats ( )

Loads existing matrices by first reading ${prefix}_tall_0, ${prefix}_wide_0, and ${prefix}_mask_*, and checking that all the dimensions can be made to match (by loading the appropriate number of matrices/masks).

Returns
0 if succesful, -1 if read failure, -2 if write failure
int npl::MatrixReorg::cols ( ) const
inline

Definition at line 358 of file fmri_inference.h.

int npl::MatrixReorg::createMats ( size_t  timeblocks,
size_t  spaceblocks,
const std::vector< std::string > &  masknames,
const std::vector< std::string > &  filenames,
bool  normts = true 
)

Creates two sets of matrices from a set of input images. The matrices (images) are ordered in column major order. In each column the mask is loaded then each image in the column is loaded and the masked timepoints extracted.

The order of reading from filenames is essentially: time 0: 0246 time 1: 1357

Masks correspond to each column so the number of masks should be = to number masknames. Note that if no mask is provided, one will be generated from the set of non-zero variance timeseries in the first input image in the column.

This file writes matrices called /tall_# and /wide_#. Tall matrices have the entire concatinated timeseries for a limited set of spacial locations, Wide matrices have entire concatinated spacial signals for a limited number of timepoints.

Parameters
timeblocksNumber of timeseries to concatinate (concatined time-series are adjacent in filenames vector)
spaceblocksNumber of images to concatinate spacially. Unless PSD is done, these images should have matching tasks
masknamesFiles matching columns of in the filenames matrix. That indicate voxels to include
filenamesFiles to read in, images are stored in column (time)-major order
normtswhether to normalize the timeseries
Returns
0 if succesful, -1 if read failure, -2 if write failure
std::string npl::MatrixReorg::inColMaskName ( size_t  ii) const
inline

Definition at line 346 of file fmri_inference.h.

std::string npl::MatrixReorg::info_name ( ) const
inline

Definition at line 365 of file fmri_inference.h.

std::string npl::MatrixReorg::mask_name ( size_t  ii) const
inline

Definition at line 360 of file fmri_inference.h.

int npl::MatrixReorg::ntall ( ) const
inline

Definition at line 329 of file fmri_inference.h.

void npl::MatrixReorg::postMult ( Eigen::Ref< MatrixXd >  out,
const Eigen::Ref< const MatrixXd >  in,
bool  transpose = false 
) const
void npl::MatrixReorg::preMult ( Eigen::Ref< MatrixXd >  out,
const Eigen::Ref< const MatrixXd >  in,
bool  transpose = false 
) const
int npl::MatrixReorg::rows ( ) const
inline

Definition at line 357 of file fmri_inference.h.

std::string npl::MatrixReorg::tall_name ( size_t  ii) const
inline

Definition at line 369 of file fmri_inference.h.

const vector<int>& npl::MatrixReorg::tallMatCols ( ) const
inline

Definition at line 331 of file fmri_inference.h.

std::string npl::MatrixReorg::tallMatName ( size_t  ii) const
inline

Definition at line 341 of file fmri_inference.h.

int npl::MatrixReorg::tallMatRows ( ) const
inline

Definition at line 336 of file fmri_inference.h.


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