1 /*=========================================================================
4 Module: $RCSfile: bbtkVtkBlackBoxMacros.h,v $
6 Date: $Date: 2008/05/07 06:31:37 $
7 Version: $Revision: 1.1 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
22 * \brief Defines macros for the creation of vtk object inherited black boxes
24 #ifndef __bbtkVtkBlackBoxMacros_h__
25 #define __bbtkVtkBlackBoxMacros_h__
27 //===========================================================================
28 //============================================================================
29 // VTK Specific macros
30 //===========================================================================
31 //===========================================================================
34 //===========================================================================
37 // { return GetInput(); /*PARENT::GetInput();*/ } \
38 // { PARENT::SetInput( /*(vtkDataObject*)*/ d); \
42 /// Declares a vtkImageAlgorithm-inherited AtomicBlackBox input
43 #define BBTK_DECLARE_VTK_IMAGE_ALGORITHM_INPUT(PARENT,NAME,TYPE) \
45 TYPE bbGetInput##NAME () \
46 { return GetImageDataInput(0); /*PARENT::GetInput();*/ } \
47 void bbSetInput##NAME (TYPE d) \
48 { PARENT::SetInput( (vtkDataObject*) d); \
49 /*bbSetModifiedStatus();*/ }
50 //===========================================================================
51 /// Declares a vtkPolyDataAlgorithm-inherited AtomicBlackBox input
52 #define BBTK_DECLARE_VTK_POLY_DATA_ALGORITHM_INPUT(PARENT,NAME,TYPE) \
54 TYPE bbGetInput##NAME () \
55 { return GetPolyDataInput(0); /*PARENT::GetInput();*/ } \
56 void bbSetInput##NAME (TYPE d) \
57 { PARENT::SetInput( (vtkDataObject*) d); \
58 /*bbSetModifiedStatus();*/ }
59 //===========================================================================
61 //===========================================================================
62 /// Declares a vtkImageAlgorithm-inherited AtomicBlackBox output
63 #define BBTK_DECLARE_VTK_OUTPUT(PARENT,NAME,TYPE) \
65 TYPE bbGetOutput##NAME () \
66 { return PARENT::GetOutput(); } \
67 void bbSetOutput##NAME (TYPE d) \
68 { /*PARENT::GetOutput() = d;*/ }
69 //===========================================================================
71 //===========================================================================
72 /// Declares a vtkAlgorithm-inherited AtomicBlackBox input
73 #define BBTK_DECLARE_VTK_INPUT(PARENT,NAME,TYPE) \
75 TYPE bbGetInput##NAME () \
76 { return dynamic_cast<TYPE>(PARENT::GetInput()); } \
77 void bbSetInput##NAME (TYPE d) \
78 { PARENT::SetInput( (vtkDataObject*) d); /*PARENT::GetOutput() = d;*/ }
80 //===========================================================================
82 //===========================================================================
83 /// Declares an AtomicBlackBox input corresponding to an
84 /// inherited vtk parameter
85 /// which was declared by vtkSetMacro/vtkGetMacro
86 /// The NAME **MUST** be the same than the vtk parameter name
87 #define BBTK_DECLARE_VTK_PARAM(PARENT,NAME,TYPE) \
89 TYPE bbGetInput##NAME () \
90 { return PARENT::Get##NAME(); } \
91 void bbSetInput##NAME (TYPE d) \
92 { PARENT::Set##NAME(d); \
93 /*bbSetModifiedStatus();*/ }
94 //===========================================================================
97 //===========================================================================
98 #define BBTK_VTK_DELETE(VTKPARENT) \
100 bbGetOutputOut()->SetSource(NULL); \
101 VTKPARENT::Delete(); }
102 //===========================================================================
105 //===========================================================================
107 //===========================================================================