forked from Slicer/SlicerGitSVNArchive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvtkFSSurfaceAnnotationReader.h
102 lines (78 loc) · 3.01 KB
/
vtkFSSurfaceAnnotationReader.h
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
/*=auto=========================================================================
Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
See COPYRIGHT.txt
or http://www.slicer.org/copyright/copyright.txt for details.
=========================================================================auto=*/
#ifndef __vtkFSSurfaceAnnotationReader_h
#define __vtkFSSurfaceAnnotationReader_h
// FreeSurfer includes
#include "FreeSurferConfigure.h"
#include "vtkFreeSurferExport.h"
// VTK includes
#include <vtkDataReader.h>
class vtkIntArray;
class vtkLookupTable;
/// \brief Read a surface annotation and
/// color table file from Freesurfer tools.
///
///
/// Reads a surface annotation file from FreeSurfer and outputs a
/// vtkIntArray and has an access function to get the vtkLookupTable
/// with the color values. Use the SetFileName function to specify the
/// file name. The number of values in the array should be equal to the
/// number of vertices/points in the surface.
class VTK_FreeSurfer_EXPORT vtkFSSurfaceAnnotationReader : public vtkDataReader
{
public:
static vtkFSSurfaceAnnotationReader *New();
vtkTypeMacro(vtkFSSurfaceAnnotationReader,vtkDataReader);
void PrintSelf(ostream& os, vtkIndent indent) override;
vtkIntArray *GetOutput();
void SetOutput(vtkIntArray *output);
vtkLookupTable *GetColorTableOutput();
void SetColorTableOutput(vtkLookupTable* colors);
char* GetColorTableNames();
int ReadFSAnnotation();
/// write out the annotation file, using an internal color table
int WriteFSAnnotation();
vtkGetMacro(NumColorTableEntries, int);
vtkSetStringMacro(ColorTableFileName);
vtkGetMacro(UseExternalColorTableFile,int);
vtkSetMacro(UseExternalColorTableFile,int);
vtkBooleanMacro(UseExternalColorTableFile,int);
///
/// previously defined as constants
enum
{
/// tag
FS_COLOR_TABLE_TAG = 1,
FS_COLOR_TABLE_NAME_LENGTH = 1024,
FS_COLOR_TABLE_ENTRY_NAME_LENGTH = 1024,
FS_ERROR_LOADING_COLOR_TABLE = 1,
FS_ERROR_LOADING_ANNOTATION = 2,
FS_ERROR_PARSING_COLOR_TABLE = 3,
FS_ERROR_PARSING_ANNOTATION = 4,
FS_WARNING_UNASSIGNED_LABELS = 5,
FS_NO_COLOR_TABLE = 6,
};
protected:
vtkFSSurfaceAnnotationReader();
~vtkFSSurfaceAnnotationReader() override;
vtkIntArray *Labels;
vtkLookupTable *Colors;
char *NamesList;
int NumColorTableEntries;
int UseExternalColorTableFile;
char *ColorTableFileName;
/// Read color table information from a source, allocate the arrays
/// to hold rgb and name values, and return pointers to the
/// arrays. The caller is responsible for disposing of the memory.
int ReadEmbeddedColorTable (FILE* annotFile, int* numEntries,
int*** rgbValues, char*** names);
int ReadExternalColorTable (char* fileName, int* numEntries,
int*** rgbValues, char*** names);
private:
vtkFSSurfaceAnnotationReader(const vtkFSSurfaceAnnotationReader&) = delete;
void operator=(const vtkFSSurfaceAnnotationReader&) = delete;
};
#endif