Orfeo Toolbox  3.16
itkExtractImageFilterRegionCopier.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkExtractImageFilterRegionCopier.h,v $
5  Language: C++
6  Date: $Date: 2008-10-15 12:45:53 $
7  Version: $Revision: 1.8 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  Portions of this code are covered under the VTK copyright.
13  See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
14 
15  This software is distributed WITHOUT ANY WARRANTY; without even
16  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
17  PURPOSE. See the above copyright notices for more information.
18 
19 =========================================================================*/
20 #ifndef __itkExtractImageFilterRegionCopier_h
21 #define __itkExtractImageFilterRegionCopier_h
22 
24 
25 namespace itk
26 {
27 
28 namespace ImageToImageFilterDetail
29 {
30 
34 template <unsigned int T1, unsigned int T2>
35 void ExtractImageFilterCopyRegion(const typename
37  ImageRegion<T1> &destRegion,
38  const ImageRegion<T2> &srcRegion,
39  const ImageRegion<T1> &)
40 {
41  ImageToImageFilterDefaultCopyRegion<T1, T2>(firstEqualsSecond, destRegion, srcRegion);
42 }
43 
44 
45 
49 template <unsigned int T1, unsigned int T2>
50 void ExtractImageFilterCopyRegion(const typename
52  ImageRegion<T1> &destRegion,
53  const ImageRegion<T2> &srcRegion,
54  const ImageRegion<T1> &totalInputExtractionRegion)
55 {
56  ImageToImageFilterDefaultCopyRegion<T1, T2>(firstLessThanSecond, destRegion, srcRegion);
57 
58 }
59 
60 
77 template <unsigned int T1, unsigned int T2>
78 void ExtractImageFilterCopyRegion(const typename
80  ImageRegion<T1> &destRegion,
81  const ImageRegion<T2> &srcRegion,
82  const ImageRegion<T1> &totalInputExtractionRegion)
83 {
84  // Source dimension is less than the destination dimension, so look
85  // at the m_TotalExtractionRegion and see what values in size are 0.
86  // With these values, lock the destRegion.Index to the corresponding index
87  unsigned int dim;
88  Index<T1> destIndex;
89  Size<T1> destSize;
90  const Index<T2> &srcIndex = srcRegion.GetIndex();
91  const Size<T2> &srcSize = srcRegion.GetSize();
92  int count = 0;
93  for (dim=0; dim < T1; ++dim)
94  {
95  //for dimensions to be removed
96  if (!totalInputExtractionRegion.GetSize()[dim])
97  {
98  destIndex[dim] = totalInputExtractionRegion.GetIndex()[dim];
99  destSize[dim] = 1;
100  }
101  //for all other dimension
102  else
103  {
104  destIndex[dim] = srcIndex[count];
105  destSize[dim] = srcSize[count];
106  count++;
107  }
108  }
109  destRegion.SetIndex(destIndex);
110  destRegion.SetSize(destSize);
111 }
112 
130 template <unsigned int T1, unsigned int T2>
132  : public ImageRegionCopier<T1, T2>
133 {
134 public:
135  virtual void operator()(ImageRegion<T1> &destRegion,
136  const ImageRegion<T2> &srcRegion,
137  const ImageRegion<T1> &totalInputExtractionRegion) const
138  {
139  typedef typename BinaryUnsignedIntDispatch<T1, T2>::ComparisonType ComparisonType;
140  ExtractImageFilterCopyRegion<T1, T2>(ComparisonType(),
141  destRegion, srcRegion, totalInputExtractionRegion);
142  }
143 
145  virtual void operator() (ImageRegion<T1> &destRegion,
146  const ImageRegion<T2> &srcRegion) const
147  {
148  ImageRegionCopier<T1,T2>::operator()(destRegion, srcRegion);
149  }
150 };
151 
152 } //end namespace ImageToImageFilterDetail
153 } //end namespace itk
154 
155 #endif

Generated at Sat Feb 2 2013 23:36:22 for Orfeo Toolbox with doxygen 1.8.1.1