SimpleITK  
sitkElastixImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 *
3 * Copyright NumFOCUS
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 sitkElastixImageFilter_h
19 #define sitkElastixImageFilter_h
20 
22 #include "sitkCommon.h"
23 #include "sitkImage.h"
24 
25 #include <map>
26 #include <memory> // For unique_ptr.
27 #include <string>
28 #include <vector>
29 
30 namespace itk::simple {
31 
36 {
37 public:
38 
41 
44 
46 
47  typedef std::vector< Image > VectorOfImage;
48 
49  typedef std::string ParameterKeyType;
50  typedef std::string ParameterValueType;
51  typedef std::vector< ParameterValueType > ParameterValueVectorType;
52  typedef ParameterValueVectorType::iterator ParameterValueVectorIterator;
53  typedef std::map< ParameterKeyType, ParameterValueVectorType > ParameterMapType;
54  typedef std::vector< ParameterMapType > ParameterMapVectorType;
55  typedef ParameterMapType::iterator ParameterMapIterator;
56  typedef ParameterMapType::const_iterator ParameterMapConstIterator;
57 
58  std::string GetName() const;
59 
61  SITK_RETURN_SELF_TYPE_HEADER SetFixedImage( const Image& fixedImage );
62 
64  SITK_RETURN_SELF_TYPE_HEADER SetFixedImage( const VectorOfImage& fixedImages );
65 
67  SITK_RETURN_SELF_TYPE_HEADER AddFixedImage( const Image& fixedImage );
68 
70  Image& GetFixedImage( const unsigned long index );
71 
73  VectorOfImage& GetFixedImage();
74 
76  SITK_RETURN_SELF_TYPE_HEADER RemoveFixedImage( const unsigned long index );
77 
79  SITK_RETURN_SELF_TYPE_HEADER RemoveFixedImage();
80 
82  unsigned int GetNumberOfFixedImages();
83 
85  SITK_RETURN_SELF_TYPE_HEADER SetMovingImage( const Image& movingImages );
86 
88  SITK_RETURN_SELF_TYPE_HEADER SetMovingImage( const VectorOfImage& movingImage );
89 
91  SITK_RETURN_SELF_TYPE_HEADER AddMovingImage( const Image& movingImage );
92 
94  Image& GetMovingImage( const unsigned long index );
95 
97  VectorOfImage& GetMovingImage();
98 
100  SITK_RETURN_SELF_TYPE_HEADER RemoveMovingImage( const unsigned long index );
101 
103  SITK_RETURN_SELF_TYPE_HEADER RemoveMovingImage();
104 
106  unsigned int GetNumberOfMovingImages();
107 
109  SITK_RETURN_SELF_TYPE_HEADER SetFixedMask( const Image& fixedMask );
110 
112  SITK_RETURN_SELF_TYPE_HEADER SetFixedMask( const VectorOfImage& fixedMasks );
113 
115  SITK_RETURN_SELF_TYPE_HEADER AddFixedMask( const Image& fixedMask );
116 
118  Image& GetFixedMask( const unsigned long index );
119 
121  VectorOfImage& GetFixedMask();
122 
124  SITK_RETURN_SELF_TYPE_HEADER RemoveFixedMask( const unsigned long index );
125 
127  SITK_RETURN_SELF_TYPE_HEADER RemoveFixedMask();
128 
130  unsigned int GetNumberOfFixedMasks();
131 
133  SITK_RETURN_SELF_TYPE_HEADER SetMovingMask( const Image& movingMask );
134 
136  SITK_RETURN_SELF_TYPE_HEADER SetMovingMask( const VectorOfImage& movingMasks );
137 
139  SITK_RETURN_SELF_TYPE_HEADER AddMovingMask( const Image& movingMask );
140 
142  Image& GetMovingMask( const unsigned long index );
143 
145  VectorOfImage& GetMovingMask();
146 
148  SITK_RETURN_SELF_TYPE_HEADER RemoveMovingMask( const unsigned long index );
149 
151  SITK_RETURN_SELF_TYPE_HEADER RemoveMovingMask();
152 
154  unsigned int GetNumberOfMovingMasks();
155 
157  SITK_RETURN_SELF_TYPE_HEADER SetFixedPointSetFileName( const std::string fixedPointSetFileName );
158 
160  std::string GetFixedPointSetFileName();
161 
163  SITK_RETURN_SELF_TYPE_HEADER RemoveFixedPointSetFileName();
164 
166  SITK_RETURN_SELF_TYPE_HEADER SetMovingPointSetFileName( const std::string movingPointSetFileName );
167 
169  std::string GetMovingPointSetFileName();
170 
172  SITK_RETURN_SELF_TYPE_HEADER RemoveMovingPointSetFileName();
173 
175  SITK_RETURN_SELF_TYPE_HEADER SetOutputDirectory( const std::string outputDirectory );
176 
178  std::string GetOutputDirectory();
179 
181  SITK_RETURN_SELF_TYPE_HEADER RemoveOutputDirectory();
182 
184  SITK_RETURN_SELF_TYPE_HEADER SetLogFileName( const std::string logFileName );
185 
187  std::string GetLogFileName();
188 
190  SITK_RETURN_SELF_TYPE_HEADER RemoveLogFileName();
191 
193  SITK_RETURN_SELF_TYPE_HEADER SetLogToFile( const bool logToFile );
194 
196  bool GetLogToFile();
197 
199  SITK_RETURN_SELF_TYPE_HEADER LogToFileOn();
200 
202  SITK_RETURN_SELF_TYPE_HEADER LogToFileOff();
203 
205  SITK_RETURN_SELF_TYPE_HEADER SetLogToConsole( bool );
206 
208  bool GetLogToConsole();
209 
211  SITK_RETURN_SELF_TYPE_HEADER LogToConsoleOn();
212 
214  SITK_RETURN_SELF_TYPE_HEADER LogToConsoleOff();
215 
218  SITK_RETURN_SELF_TYPE_HEADER SetNumberOfThreads( int n );
219 
221  int GetNumberOfThreads();
222 
224  SITK_RETURN_SELF_TYPE_HEADER SetParameterMap( const std::string transformName, const unsigned int numberOfResolutions = 4u, const double finalGridSpacingInPhysicalUnits = 10.0 );
225 
227  SITK_RETURN_SELF_TYPE_HEADER SetParameterMap( const std::vector< std::map< std::string, std::vector< std::string > > > parameterMapVector );
228 
230  SITK_RETURN_SELF_TYPE_HEADER SetParameterMap( const std::map< std::string, std::vector< std::string > > parameterMap );
231 
233  SITK_RETURN_SELF_TYPE_HEADER AddParameterMap( const std::map< std::string, std::vector< std::string > > parameterMap );
234 
236  std::vector< std::map< std::string, std::vector< std::string > > > GetParameterMap();
237 
239  std::map< std::string, std::vector< std::string > > GetDefaultParameterMap( const std::string transformName, const unsigned int numberOfResolutions = 4, const double finalGridSpacingInPhysicalUnits = 10.0 );
240 
242  unsigned int GetNumberOfParameterMaps();
243 
245  SITK_RETURN_SELF_TYPE_HEADER SetParameter( const std::string key, const std::string value );
246 
248  SITK_RETURN_SELF_TYPE_HEADER SetParameter( const std::string key, const std::vector< std::string > value );
249 
251  SITK_RETURN_SELF_TYPE_HEADER SetParameter( const unsigned int index, const std::string key, const std::string value );
252 
254  SITK_RETURN_SELF_TYPE_HEADER SetParameter( const unsigned int index, const std::string key, const std::vector< std::string > value );
255 
257  SITK_RETURN_SELF_TYPE_HEADER AddParameter( const std::string key, const std::string value );
258 
260  SITK_RETURN_SELF_TYPE_HEADER AddParameter( const unsigned int index, const std::string key, const std::string value );
261 
263  SITK_RETURN_SELF_TYPE_HEADER AddParameter( const std::string key, const std::vector< std::string > value );
264 
266  SITK_RETURN_SELF_TYPE_HEADER AddParameter( const unsigned int index, const std::string key, const std::vector< std::string > value );
267 
269  std::vector< std::string > GetParameter( const std::string key );
270 
272  std::vector< std::string > GetParameter( const unsigned int index, const std::string key );
273 
275  SITK_RETURN_SELF_TYPE_HEADER RemoveParameter( const std::string key );
276 
278  SITK_RETURN_SELF_TYPE_HEADER RemoveParameter( const unsigned int index, const std::string key );
279 
281  SITK_RETURN_SELF_TYPE_HEADER SetInitialTransformParameterFileName( const std::string initialTransformParmaterFileName );
282 
284  std::string GetInitialTransformParameterFileName();
285 
287  SITK_RETURN_SELF_TYPE_HEADER RemoveInitialTransformParameterFileName();
288 
290  std::map< std::string, std::vector< std::string > > ReadParameterFile( const std::string filename );
291 
293  SITK_RETURN_SELF_TYPE_HEADER WriteParameterFile( const std::map< std::string, std::vector< std::string > > parameterMap, const std::string filename );
294 
300  Image Execute();
301 
303  std::vector< std::map< std::string, std::vector< std::string > > > GetTransformParameterMap();
304 
306  std::map< std::string, std::vector< std::string > > GetTransformParameterMap( const unsigned int index );
307 
309  Image GetResultImage();
310 
312  SITK_RETURN_SELF_TYPE_HEADER PrintParameterMap();
313 
315  SITK_RETURN_SELF_TYPE_HEADER PrintParameterMap( const ParameterMapType parameterMapVector );
316 
318  SITK_RETURN_SELF_TYPE_HEADER PrintParameterMap( const ParameterMapVectorType parameterMapVector );
319 
320 private:
321 
322  class ElastixImageFilterImpl;
323  const std::unique_ptr<ElastixImageFilterImpl> m_Pimple;
324 
325 };
326 
327 // Procedural Interface
328 SITKElastix_EXPORT std::map< std::string, std::vector< std::string > > GetDefaultParameterMap( const std::string transform, const unsigned int numberOfResolutions = 4, const double finalGridSpacingInPhysicalUnits = 8.0 );
329 SITKElastix_EXPORT std::map< std::string, std::vector< std::string > > ReadParameterFile( const std::string filename );
330 SITKElastix_EXPORT void WriteParameterFile( const std::map< std::string, std::vector< std::string > > parameterMap, const std::string filename );
331 SITKElastix_EXPORT void PrintParameterMap( const std::map< std::string, std::vector< std::string > > parameterMap );
332 SITKElastix_EXPORT void PrintParameterMap( const std::vector< std::map< std::string, std::vector< std::string > > > parameterMapVector );
333 SITKElastix_EXPORT Image Elastix( const Image& fixedImage, const Image& movingImage, const bool logToConsole = false, const bool logToFile = false, const std::string outputDirectory = "." );
334 SITKElastix_EXPORT Image Elastix( const Image& fixedImage, const Image& movingImage, const Image& fixedMask, const Image& movingMask, const bool logToConsole = false, const bool logToFile = false, const std::string outputDirectory = "." );
335 SITKElastix_EXPORT Image Elastix( const Image& fixedImage, const Image& movingImage, const std::string defaultParameterMapName, const bool logToConsole = false, const bool logToFile = false, const std::string outputDirectory = "." );
336 SITKElastix_EXPORT Image Elastix( const Image& fixedImage, const Image& movingImage, const std::map< std::string, std::vector< std::string > > parameterMap, const bool logToConsole = false, const bool logToFile = false, const std::string outputDirectory = "." );
337 SITKElastix_EXPORT Image Elastix( const Image& fixedImage, const Image& movingImage, const std::vector< std::map< std::string, std::vector< std::string > > > parameterMapVector, const bool logToConsole = false, const bool logToFile = false, const std::string outputDirectory = "." );
338 SITKElastix_EXPORT Image Elastix( const Image& fixedImage, const Image& movingImage, const std::string defaultParameterMapName, const Image& fixedMask, const Image& movingMask, const bool logToConsole = false, const bool logToFile = false, const std::string outputDirectory = "." );
339 SITKElastix_EXPORT Image Elastix( const Image& fixedImage, const Image& movingImage, const std::map< std::string, std::vector< std::string > >, const Image& fixedMask, const Image& movingMask, const bool logToConsole = false, const bool logToFile = false, const std::string outputDirectory = "." );
340 SITKElastix_EXPORT Image Elastix( const Image& fixedImage, const Image& movingImage, std::vector< std::map< std::string, std::vector< std::string > > > parameterMapVector, const Image& fixedMask, const Image& movingMask, const bool logToConsole = false, const bool logToFile = false, const std::string outputDirectory = "." );
341 
342 }
343 
344 #endif // sitkElastixImageFilter_h
itk::simple::Image
The Image class for SimpleITK.
Definition: sitkImage.h:76
itk::simple::ElastixImageFilter::ParameterValueVectorType
std::vector< ParameterValueType > ParameterValueVectorType
Definition: sitkElastixImageFilter.h:51
itk::simple::ReadParameterFile
SITKElastix_EXPORT std::map< std::string, std::vector< std::string > > ReadParameterFile(const std::string filename)
itk::simple::ElastixImageFilter::ParameterMapIterator
ParameterMapType::iterator ParameterMapIterator
Definition: sitkElastixImageFilter.h:55
sitkCommon.h
sitkImage.h
itk::simple::ElastixImageFilter::ParameterValueType
std::string ParameterValueType
Definition: sitkElastixImageFilter.h:50
itk::simple::ElastixImageFilter::ParameterKeyType
std::string ParameterKeyType
Definition: sitkElastixImageFilter.h:49
SITKElastix_EXPORT
#define SITKElastix_EXPORT
Definition: sitkElastixTransformixWrappers.h:32
itk::simple::ElastixImageFilter::VectorOfImage
std::vector< Image > VectorOfImage
Definition: sitkElastixImageFilter.h:47
itk::simple::ElastixImageFilter
The class that wraps the elastix registration library.
Definition: sitkElastixImageFilter.h:35
sitkElastixTransformixWrappers.h
itk::simple::GetDefaultParameterMap
SITKElastix_EXPORT std::map< std::string, std::vector< std::string > > GetDefaultParameterMap(const std::string transform, const unsigned int numberOfResolutions=4, const double finalGridSpacingInPhysicalUnits=8.0)
itk::simple::ElastixImageFilter::ParameterMapConstIterator
ParameterMapType::const_iterator ParameterMapConstIterator
Definition: sitkElastixImageFilter.h:56
itk::simple::ElastixImageFilter::Self
ElastixImageFilter Self
Definition: sitkElastixImageFilter.h:45
itk::simple::ElastixImageFilter::ParameterMapType
std::map< ParameterKeyType, ParameterValueVectorType > ParameterMapType
Definition: sitkElastixImageFilter.h:53
itk::simple::WriteParameterFile
SITKElastix_EXPORT void WriteParameterFile(const std::map< std::string, std::vector< std::string > > parameterMap, const std::string filename)
itk::simple::ElastixImageFilter::m_Pimple
const std::unique_ptr< ElastixImageFilterImpl > m_Pimple
Definition: sitkElastixImageFilter.h:322
itk::simple::Elastix
SITKElastix_EXPORT Image Elastix(const Image &fixedImage, const Image &movingImage, const bool logToConsole=false, const bool logToFile=false, const std::string outputDirectory=".")
itk::simple::ElastixImageFilter::ParameterMapVectorType
std::vector< ParameterMapType > ParameterMapVectorType
Definition: sitkElastixImageFilter.h:54
itk::simple::ElastixImageFilter::ParameterValueVectorIterator
ParameterValueVectorType::iterator ParameterValueVectorIterator
Definition: sitkElastixImageFilter.h:52
itk::simple
Definition: sitkAdditionalProcedures.h:28
itk::simple::PrintParameterMap
SITKElastix_EXPORT void PrintParameterMap(const std::map< std::string, std::vector< std::string > > parameterMap)