ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkGiftiMeshIO.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkGiftiMeshIO_h
19 #define itkGiftiMeshIO_h
20 #include "ITKIOMeshExport.h"
21 
22 #include "itkMapContainer.h"
23 #include "itkMatrix.h"
24 #include "itkMeshIOBase.h"
25 #include "itkRGBAPixel.h"
26 
27 #include "gifti_io.h"
28 
29 #include <fstream>
30 #include <string>
31 
32 namespace itk
33 {
40 class ITKIOMesh_EXPORT GiftiMeshIO:public MeshIOBase
41 {
42 public:
44  typedef GiftiMeshIO Self;
48 
56 
58  itkNewMacro(Self);
59 
61  itkTypeMacro(GiftiMeshIO, MeshIOBase);
62 
63  itkGetConstMacro(ReadPointData, bool);
64  itkSetMacro(ReadPointData, bool);
65  itkBooleanMacro(ReadPointData);
66 
67  void SetDirection(const DirectionType & direction);
68 
69  itkGetConstReferenceMacro(Direction, DirectionType);
70 
71  LabelColorContainerPointer GetLabelColorTable();
72  LabelNameContainerPointer GetLabelNameTable();
73  void SetLabelColorTable(const LabelColorContainer * colorMap);
74  void SetLabelNameTable(const LabelNameContainer * labelMap);
75 
76  /*-------- This part of the interfaces deals with reading data. ----- */
77 
83  virtual bool CanReadFile(const char *FileNameToRead) ITK_OVERRIDE;
84 
86  virtual void ReadMeshInformation() ITK_OVERRIDE;
87 
89  virtual void ReadPoints(void *buffer) ITK_OVERRIDE;
90 
91  virtual void ReadCells(void *buffer) ITK_OVERRIDE;
92 
93  virtual void ReadPointData(void *buffer) ITK_OVERRIDE;
94 
95  virtual void ReadCellData(void *buffer) ITK_OVERRIDE;
96 
97  /*-------- This part of the interfaces deals with writing data. ----- */
98 
104  virtual bool CanWriteFile(const char *FileNameToWrite) ITK_OVERRIDE;
105 
107  virtual void WriteMeshInformation() ITK_OVERRIDE;
108 
111  virtual void WritePoints(void *buffer) ITK_OVERRIDE;
112 
113  virtual void WriteCells(void *buffer) ITK_OVERRIDE;
114 
115  virtual void WritePointData(void *buffer) ITK_OVERRIDE;
116 
117  virtual void WriteCellData(void *buffer) ITK_OVERRIDE;
118 
119  virtual void Write() ITK_OVERRIDE;
120 
121 protected:
122  GiftiMeshIO();
123  virtual ~GiftiMeshIO();
124 
125  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
126 
127  template< typename TInput, typename TOutput >
128  void ConvertBuffer(TInput *input, TOutput *output, SizeValueType numberOfElements)
129  {
130  if ( input && output )
131  {
132  for ( SizeValueType ii = 0; ii < numberOfElements; ii++ )
133  {
134  output[ii] = static_cast< TOutput >( input[ii] );
135  }
136  }
137  }
138 
139 private:
141  gifti_image * m_GiftiImage;
143 
144 private:
145  GiftiMeshIO(const Self &); // purposely not implemented
146  void operator=(const Self &); // purposely not implemented
147 
148 };
149 } // end namespace itk
150 
151 #endif
Light weight base class for most itk classes.
MapContainer< int, std::string > LabelNameContainer
A wrapper of the STL &quot;map&quot; container.
Superclass::SizeValueType SizeValueType
MapContainer< int, RGBAPixelType > LabelColorContainer
MeshIOBase Superclass
unsigned long SizeValueType
Definition: itkIntTypes.h:143
SmartPointer< Self > Pointer
GiftiMeshIO Self
Matrix< double, 4, 4 > DirectionType
RGBAPixel< float > RGBAPixelType
SmartPointer< const Self > ConstPointer
This class defines how to read and write Gifti file format.
LabelColorContainer::Pointer LabelColorContainerPointer
DirectionType m_Direction
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Abstract superclass defines mesh IO interface.
Definition: itkMeshIOBase.h:69
gifti_image * m_GiftiImage
LabelNameContainer::Pointer LabelNameContainerPointer