Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkInstantiateAccessFunctions.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
27 #ifndef mitkInstantiateAccessFunctions_h
28 #define mitkInstantiateAccessFunctions_h
29 
30 #include <itkCastImageFilter.h>
31 #include <mitkConfig.h>
32 #include <mitkImageToItk.h>
33 
34 #include <boost/preprocessor/cat.hpp>
35 #include <boost/preprocessor/expand.hpp>
36 #include <boost/preprocessor/seq/for_each.hpp>
37 #include <boost/preprocessor/seq/for_each_product.hpp>
38 #include <boost/preprocessor/seq/to_tuple.hpp>
39 
40 #ifndef DOXYGEN_SKIP
41 
42 #define InstantiateAccessFunctionImpl(r, itkImgFunc, type) BOOST_PP_CAT(InstantiateAccessFunction_, itkImgFunc) type
43 
44 // product is of the form (itkImgFunc)(short)(2)
45 #ifdef _MSC_VER
46 #define InstantiateAccessFunctionProductImpl(r, product) \
47  BOOST_PP_CAT(InstantiateAccessFunction_, BOOST_PP_SEQ_HEAD(product)) \
48  BOOST_PP_EXPAND(BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(product)))
49 #else
50 #define InstantiateAccessFunctionProductImpl(r, product) \
51  BOOST_PP_EXPAND(BOOST_PP_CAT(InstantiateAccessFunction_, BOOST_PP_SEQ_HEAD(product)) \
52  BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(product)))
53 #endif
54 
55 #endif // DOXYGEN_SKIP
56 
57 //--------------------------------- instantiation functions ------------------------------
58 
99 #define InstantiateAccessFunctionForFixedType(itkImgFunc, pixelTypeSeq, dimSeq) \
100  BOOST_PP_SEQ_FOR_EACH_PRODUCT(InstantiateAccessFunctionProductImpl, ((itkImgFunc))(pixelTypeSeq)(dimSeq))
101 
109 #define InstantiateAccessFunction(itkImgFunc) \
110  InstantiateAccessFunctionForFixedType(itkImgFunc, MITK_ACCESSBYITK_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
111 
122 #define InstantiateAccessFunctionForFixedDimension(itkImgFunc, dim) \
123  InstantiateAccessFunctionForFixedType(itkImgFunc, MITK_ACCESSBYITK_PIXEL_TYPES_SEQ, (dim))
124 
135 #define InstantiateAccessFunctionForFixedPixelType(itkImgFunc, pixelTypeSeq) \
136  InstantiateAccessFunctionForFixedType(itkImgFunc, pixelTypeSeq, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
137 
147 #define InstantiateAccessFunctionForIntegralPixelTypes(itkImgFunc) \
148  InstantiateAccessFunctionForFixedType( \
149  itkImgFunc, MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
150 
160 #define InstantiateAccessFunctionForFloatingPixelTypes(itkImgFunc) \
161  InstantiateAccessFunctionForFixedType( \
162  itkImgFunc, MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
163 
164 #endif