00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#ifndef __itkExtractImageFilterRegionCopier_h
00021
#define __itkExtractImageFilterRegionCopier_h
00022
00023
#include "itkImageToImageFilterDetail.h"
00024
00025
namespace itk
00026 {
00027
00028 namespace ImageToImageFilterDetail
00029 {
00030
00034
template <
unsigned int D1,
unsigned int D2>
00035 void ExtractImageFilterCopyRegion(
const typename
00036
BinaryUnsignedIntDispatch<D1, D2>::FirstEqualsSecondType &firstEqualsSecond,
00037
ImageRegion<D1> &destRegion,
00038
const ImageRegion<D2> &srcRegion,
00039
const ImageRegion<D1> &)
00040 {
00041 ImageToImageFilterDefaultCopyRegion<D1, D2>(firstEqualsSecond, destRegion, srcRegion);
00042 }
00043
00044
00045
00049
template <
unsigned int D1,
unsigned int D2>
00050 void ExtractImageFilterCopyRegion(
const typename
00051
BinaryUnsignedIntDispatch<D1, D2>::FirstLessThanSecondType &firstLessThanSecond,
00052
ImageRegion<D1> &destRegion,
00053
const ImageRegion<D2> &srcRegion,
00054
const ImageRegion<D1> &totalInputExtractionRegion)
00055 {
00056 ImageToImageFilterDefaultCopyRegion<D1, D2>(firstLessThanSecond, destRegion, srcRegion);
00057
00058 }
00059
00060
00077
template <
unsigned int D1,
unsigned int D2>
00078 void ExtractImageFilterCopyRegion(
const typename
00079
BinaryUnsignedIntDispatch<D1, D2>::FirstGreaterThanSecondType &,
00080
ImageRegion<D1> &destRegion,
00081
const ImageRegion<D2> &srcRegion,
00082
const ImageRegion<D1> &totalInputExtractionRegion)
00083 {
00084
00085
00086
00087
unsigned int dim;
00088
Index<D1> destIndex;
00089
Size<D1> destSize;
00090
const Index<D2> &srcIndex = srcRegion.
GetIndex();
00091
const Size<D2> &srcSize = srcRegion.
GetSize();
00092
int count = 0;
00093
for (dim=0; dim < D1; ++dim)
00094 {
00095
00096
if (!totalInputExtractionRegion.
GetSize()[dim])
00097 {
00098 destIndex[dim] = totalInputExtractionRegion.
GetIndex()[dim];
00099 destSize[dim] = 1;
00100 }
00101
00102
else
00103 {
00104 destIndex[dim] = srcIndex[count];
00105 destSize[dim] = srcSize[count];
00106 count++;
00107 }
00108 }
00109 destRegion.
SetIndex(destIndex);
00110 destRegion.
SetSize(destSize);
00111 }
00112
00113
00114
00132
template <
unsigned int D1,
unsigned int D2>
00133
class ITK_EXPORT ExtractImageFilterRegionCopier
00134 :
public ImageRegionCopier<D1, D2>
00135 {
00136
public:
00137
virtual void operator()(
ImageRegion<D1> &destRegion,
00138 const ImageRegion<D2> &srcRegion,
00139
const ImageRegion<D1> &totalInputExtractionRegion)
const
00140
{
00141 ExtractImageFilterCopyRegion<D1, D2>(
BinaryUnsignedIntDispatch<D1, D2>::ComparisonType(),
00142 destRegion, srcRegion, totalInputExtractionRegion);
00143 }
00144
00146
virtual void operator() (
ImageRegion<D1> &destRegion,
00147 const ImageRegion<D2> &srcRegion)
const
00148
{
00149
ImageRegionCopier<D1,D2>::operator()(destRegion, srcRegion);
00150 }
00151 };
00152
00153
00154
00155 }
00156 }
00157
00158
#endif