File: BrainModelSurfaceDeformDataFile.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 (195 lines) | stat: -rw-r--r-- 10,467 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

#ifndef __BRAIN_MODEL_SURFACE_DEFORM_DATA_FILE_H__
#define __BRAIN_MODEL_SURFACE_DEFORM_DATA_FILE_H__

#include <QString>
#include <vector>

#include "BrainModelAlgorithmException.h"
#include "SpecFile.h"

class AbstractFile;
class BrainSet;
class DeformationMapFile;

/// This class is used to deform surface data files using a deformation map file
class BrainModelSurfaceDeformDataFile {
   public:
      /// data file types that are deformed
      enum DATA_FILE_TYPE {
         DATA_FILE_AREAL_ESTIMATION,
         DATA_FILE_ATLAS,
         DATA_FILE_BORDER_FLAT,
         DATA_FILE_BORDER_SPHERICAL,
         DATA_FILE_BORDER_PROJECTION,
         DATA_FILE_CELL,
         DATA_FILE_CELL_PROJECTION,
         DATA_FILE_COORDINATE,
         DATA_FILE_COORDINATE_FLAT,
         DATA_FILE_FOCI,
         DATA_FILE_FOCI_PROJECTION,
         DATA_FILE_LAT_LON,
         DATA_FILE_METRIC,
         DATA_FILE_PAINT,
         DATA_FILE_RGB_PAINT,
         DATA_FILE_SHAPE,
         DATA_FILE_TOPOGRAPHY
      };
      
      /// link color files to target from source
      static void linkColorFiles(const DeformationMapFile* dmf,
                                 const bool linkAreaColorFiles,
                                 const bool linkBorderColorFiles,
                                 const bool linkCellColorFiles,
                                 const bool linkFociColorFiles,
                                 QString& deformErrorsMessage)
                                       throw (BrainModelAlgorithmException);

      /// create a deformed spec file name
      static QString createDeformedSpecFileName(const QString& deformedFileNamePrefix,
                                                const QString& sourceSpecFileName,
                                                const QString& targetSpecFileName);

      /// create a deformed data file name
      static QString createDeformedFileName(
                                         const QString& deformingFromFileName,
                                         const QString& mySpecFileName,
                                         const QString& deformedFilePrefix,
                                         const int numberOfNodes,
                                         const bool deformationMapFileNameFlag);
       
      /// deform a border file
      static void deformBorderFile(BrainSet* sourceBrainSet,
                                   BrainSet* targetBrainSet,
                                   const DeformationMapFile* dmf,
                                   const bool useSourceTargetPathsFlag,
                                   const DATA_FILE_TYPE dataFileType,
                                   const QString& dataFileName,
                                   const QString& outputFileNameIn = "")
                                       throw (BrainModelAlgorithmException);
      
      /// deform border files
      static void deformBorderFiles(BrainSet* sourceBrainSet,
                                    BrainSet* targetBrainSet,
                                    const DeformationMapFile* dmf,
                                    const DATA_FILE_TYPE dataFileType,
                                    const SpecFile::Entry& dataFiles,
                                    QString& deformErrorsMessage)
                                             throw (BrainModelAlgorithmException);

      /// deform coordinate files
      static void deformCoordinateFiles(const DeformationMapFile* dmf,
                                        const SpecFile::Entry& dataFiles,
                                        QString& deformErrorsMessage)
                                          throw (BrainModelAlgorithmException);
                                 
      /// deform a coordinate file
      static void deformCoordinateFile(const DeformationMapFile* dmf,
                                       const QString& dataFileName,
                                       QString& outputFileNameInOut,
                                       const bool smoothCoordFileOneIteration,
                                       const bool useSourceTargetPathsFlag)
                                          throw (BrainModelAlgorithmException);

      /// deform flat coordinate files
      static void deformFlatCoordinateFiles(const DeformationMapFile* dmf,
                                            const SpecFile::Entry& dataFiles,
                                            QString& deformErrorsMessage)
                                          throw (BrainModelAlgorithmException);
                                       
