Reorganizes input images into tall and wide matrices (matrices that span the total rows and cols, respectively).
More...
#include <fmri_inference.h>
|
| 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 |
|
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.
npl::MatrixReorg::MatrixReorg |
( |
std::string |
prefix = "" , |
|
|
size_t |
maxd = (1<< 30) , |
|
|
bool |
verbose = true |
|
) |
| |
Constructor.
- Parameters
-
prefix | Prefix for matrix files to be written PREFIX_tall_[0-9]* and * PREFIX_wide_[0-9]* |
maxd | Maximum number of doubles to include in a block, this should be sized to fit into memory |
verbose | Print information |
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 |
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
-
timeblocks | Number of timeseries to concatinate (concatined time-series are adjacent in filenames vector) |
spaceblocks | Number of images to concatinate spacially. Unless PSD is done, these images should have matching tasks |
masknames | Files matching columns of in the filenames matrix. That indicate voxels to include |
filenames | Files to read in, images are stored in column (time)-major order |
normts | whether 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 |
std::string npl::MatrixReorg::info_name |
( |
| ) |
const |
|
inline |
std::string npl::MatrixReorg::mask_name |
( |
size_t |
ii | ) |
const |
|
inline |
int npl::MatrixReorg::ntall |
( |
| ) |
const |
|
inline |
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 |
std::string npl::MatrixReorg::tall_name |
( |
size_t |
ii | ) |
const |
|
inline |
const vector<int>& npl::MatrixReorg::tallMatCols |
( |
| ) |
const |
|
inline |
std::string npl::MatrixReorg::tallMatName |
( |
size_t |
ii | ) |
const |
|
inline |
int npl::MatrixReorg::tallMatRows |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following file: