ITK  4.10.0
Insight Segmentation and Registration Toolkit
itkMINCTransformIO.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 itkMINCTransformIO_h
19 #define itkMINCTransformIO_h
20 
21 #include "ITKIOTransformMINCExport.h"
22 
23 #include "itkTransformIOBase.h"
24 
25 #include <string>
26 #include <vector>
27 #include <itk_minc2.h>
29 
30 namespace itk
31 {
32 
42 template<typename TParametersValueType>
43 class MINCTransformIOTemplate: public TransformIOBaseTemplate<TParametersValueType>
44 {
45 public:
50 
56 
58 
61 
64  itkNewMacro( Self );
66 
69  virtual bool CanReadFile( const char * fileName ) ITK_OVERRIDE;
70 
73  virtual bool CanWriteFile( const char * fileName ) ITK_OVERRIDE;
74 
76  virtual void Read() ITK_OVERRIDE;
77 
78  virtual void Write() ITK_OVERRIDE;
79 
80 protected:
82  virtual ~MINCTransformIOTemplate();
83 
84  VIO_General_transform m_XFM;
86 
87 private:
88  void _cleanup();
89  void WriteOneTransform(const int transformIndex,
90  const TransformType *transform,
91  std::vector<VIO_General_transform> &_xfm,
92  const char * xfm_file_base,int & serial);
93 
94  void ReadOneTransform(VIO_General_transform *xfm);
95 };
96 
98 typedef MINCTransformIOTemplate<double> MINCTransformIO;
99 
100 } // end namespace itk
101 
102 // Note: Explicit instantiation is done in itkMINCTransformIO.cxx
103 
104 #endif // itkMINCTransformIO_h
105 
107 #ifndef ITK_TEMPLATE_EXPLICIT_MINCTransformIO
108 // Explicit instantiation is required to ensure correct dynamic_cast
109 // behavior across shared libraries.
110 //
111 // IMPORTANT: Since within the same compilation unit,
112 // ITK_TEMPLATE_EXPLICIT_<classname> defined and undefined states
113 // need to be considered. This code *MUST* be *OUTSIDE* the header
114 // guards.
115 //
116 # if defined( ITKIOTransformMINC_EXPORTS )
117 // We are building this library
118 # define ITKIOTransformMINC_EXPORT_EXPLICIT
119 # else
120 // We are using this library
121 # define ITKIOTransformMINC_EXPORT_EXPLICIT ITKIOTransformMINC_EXPORT
122 # endif
123 namespace itk
124 {
125 
126 #ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
127  ITK_GCC_PRAGMA_DIAG_PUSH()
128 #endif
129 ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")
130 
133 
134 #ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
135  ITK_GCC_PRAGMA_DIAG_POP()
136 #else
137  ITK_GCC_PRAGMA_DIAG(warning "-Wattributes")
138 #endif
139 
140 } // end namespace itk
141 # undef ITKIOTransformMINC_EXPORT_EXPLICIT
142 #endif
MINCTransformIOTemplate Self
MatrixOffsetTransformBaseType::OffsetType OffsetType
Superclass::ConstTransformListType ConstTransformListType
void ReadOneTransform(VIO_General_transform *xfm)
Superclass::TransformListType TransformListType
Read and write transforms in Minc XFM Format.
STL namespace.
#define ITKIOTransformMINC_EXPORT_EXPLICIT
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes...
Definition: itkArray.h:30
virtual bool CanWriteFile(const char *fileName) override
Abstract superclass defining the Transform IO interface.
Superclass::TransformPointer TransformPointer
template class ITKIOTransformMINC_EXPORT_EXPLICIT MINCTransformIOTemplate< double >
template class ITKIOTransformMINC_EXPORT_EXPLICIT MINCTransformIOTemplate< float >
TransformType::Pointer TransformPointer
virtual void Read() override
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
Class to hold and manage different parameter types used during optimization.
SmartPointer< Self > Pointer
std::list< TransformPointer > TransformListType
TransformBaseTemplate< ParametersValueType > TransformType
MatrixOffsetTransformBaseType::MatrixType MatrixType
virtual void Write() override
std::list< ConstTransformPointer > ConstTransformListType
virtual bool CanReadFile(const char *fileName) override
void WriteOneTransform(const int transformIndex, const TransformType *transform, std::vector< VIO_General_transform > &_xfm, const char *xfm_file_base, int &serial)
TransformType::ParametersType ParametersType
SmartPointer< const Self > ConstPointer
MatrixOffsetTransformBase< TParametersValueType, 3, 3 > MatrixOffsetTransformBaseType
Superclass::TransformType TransformType
VIO_General_transform m_XFM
TransformIOBaseTemplate< TParametersValueType > Superclass