Medical Imaging Interaction Toolkit  2018.4.99-bd7b41ba
Medical Imaging Interaction Toolkit
mitkImageCastPart3.cpp
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 
13 #include <mitkImageCast.txx>
14 
15 #include <itkDiffusionTensor3D.h>
16 #include <itkRGBPixel.h>
17 #include <itkVector.h>
18 
19 namespace mitk
20 {
21  typedef itk::Image<itk::RGBPixel<unsigned char>, 2> itkImageRGBUC2;
22  typedef itk::Image<itk::DiffusionTensor3D<float>, 2> itkImageDTIF2;
23  typedef itk::Image<itk::DiffusionTensor3D<double>, 2> itkImageDTID2;
24 
25  template void MITKCORE_EXPORT _CastToItkImage2Access(const itkImageRGBUC2 *, itk::SmartPointer<itkImageRGBUC2> &);
26  template void MITKCORE_EXPORT _CastToItkImage2Access(const itkImageDTIF2 *, itk::SmartPointer<itkImageDTIF2> &);
27  template void MITKCORE_EXPORT _CastToItkImage2Access(const itkImageDTID2 *, itk::SmartPointer<itkImageDTID2> &);
28 
29  typedef itk::Image<itk::RGBPixel<unsigned char>, 3> itkImageRGBUC3;
30  typedef itk::Image<itk::DiffusionTensor3D<float>, 3> itkImageDTIF3;
31  typedef itk::Image<itk::DiffusionTensor3D<double>, 3> itkImageDTID3;
32 
33  template void MITKCORE_EXPORT _CastToItkImage2Access(const itkImageRGBUC3 *, itk::SmartPointer<itkImageRGBUC3> &);
34  template void MITKCORE_EXPORT _CastToItkImage2Access(const itkImageDTIF3 *, itk::SmartPointer<itkImageDTIF3> &);
35  template void MITKCORE_EXPORT _CastToItkImage2Access(const itkImageDTID3 *, itk::SmartPointer<itkImageDTID3> &);
36 
37 #define CAST_HUNDRED_VECS(HUN) \
38  CAST_TEN_VECS(HUN) \
39  CAST_TEN_VECS(HUN + 10) \
40  CAST_TEN_VECS(HUN + 20) \
41  CAST_TEN_VECS(HUN + 30) \
42  CAST_TEN_VECS(HUN + 40) \
43  CAST_TEN_VECS(HUN + 50) \
44  CAST_TEN_VECS(HUN + 60) \
45  CAST_TEN_VECS(HUN + 70) \
46  CAST_TEN_VECS(HUN + 80) \
47  CAST_TEN_VECS(HUN + 90)
48 
49 #define CAST_TEN_VECS(TEN) \
50  CAST_N_VEC(TEN + 1) \
51  CAST_N_VEC(TEN + 2) \
52  CAST_N_VEC(TEN + 3) \
53  CAST_N_VEC(TEN + 4) \
54  CAST_N_VEC(TEN + 5) \
55  CAST_N_VEC(TEN + 6) \
56  CAST_N_VEC(TEN + 7) \
57  CAST_N_VEC(TEN + 8) \
58  CAST_N_VEC(TEN + 9) \
59  CAST_N_VEC(TEN + 10)
60 
61 #define CAST_N_VEC(N_DIRS) \
62  _CAST_N_VEC(N_DIRS, double) \
63  _CAST_N_VEC(N_DIRS, float) \
64  _CAST_N_VEC(N_DIRS, short)
65 
66 #define _CAST_N_VEC(N_DIRS, PIXTYPE) \
67  template void MITKCORE_EXPORT _CastToItkImage2Access( \
68  const itk::Image<itk::Vector<PIXTYPE, N_DIRS>, 2> *, \
69  itk::SmartPointer<itk::Image<itk::Vector<PIXTYPE, N_DIRS>, 2>> &); \
70  template void MITKCORE_EXPORT _CastToItkImage2Access( \
71  const itk::Image<itk::Vector<PIXTYPE, N_DIRS>, 3> *, \
72  itk::SmartPointer<itk::Image<itk::Vector<PIXTYPE, N_DIRS>, 3>> &);
73 
74  // the following lines allow for fixed-size vector images up to a certain size limit
75  // (commented out for shorter compile times)
76 
77  // CAST_HUNDRED_VECS(0)
78  // CAST_HUNDRED_VECS(100)
79  // CAST_HUNDRED_VECS(200)
80  // CAST_HUNDRED_VECS(300)
81 
82  // allow for fixed-size vectors of specific length
83  // (inspired by itkPointshell.cpp, precompiled ODF configs)
84 
85  // CAST_TEN_VECS(0)
86  // CAST_N_VEC(11)
87  // CAST_N_VEC(12)
88  CAST_N_VEC(2)
89  CAST_N_VEC(3)
90  CAST_N_VEC(6)
91  CAST_N_VEC(15)
92  CAST_N_VEC(28)
93  CAST_N_VEC(42)
94  CAST_N_VEC(45)
95  CAST_N_VEC(91)
96  CAST_N_VEC(92)
97  CAST_N_VEC(162)
98  CAST_N_VEC(252)
99  CAST_N_VEC(362)
100  CAST_N_VEC(492)
101  CAST_N_VEC(642)
102  CAST_N_VEC(812)
103  CAST_N_VEC(1002)
104 }
itk::Image< itk::DiffusionTensor3D< float >, 2 > itkImageDTIF2
itk::Image< itk::DiffusionTensor3D< double >, 3 > itkImageDTID3
#define MITKCORE_EXPORT
itk::Image< itk::RGBPixel< unsigned char >, 2 > itkImageRGBUC2
DataCollection - Class to facilitate loading/accessing structured data.
itk::Image< itk::DiffusionTensor3D< float >, 3 > itkImageDTIF3
itk::Image< itk::DiffusionTensor3D< double >, 2 > itkImageDTID2
#define CAST_N_VEC(N_DIRS)
void _CastToItkImage2Access(const itk::Image< TPixel, VImageDimension > *itkInputImage, itk::SmartPointer< ItkOutputImageType > &itkOutputImage)
itk::Image< itk::RGBPixel< unsigned char >, 3 > itkImageRGBUC3