File: BrainModelCiftiCorrelationMatrix.h

package info (click to toggle)
caret 5.6.4~dfsg.1-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 31,904 kB
  • ctags: 28,901
  • sloc: cpp: 378,050; python: 6,718; ansic: 5,507; makefile: 333; sh: 46
file content (90 lines) | stat: -rw-r--r-- 2,412 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

#ifndef __BRAIN_MODEL_CIFTI_CORRELATION_MATRIX_H__
#define __BRAIN_MODEL_CIFTI_CORRELATION_MATRIX_H__

#include <cstdio>

#include "BrainModelAlgorithm.h"
#include "CiftiFile.h"

/**
 * Compute correlation of each metric column with all other metric columns.
 */
class BrainModelCiftiCorrelationMatrix : public BrainModelAlgorithm {
   public:
      // constructor for files that have already been read
      BrainModelCiftiCorrelationMatrix(
           BrainSet* bs,
           CiftiFile * inputCiftiFile,
           const bool applyFisherZTransformFlag,
           const bool parallelFlag);
      
      // destructor
      ~BrainModelCiftiCorrelationMatrix();
      
      // execute the algorithm                                                                                                   
      void execute() throw (BrainModelAlgorithmException);                                                
         
      // get the output metric file (if called caller is reponsible for DELETING
      // returned metric file.
      CiftiFile* getOutputCiftiFile();

   private:
      // initialize variables
      void initialize();
      
      // load the data values
      void loadDataValues();

      // create output metric file
      void createOutputCiftiFile();
      
      // compute the means
      void computeMeans();
      
      // compute the sum-squared
      void computeSumSquared();
      
      // compute the correlations
      void computeCorrelations();
      
      // compute correlations for rows until there are no more rows to process
      void computeCorrelationsForRows();

      QString m_inputCiftiFileName;

      CiftiFile* m_inputCiftiFile;
      
      QString m_outputCiftiFileName;

      CiftiFile* m_outputCiftiFile;
      
      float** m_outputDataArrayColumns;
      
      long m_inputNumRows;
      
      long m_inputNumColumns;
      
      long m_outputDimension;
      
      // All values in one-dim array
      float* m_dataValues;
      
      // mean of all column values for each row
      float* m_rowMeans;
      
      // sum-squared of all column values for each row
      double* m_rowSumSquared;
      
      const bool m_applyFisherZTransformFlag;
      
      bool m_deleteOutputCiftiFlag;
      
      long m_nextRowToProcess;
      
      const bool m_parallelFlag;
      
};

#endif //  __BRAIN_MODEL_SURFACE_METRIC_CORRELATION_MATRIX_H__