Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkITKUtility.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Copyright Brigham and Women's Hospital (BWH) All Rights Reserved.
4 
5  See COPYRIGHT.txt
6  or http://www.slicer.org/copyright/copyright.txt for details.
7 
8  Program: vtkITK
9  Module: $HeadURL$
10  Date: $Date$
11  Version: $Revision$
12 
13 ==========================================================================*/
14 
15 #ifndef __vtkITKUtility_h
16 #define __vtkITKUtility_h
17 
18 #include "vtkObjectFactory.h"
19 #include "vtkSetGet.h"
20 
25 template <typename ITK_Exporter, typename VTK_Importer>
26 void ConnectPipelines(ITK_Exporter exporter, VTK_Importer* importer)
27 {
28  importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
29  importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
30  importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
31  importer->SetSpacingCallback(exporter->GetSpacingCallback());
32  importer->SetOriginCallback(exporter->GetOriginCallback());
33  importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
34  importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
35  importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
36  importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
37  importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
38  importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
39  importer->SetCallbackUserData(exporter->GetCallbackUserData());
40 }
41 
46 template <typename VTK_Exporter, typename ITK_Importer>
47 void ConnectPipelines(VTK_Exporter* exporter, ITK_Importer importer)
48 {
49  importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
50  importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
51  importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
52  importer->SetSpacingCallback(exporter->GetSpacingCallback());
53  importer->SetOriginCallback(exporter->GetOriginCallback());
54  importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
55  importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
56  importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
57  importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
58  importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
59  importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
60  importer->SetCallbackUserData(exporter->GetCallbackUserData());
61 }
62 
63 
64 #define DelegateSetMacro(name,arg) DelegateITKInputMacro(Set##name,arg)
65 #define DelegateITKInputMacro(name,arg) \
66 if ( 1 ) { \
67  vtkDebugMacro( << this->GetClassName() << " (" << this << "): setting " #name " to " << #arg ); \
68  ImageFilterType* tempFilter = dynamic_cast<ImageFilterType*> ( this->m_Filter.GetPointer() ); \
69  if ( tempFilter ) \
70  { \
71  tempFilter->name ( arg ); \
72  this->Modified(); \
73  } \
74  }
75 
76 #define DelegateGetMacro(name) DelegateITKOutputMacro (Get##name)
77 #define DelegateITKOutputMacro(name) \
78 if ( 1 ) { \
79  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " #name ); \
80  ImageFilterType* tempFilter = dynamic_cast<ImageFilterType*> ( this->m_Filter.GetPointer() ); \
81  if ( tempFilter ) \
82  { \
83  return tempFilter->name (); \
84  } \
85  else \
86  { \
87  vtkErrorMacro ( << this->GetClassName() << " Error getting " #name " Dynamic cast returned 0" ); \
88  return 0; \
89  } \
90  }
91 
92 
96 
101 
105 
115 
116 #endif
void ConnectPipelines(ITK_Exporter exporter, VTK_Importer *importer)
Definition: vtkITKUtility.h:26