      /// deform a flat coordinate file
      static void deformFlatCoordinateFile(const DeformationMapFile* dmf,
                                       const QString& atlasTopoFileName,
                                       const bool useSourceTargetPathsFlag,
                                       const QString& coordFileName,
                                       const QString& topoFileName,
                                       const QString& outputCoordFileNameIn = "",
                                       const QString& outputTopoFileName = "",
                                       const float maxLength = 10.0)
                                          throw (BrainModelAlgorithmException);

      /// deform a cell or foci file
      static void deformCellOrFociFile(BrainSet* sourceBrainSet,
                                       BrainSet* targetBrainSet,
                                       const DeformationMapFile* dmf,
                                       const bool useSourceTargetPathsFlag,
                                       const QString& dataFileName,
                                       const bool fociFileFlag,
                                       const QString& outputFileNameIn = "")
                                       throw (BrainModelAlgorithmException);
      
      /// deform cell or foci files
      static void deformCellOrFociFiles(BrainSet* sourceBrainSet,
                                       BrainSet* targetBrainSet,
                                       const DeformationMapFile* dmf,
                                       const SpecFile::Entry& dataFiles,
                                       const bool fociFileFlag,
                                       QString& deformErrorsMessage)
                                 throw (BrainModelAlgorithmException);
                                 
      /// deform a cell or foci projection file
      static void deformCellOrFociProjectionFile(BrainSet* sourceBrainSet,
                                       BrainSet* targetBrainSet,
                                       const DeformationMapFile* dmf,
                                       const bool useSourceTargetPathsFlag,
                                       const QString& dataFileName,
                                       const bool fociFileFlag,
                                       const QString& outputFileNameIn = "")
                                       throw (BrainModelAlgorithmException);
      
      /// deform cell or foci projection files
      static void deformCellOrFociProjectionFiles(BrainSet* sourceBrainSet,
                                       BrainSet* targetBrainSet,
                                       const DeformationMapFile* dmf,
                                       const SpecFile::Entry& dataFiles,
                                       const bool fociFileFlag,
                                       QString& deformErrorsMessage)
                                 throw (BrainModelAlgorithmException);
                                 
      /// deform a node attribute data file
      static void deformNodeAttributeFile(const DeformationMapFile* dmf,
                                          const DATA_FILE_TYPE dataFileType,
                                          const bool useSourceTargetPathsFlag,
                                          const QString& dataFileName,
                                          const QString& outputFileNameIn = "") 
                                             throw (BrainModelAlgorithmException);
                                         
      /// deform a nifti node data file
      static void deformGiftiNodeDataFile(const DeformationMapFile* dmf,
                                          const DATA_FILE_TYPE dataFileType,
                                          const bool useSourceTargetPathsFlag,
                                          const QString& dataFileName,
                                          const QString& outputFileNameIn = "") 
                                             throw (BrainModelAlgorithmException);
                                         
      /// deform node attribute data files
      static void deformNodeAttributeFiles(const DeformationMapFile* dmf,
                                           const DATA_FILE_TYPE dataFileType,
                                           const SpecFile::Entry& dataFiles,
                                           QString& deformErrorsMessage) 
                                              throw (BrainModelAlgorithmException);

      /// deform node attribute data files
      static void deformGiftiNodeDataFiles(const DeformationMapFile* dmf,
                                           const DATA_FILE_TYPE dataFileType,
                                           const SpecFile::Entry& dataFiles,
                                           QString& deformErrorsMessage) 
                                              throw (BrainModelAlgorithmException);

      /// Add comment information about deformation.
      static void addCommentAboutDeformation(const DeformationMapFile& dmf,
                                             const AbstractFile* inputFile,
                                             AbstractFile* outputFile);
                                                            
   protected:
      /// Help out with linking one type of color files.
      static void linkColorFileHelper(const SpecFile::Entry& colorFiles,
                                      const QString& sourceSpecFilePath,
                                      SpecFile& outputSpecFile);
                                      
      /// get a string containing names of surfaces loaded.
      static QString getLoadedSurfaces(BrainSet* bs);
};

#endif // __BRAIN_MODEL_SURFACE_DEFORM_DATA_FILE_H__