347 pca_results(
pca_results&& a) : loadings(std::move(a.loadings)), scores(std::move(a.scores)), eigenvalues(std::move(a.eigenvalues)) { k = a.k; m = a.m; n = a.n; pca_tot = a.pca_tot; };
352 pca_results&
operator=(
pca_results&& a) { loadings = std::move(a.loadings); scores = std::move(a.scores); eigenvalues = std::move(a.eigenvalues); k = a.k; m = a.m; n = a.n; pca_tot = a.pca_tot;
return *
this; };
381 tsne_results(
tsne_results&& a) : embedding(std::move(a.embedding) ) { k = a.k; m = a.m; d = a.d; kl_divergence = a.kl_divergence; theta = a.theta; perplexity = a.perplexity; total_iter = a.total_iter;};
386 tsne_results&
operator=(
tsne_results&& a) { embedding = std::move(a.embedding); k = a.k; m = a.m; kl_divergence = a.kl_divergence; theta = a.theta; perplexity = a.perplexity; total_iter = a.total_iter;
return *
this; };
413 kmeans_results(
kmeans_results&& a) : cmeans(std::move(a.cmeans)), inc(std::move(a.inc)), nic(std::move(a.nic)), wcs(std::move(a.wcs)) { k = a.k; m = a.m; n = a.n; metric = a.metric; };
417 kmeans_results&
operator=(
kmeans_results&& a) { cmeans = std::move(a.cmeans); inc = std::move(a.inc); nic = std::move(a.nic); wcs = std::move(a.wcs); k = a.k; m = a.m; n = a.n; metric = a.metric;
return *
this; };
436 std::unique_ptr<FPType[], cfree>
W;
437 std::unique_ptr<FPType[], cfree>
H;
469 cwt_results(
cwt_results&& a) : scales(std::move(a.scales)), pixels(std::move(a.pixels)), coefficients(std::move(a.coefficients)) { n = a.n; nscales = a.nscales; npixels = a.npixels; }
473 cwt_results&
operator=(
cwt_results&& a) { scales = std::move(a.scales); pixels = std::move(a.pixels); coefficients = std::move(a.coefficients); n = a.n; nscales = a.nscales; npixels = a.npixels;
return *
this; }
489 Error(std::string msg) : message(msg) {};
528 SpecImage(
size_t m,
size_t n,
const FPType *matrix,
const FPType *mzvals = NULL);
683 FPType tol = 1.e-2, uint32_t max_iter = 200);
803 FPType perplexity = 50, FPType theta = 0.3, uint32_t max_iter = 1000,
804 uint32_t verbosity = 50, FPType min_grad_norm = 1.0e-5,
805 uint32_t n_unimproved_iter = 30, FPType learning_rate = 100,
806 FPType early_exaggeration = 4.0, uint32_t exaggerated_iter = 50);
863 std::vector<FPType>
getSinglePeak(FPType minmz, FPType maxmz);
927 void setLimits(
const std::vector<FPType>& limits);
enum nag::pca_mat pca_mat_t
The matrix used to perform principal component analysis.
void setLimits(const std::vector< FPType > &limits)
Set the limits to use during nag::SpecImage::peakSelect.
std::string message
Contains error details.
Definition: SpecImage.hpp:488
Indicates that the rows of the matrix represent pixels, and the columns mass channels.
Definition: SpecImage.hpp:281
A type used to hold the result of a 1D real continuous wavelet transform.
Definition: SpecImage.hpp:459
size_t npixels
The number of pixels for which the CWT has been performed.
Definition: SpecImage.hpp:463
size_t m
The number of rows of the input matrix.
Definition: SpecImage.hpp:434
std::unique_ptr< FPType[], cfree > cmeans
The k by n matrix whose rows define the k cluster centroids, stored in row-major ordering.
Definition: SpecImage.hpp:407
size_t n
The number of columns of the matrix.
Definition: SpecImage.hpp:338
pca_results_t< FPType > pca(uint32_t k, pca_mat_t t=Covariance)
Principal component analysis.
Use the Haar wavelet for nag::SpecImage::cwt.
Definition: SpecImage.hpp:291
Base class representing a spectral image.
Definition: SpecImage.hpp:496
enum nag::wavelet_extension wavelet_extension_t
The end extension method used to perform the continuous wavelet transform.
The source is unknown and the object has been constructed directly as a base nag::SpecImage type...
Definition: SpecImage.hpp:255
Use the covariance matrix to perform nag::SpecImage::pca.
Definition: SpecImage.hpp:263
Error(std::string msg)
Definition: SpecImage.hpp:489
matrix_ordering
A type used to indicate whether the ordering of the matrix is pixels by channels or channels by pixel...
Definition: SpecImage.hpp:279
int getZDim()
Return the number of pixels in the image in the dimension.
size_t n
The input length (number of channels).
Definition: SpecImage.hpp:461
std::unique_ptr< FPType[], cfree > coefficients
n by nscales by npixels 3D array of output CWT coefficients. The coefficient for the scale of the ...
Definition: SpecImage.hpp:466
size_t d
The number of columns of the input matrix; equivalent to the number of dimensions of the input data...
Definition: SpecImage.hpp:371
nmf_results_t< FPType > nmf(uint32_t k, FPType *initial_W=NULL, FPType *initial_H=NULL, FPType tol=1.e-2, uint32_t max_iter=200)
Non-negative matrix factorization.
wavelet_name
The wavelet used to perform the continuous wavelet transform.
Definition: SpecImage.hpp:288
kmeans_results_t< FPType > kmeans(uint32_t k, FPType *initial_cmeans=NULL, kmeans_metric_t metric=Cosine)
k-means clustering analysis
std::unique_ptr< FPType[], cfree > scores
The m by k PCA scores matrix, stored in column-major ordering.
Definition: SpecImage.hpp:341
Use the Euclidean distance metric for nag::SpecImage::kmeans analysis.
Definition: SpecImage.hpp:272
std::vector< FPType > eigenvalues
The eigenvalues vector of length k corresponding to the variance accounted for in the th component (i...
Definition: SpecImage.hpp:342
Overall namespace for the NAG C++ Hyperspectral Imaging Library.
Definition: MALDISpecImage.hpp:12
size_t n
The number of columns of the matrix.
Definition: SpecImage.hpp:405
size_t n
The number of columns of the input matrix.
Definition: SpecImage.hpp:435
std::vector< FPType > getMZVals()
Return the mass-to-charge values which label the channels in the image matrix.
int k
The selected inner dimension of the factorization.
Definition: SpecImage.hpp:433
A type used to hold the result of a non-negative matrix factorization.
Definition: SpecImage.hpp:431
tsne_results()=default
Default constructor.
size_t getM()
Return the number of rows in the matrix.
kmeans_metric_t metric
The distance metric used in the analysis.
Definition: SpecImage.hpp:406
std::unique_ptr< FPType[], cfree > embedding
The m by k lower-dimensional matrix, stored in column-major order.
Definition: SpecImage.hpp:375
nmf_results(nmf_results &&a)
Move constructor.
Definition: SpecImage.hpp:441
enum nag::source source_t
A type used to indicate the instrument source of the image. Returned by nag::SpecImage.getSource.
nmf_results & operator=(nmf_results &&a)
Move assignment operator.
Definition: SpecImage.hpp:445
A type used to hold the details of a principal component analysis.
Definition: SpecImage.hpp:334
std::vector< FPType > getSinglePeak(FPType minmz, FPType maxmz)
Return a single peak. A lower limit minmz and an upper limit maxmz are used to reduce the number of c...
size_t m
The number of rows of the matrix.
Definition: SpecImage.hpp:337
size_t m
The number of rows of the matrix.
Definition: SpecImage.hpp:404
size_t getN()
Return the number of columns in the matrix.
source
A type used to indicate the instrument source of the image. Returned by nag::SpecImage.getSource.
Definition: SpecImage.hpp:251
pca_mat
The matrix used to perform principal component analysis.
Definition: SpecImage.hpp:261
kmeans_results()=default
Default constructor.
std::vector< size_t > row_ptr
row_ptr is a vector of length m + 1. row_ptr[i] gives the start of row i in the col_indx and values v...
Definition: SpecImage.hpp:313
tsne_results_t< FPType > tsne(uint32_t k, pca_results_t< FPType > *data=NULL, FPType *embedding=NULL, FPType perplexity=50, FPType theta=0.3, uint32_t max_iter=1000, uint32_t verbosity=50, FPType min_grad_norm=1.0e-5, uint32_t n_unimproved_iter=30, FPType learning_rate=100, FPType early_exaggeration=4.0, uint32_t exaggerated_iter=50)
t-SNE analysis
int k
The number of dimensions in the embedding.
Definition: SpecImage.hpp:369
size_t n
n is the number of columns of the matrix.
Definition: SpecImage.hpp:311
kmeans_metric
The metric used to perform k-means clustering analysis.
Definition: SpecImage.hpp:270
std::vector< int > inc
A vector of length m in which inc[i] indicates the cluster to which the th pixel belongs.
Definition: SpecImage.hpp:408
tsne_results(tsne_results &&a)
Move constructor.
Definition: SpecImage.hpp:381
FPType theta
The parameter theta used in t-SNE; it represents a tradeoff between speed and accuracy: 0 is accurate...
Definition: SpecImage.hpp:373
A type used to wrap access to the C free() function.
Definition: SpecImage.hpp:324
Indicates that the rows of the matrix represent mass channels, and the columns pixels.
Definition: SpecImage.hpp:282
FPType tol
The tolerance used to produce the result.
Definition: SpecImage.hpp:438
tsne_results & operator=(tsne_results &&a)
Move assignment operator.
Definition: SpecImage.hpp:386
size_t getNNZ()
Return the number of non-zero elements in the matrix.
Use periodic end extension for nag::SpecImage::cwt.
Definition: SpecImage.hpp:299
int k
The number of principal components found.
Definition: SpecImage.hpp:336
Use the Mexican hat wavelet for nag::SpecImage::cwt.
Definition: SpecImage.hpp:290
FPType pca_tot
The sum total variance for all of the components.
Definition: SpecImage.hpp:339
std::vector< FPType > values
values is a vector of length nnz. values[i] gives the value of the ith non-zero element.
Definition: SpecImage.hpp:315
std::vector< uint32_t > col_indx
col_indx is a vector of length nnz. col_indx[i] gives the column index of the ith non-zero element...
Definition: SpecImage.hpp:314
csr_mat_t< FPType > getSparseMatrix(matrix_ordering_t order=PixelsByChannels)
Retrieve a copy of the image matrix in sparse storage format.
kmeans_results(kmeans_results &&a)
Move constructor.
Definition: SpecImage.hpp:413
std::unique_ptr< FPType[], cfree > loadings
The n by k PCA loadings matrix, stored in column-major ordering. The loadings are returned in decreas...
Definition: SpecImage.hpp:340
Use the correlation matrix to perform nag::SpecImage::pca.
Definition: SpecImage.hpp:264
SpecImage()
Default constructor.
Definition: SpecImage.hpp:507
size_t m
m is the number of rows of the matrix.
Definition: SpecImage.hpp:310
Use zero end extension for nag::SpecImage::cwt.
Definition: SpecImage.hpp:300
int k
The number of clusters in the analysis.
Definition: SpecImage.hpp:403
cwt_results_t< FPType > cwt(const std::vector< uint32_t > &scales, const std::vector< size_t > &pixels, wavelet_t wav=Haar, wavelet_extension_t ext=Periodic)
Batched one-dimensional real continuous wavelet transform.
std::unique_ptr< FPType[], cfree > W
The m by k matrix factor W, stored in column-major ordering.
Definition: SpecImage.hpp:436
int getXDim()
Return the number of pixels in the image in the dimension.
cwt_results & operator=(cwt_results &&a)
Move assignment operator.
Definition: SpecImage.hpp:473
nmf_results()=default
Default constructor.
FPType perplexity
The perplexity used in the t-SNE algorithm.
Definition: SpecImage.hpp:374
pca_results(pca_results &&a)
Move constructor.
Definition: SpecImage.hpp:347
wavelet_extension
The end extension method used to perform the continuous wavelet transform.
Definition: SpecImage.hpp:297
int getYDim()
Return the number of pixels in the image in the dimension.
A type used to hold the details of a t-SNE analysis.
Definition: SpecImage.hpp:367
size_t nnz
nnz is the number of non-zero elements.
Definition: SpecImage.hpp:309
cwt_results(cwt_results &&a)
Move constructor.
Definition: SpecImage.hpp:469
std::vector< FPType > wcs
A vector of length k in which wcs[i] gives the within-cluster sum of distances to the th cluster cent...
Definition: SpecImage.hpp:410
The source is a MALDI instrument, and the object is of type nag::MALDISpecImage.
Definition: SpecImage.hpp:254
int total_iter
The number of iterations that were performed.
Definition: SpecImage.hpp:376
std::vector< size_t > pixels
Vector of pixels used.
Definition: SpecImage.hpp:465
Class thrown on error.
Definition: SpecImage.hpp:485
int nscales
The number of scales over which the CWT has been performed.
Definition: SpecImage.hpp:462
void operator()(void *ptr)
Definition: SpecImage.hpp:326
std::vector< uint32_t > scales
Vector of scales used.
Definition: SpecImage.hpp:464
std::unique_ptr< FPType[]> getDenseMatrix(matrix_ordering_t order=PixelsByChannels)
Retrieve a copy of the image matrix in dense storage format.
Use symmetric end extension for nag::SpecImage::cwt.
Definition: SpecImage.hpp:301
virtual ~SpecImage()
Destructor.
std::unique_ptr< FPType[], cfree > H
The k by n matrix factor H, stored in column-major ordering.
Definition: SpecImage.hpp:437
size_t m
The number of rows of the input matrix (and the number of rows of the lower dimensional embedding)...
Definition: SpecImage.hpp:370
pca_results & operator=(pca_results &&a)
Move assignment operator.
Definition: SpecImage.hpp:352
FPType kl_divergence
The Kullback-Liebler divergence between the input data and the lower-dimensional embedding.
Definition: SpecImage.hpp:372
source_t getSource()
Determine the type of the object.
Definition: SpecImage.hpp:945
kmeans_results & operator=(kmeans_results &&a)
Move assignment operator.
Definition: SpecImage.hpp:417
void * _imgh
Opaque handle to internal library data structure.
Definition: SpecImage.hpp:500
The source is a SIMS instrument, and the object is of type nag::SIMSpecImage.
Definition: SpecImage.hpp:253
A type used to hold the details of a k-means clustering analysis.
Definition: SpecImage.hpp:401
cwt_results()=default
Default constructor.
source_t _source_type
Encodes what the underlying type is: nag::SIMSpecImage (value: SIMS), nag::MALDISpecImage (value: MAL...
Definition: SpecImage.hpp:501
enum nag::kmeans_metric kmeans_metric_t
The metric used to perform k-means clustering analysis.
enum nag::wavelet_name wavelet_t
The wavelet used to perform the continuous wavelet transform.
void peakSelect()
Perform peak selection.
Use the cosine distance metric for nag::SpecImage::kmeans analysis.
Definition: SpecImage.hpp:273
A type used to hold the components of a sparse matrix in compressed sparse row (CSR) format...
Definition: SpecImage.hpp:307
enum nag::matrix_ordering matrix_ordering_t
A type used to indicate whether the ordering of the matrix is pixels by channels or channels by pixel...
pca_results()=default
Default constructor.
std::vector< int > nic
A vector of length k in which nic[i] gives the number of pixels in the th cluster.
Definition: SpecImage.hpp:409