VMTK
Loading...
Searching...
No Matches
vtkITKUtility.h File Reference

Helper templates and macros for connecting VTK and ITK image pipelines (superseded by vtkvmtkITKUtility.h; kept for compatibility). More...

#include "vtkObjectFactory.h"
#include "vtkSetGet.h"
Include dependency graph for vtkITKUtility.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DelegateSetMacro(name, arg)
#define DelegateITKInputMacro(name, arg)
#define DelegateGetMacro(name)
#define DelegateITKOutputMacro(name)

Functions

template<typename ITK_Exporter, typename VTK_Importer>
void ConnectPipelines (ITK_Exporter exporter, VTK_Importer *importer)
template<typename VTK_Exporter, typename ITK_Importer>
void ConnectPipelines (VTK_Exporter *exporter, ITK_Importer importer)

Detailed Description

Helper templates and macros for connecting VTK and ITK image pipelines (superseded by vtkvmtkITKUtility.h; kept for compatibility).

ConnectPipelines() wires the callback-based itk::VTKImageExport / vtkImageImport (or vtkImageExport / itk::VTKImageImport) pair so that updates propagate across the VTK/ITK pipeline boundary without copying image data. DelegateITKInputMacro/DelegateITKOutputMacro (and their DelegateSetMacro/DelegateGetMacro shorthands) generate Set/Get methods that forward to the wrapped ITK filter held in m_Filter.

Definition in file vtkITKUtility.h.

Macro Definition Documentation

◆ DelegateSetMacro

#define DelegateSetMacro ( name,
arg )
Value:
DelegateITKInputMacro(Set##name,arg)
#define DelegateITKInputMacro(name, arg)

Definition at line 74 of file vtkITKUtility.h.

◆ DelegateITKInputMacro

#define DelegateITKInputMacro ( name,
arg )
Value:
if ( 1 ) { \
vtkDebugMacro( << this->GetClassName() << " (" << this << "): setting " #name " to " << #arg ); \
ImageFilterType* tempFilter = dynamic_cast<ImageFilterType*> ( this->m_Filter.GetPointer() ); \
if ( tempFilter ) \
{ \
tempFilter->name ( arg ); \
this->Modified(); \
} \
}

Definition at line 75 of file vtkITKUtility.h.

75#define DelegateITKInputMacro(name,arg) \
76if ( 1 ) { \
77 vtkDebugMacro( << this->GetClassName() << " (" << this << "): setting " #name " to " << #arg ); \
78 ImageFilterType* tempFilter = dynamic_cast<ImageFilterType*> ( this->m_Filter.GetPointer() ); \
79 if ( tempFilter ) \
80 { \
81 tempFilter->name ( arg ); \
82 this->Modified(); \
83 } \
84 }

◆ DelegateGetMacro

#define DelegateGetMacro ( name)
Value:
#define DelegateITKOutputMacro(name)

Definition at line 86 of file vtkITKUtility.h.

◆ DelegateITKOutputMacro

#define DelegateITKOutputMacro ( name)
Value:
if ( 1 ) { \
vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " #name ); \
ImageFilterType* tempFilter = dynamic_cast<ImageFilterType*> ( this->m_Filter.GetPointer() ); \
if ( tempFilter ) \
{ \
return tempFilter->name (); \
} \
else \
{ \
vtkErrorMacro ( << this->GetClassName() << " Error getting " #name " Dynamic cast returned 0" ); \
return 0; \
} \
}

Definition at line 87 of file vtkITKUtility.h.

87#define DelegateITKOutputMacro(name) \
88if ( 1 ) { \
89 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " #name ); \
90 ImageFilterType* tempFilter = dynamic_cast<ImageFilterType*> ( this->m_Filter.GetPointer() ); \
91 if ( tempFilter ) \
92 { \
93 return tempFilter->name (); \
94 } \
95 else \
96 { \
97 vtkErrorMacro ( << this->GetClassName() << " Error getting " #name " Dynamic cast returned 0" ); \
98 return 0; \
99 } \
100 }

Function Documentation

◆ ConnectPipelines() [1/2]

template<typename ITK_Exporter, typename VTK_Importer>
void ConnectPipelines ( ITK_Exporter exporter,
VTK_Importer * importer )

This function will connect the given itk::VTKImageExport filter to the given vtkImageImport filter.

Definition at line 36 of file vtkITKUtility.h.

37{
38 importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
39 importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
40 importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
41 importer->SetSpacingCallback(exporter->GetSpacingCallback());
42 importer->SetOriginCallback(exporter->GetOriginCallback());
43 importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
44 importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
45 importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
46 importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
47 importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
48 importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
49 importer->SetCallbackUserData(exporter->GetCallbackUserData());
50}

◆ ConnectPipelines() [2/2]

template<typename VTK_Exporter, typename ITK_Importer>
void ConnectPipelines ( VTK_Exporter * exporter,
ITK_Importer importer )

This function will connect the given vtkImageExport filter to the given itk::VTKImageImport filter.

Definition at line 57 of file vtkITKUtility.h.

58{
59 importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
60 importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
61 importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
62 importer->SetSpacingCallback(exporter->GetSpacingCallback());
63 importer->SetOriginCallback(exporter->GetOriginCallback());
64 importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
65 importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
66 importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
67 importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
68 importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
69 importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
70 importer->SetCallbackUserData(exporter->GetCallbackUserData());
71}