aimsdata 6.0.0
Neuroimaging data handling
ciftitools.h
Go to the documentation of this file.
1/* This software and supporting documentation are distributed by
2 * Institut Federatif de Recherche 49
3 * CEA/NeuroSpin, Batiment 145,
4 * 91191 Gif-sur-Yvette cedex
5 * France
6 *
7 * This software is governed by the CeCILL-B license under
8 * French law and abiding by the rules of distribution of free software.
9 * You can use, modify and/or redistribute the software under the
10 * terms of the CeCILL-B license as circulated by CEA, CNRS
11 * and INRIA at the following URL "http://www.cecill.info".
12 *
13 * As a counterpart to the access to the source code and rights to copy,
14 * modify and redistribute granted by the license, users are provided only
15 * with a limited warranty and the software's author, the holder of the
16 * economic rights, and the successive licensors have only limited
17 * liability.
18 *
19 * In this respect, the user's attention is drawn to the risks associated
20 * with loading, using, modifying and/or developing or reproducing the
21 * software by the user in light of its specific status of free software,
22 * that may mean that it is complicated to manipulate, and that also
23 * therefore means that it is reserved for developers and experienced
24 * professionals having in-depth computer knowledge. Users are therefore
25 * encouraged to load and test the software's suitability as regards their
26 * requirements in conditions enabling the security of their systems and/or
27 * data to be ensured and, more generally, to use and operate it in the
28 * same conditions as regards security.
29 *
30 * The fact that you are presently reading this means that you have had
31 * knowledge of the CeCILL-B license and that you accept its terms.
32 */
33
34#ifndef AIMS_SPARSEMATRIX_CIFTITOOLS_H
35#define AIMS_SPARSEMATRIX_CIFTITOOLS_H
36
37#include <cartobase/smart/rcptr.h>
38#include <map>
39#include <vector>
40#include <string>
41#include <list>
42
43template <typename T> class TimeTexture;
44class Void;
45template <int D, typename T> class AimsTimeSurface;
46
47namespace carto
48{
49 class Object;
50}
51
52
53namespace aims
54{
56
70 {
71 public:
72 typedef std::map<std::string, int> BrainStuctureToMeshMap;
73 typedef std::vector<carto::rc_ptr<TimeTexture<int> > > RoiTextureList;
74 typedef std::vector<carto::rc_ptr<TimeTexture<float> > > TextureList;
75
80
82 { return _matrix; }
87 { return _smap; }
89 { return _smap; }
91 { _smap = smap; }
92
120 int dim,
121 const std::vector<int> & dim_indices_pos,
122 TextureList* existing_tex_list = 0 ) const;
123
124 // intermediate
130 int valuesDimNum() const;
131 static int valuesDimNum( carto::Object cifti_info );
132 static size_t valuesDimSize( const SparseOrDenseMatrix & mat,
133 int value_dim );
134 static std::string dimensionType( carto::Object cifti_info, int dim );
135 std::string dimensionType( int dim ) const;
136
137 // lower-level (could probably be private)
139
142 template <typename T>
144 const TimeTexture<T> & tex );
145
146 static void getLabelsInfo( carto::Object cifti_info, RoiTextureList & );
147 static void getSeriesInfo( carto::Object cifti_info, RoiTextureList & );
148 void getParcelsInfo( carto::Object cifti_info, RoiTextureList & ) const;
150 RoiTextureList & ) const;
152 carto::Object cifti_info, TextureList & texlist, int dim,
153 const std::vector<int> & dim_indices_pos ) const;
155 carto::Object cifti_info, TextureList & texlist, int dim,
156 const std::vector<int> & dim_indices_pos ) const;
157 std::list<std::string> getBrainStructures( int dim,
158 bool keepSurfaces = true,
159 bool keepVoxels = true ) const;
163 int dim, const std::string & struct_name ) const;
168 int dim, int surface_num, const std::vector<int> & roi_indices ) const;
170 int dim, const std::string & struct_name ) const;
177 bool isMatchingSurface( int dim, const AimsTimeSurface<3, Void> & mesh,
178 std::list<std::string> & brainmodels,
179 int & surf_index, int surf_hint = 0 ) const
180 {
181 return isMatchingSurfaceOrTexture( dim, mesh, brainmodels, surf_index,
182 surf_hint );
183 }
184
190 template <typename T>
191 bool isMatchingTexture( int dim, const TimeTexture<T> & tex,
192 std::list<std::string> & brainmodels,
193 int & surf_index, int surf_hint = 0 ) const
194 {
195 return isMatchingSurfaceOrTexture( dim, tex, brainmodels, surf_index,
196 surf_hint );
197 }
198 bool isMatchingSurfaceOrTexture( int dim, size_t nvertices,
199 const carto::Object header,
200 std::list<std::string> & brainmodels,
201 int & surf_index,
202 int surf_hint = 0 ) const;
203
204 private:
205 template <typename T> bool
206 isMatchingSurfaceOrTexture( int dim, const T & mesh,
207 std::list<std::string> & brainmodels,
208 int & surf_index, int surf_hint = 0 ) const;
209 void getSurfaceModelTexture(
210 carto::Object surf, TextureList & texlist,
211 const BrainStuctureToMeshMap & smap,
212 SparseOrDenseMatrix & mat, int dim,
213 const std::vector<int> & dim_indices_pos,
214 unsigned nsurfaces ) const;
215
216 struct Private;
217
218 Private *d;
221 };
222
223}
224
225#endif
226
The template class to manage a mesh with time if needed.
Definition surface.h:317
bool isMatchingSurfaceOrTexture(int dim, size_t nvertices, const carto::Object header, std::list< std::string > &brainmodels, int &surf_index, int surf_hint=0) const
std::vector< carto::rc_ptr< TimeTexture< int > > > RoiTextureList
Definition ciftitools.h:73
void buildDimensionObjectFromLabelsTexture(int dim, const TimeTexture< T > &tex)
buid a dimension object in a simple case where the matrix (probably non-cifti) is a reduced matrix ov...
void getParcelsTexture(carto::Object cifti_info, TextureList &texlist, int dim, const std::vector< int > &dim_indices_pos) const
void getBrainModelsInfo(carto::Object cifti_info, RoiTextureList &) const
int valuesDimNum() const
size_t getBrainStructureMeshNumberOfNodes(int dim, const std::string &struct_name) const
RoiTextureList * roiTextureFromDimension(int dim) const
Get ROI information for a given matrix dimension.
std::vector< int > getIndicesForBrainStructure(int dim, const std::string &struct_name) const
Get the list of matrix indices corresponding to a given brain structure, on a given dimension.
void setMatrix(carto::rc_ptr< SparseOrDenseMatrix > matrix)
static void getSeriesInfo(carto::Object cifti_info, RoiTextureList &)
void getParcelsInfo(carto::Object cifti_info, RoiTextureList &) const
void getBrainModelsTexture(carto::Object cifti_info, TextureList &texlist, int dim, const std::vector< int > &dim_indices_pos) const
bool isMatchingSurface(int dim, const AimsTimeSurface< 3, Void > &mesh, std::list< std::string > &brainmodels, int &surf_index, int surf_hint=0) const
checks if the given mesh matches a surface description in the given dimension of the Cifti matrix.
Definition ciftitools.h:177
static std::string dimensionType(carto::Object cifti_info, int dim)
static size_t valuesDimSize(const SparseOrDenseMatrix &mat, int value_dim)
static BrainStuctureToMeshMap defaultBrainStructureToMeshMap()
Define the brain structure to mesh mapping: several meshes may be involved in CIFTI data mapping (typ...
bool isMatchingTexture(int dim, const TimeTexture< T > &tex, std::list< std::string > &brainmodels, int &surf_index, int surf_hint=0) const
checks if the given texture matches a surface description in the given dimension of the Cifti matrix.
Definition ciftitools.h:191
TextureList * expandedValueTextureFromDimension(int dim, const std::vector< int > &dim_indices_pos, TextureList *existing_tex_list=0) const
Get matrix data in textures, possibly expanded to regions if needed.
static void getLabelsInfo(carto::Object cifti_info, RoiTextureList &)
void setBrainStructureMap(const BrainStuctureToMeshMap &smap)
Definition ciftitools.h:90
carto::Object getDimensionObject(int dim) const
std::vector< carto::rc_ptr< TimeTexture< float > > > TextureList
Definition ciftitools.h:74
std::map< std::string, int > BrainStuctureToMeshMap
Definition ciftitools.h:72
const BrainStuctureToMeshMap & brainStructureMap() const
Definition ciftitools.h:86
static int valuesDimNum(carto::Object cifti_info)
std::list< std::string > getBrainStructures(int dim, bool keepSurfaces=true, bool keepVoxels=true) const
carto::rc_ptr< SparseOrDenseMatrix > matrix()
Definition ciftitools.h:83
BrainStuctureToMeshMap & brainStructureMap()
Definition ciftitools.h:88
std::string dimensionType(int dim) const
const carto::rc_ptr< SparseOrDenseMatrix > matrix() const
Definition ciftitools.h:81
CiftiTools(carto::rc_ptr< SparseOrDenseMatrix > matrix, const BrainStuctureToMeshMap &smap=BrainStuctureToMeshMap())
std::vector< int > getIndicesForSurfaceIndices(int dim, int surface_num, const std::vector< int > &roi_indices) const
Get the list of matrix indices corresponding to a given region on a mesh, for a given dimension.
The class for EcatSino data write operation.