18 #ifndef itkImageAlgorithm_h
19 #define itkImageAlgorithm_h
23 #ifdef ITK_HAS_STLTR1_TYPE_TRAITS
24 # include <type_traits>
25 #elif defined ITK_HAS_STLTR1_TR1_TYPE_TRAITS
26 # include <tr1/type_traits>
31 #ifdef ITK_HAS_CPP11_TYPETRAITS
32 # define ITK_STD_TR1_NAMESPACE std
34 # define ITK_STD_TR1_NAMESPACE std::tr1
40 template <
typename TPixelType,
unsigned int VImageDimension >
class VectorImage;
56 #if defined(ITK_HAS_STLTR1_TR1_TYPE_TRAITS) || defined(ITK_HAS_STLTR1_TYPE_TRAITS)
57 typedef ITK_STD_TR1_NAMESPACE::true_type
TrueType;
58 typedef ITK_STD_TR1_NAMESPACE::false_type
FalseType;
85 template<
typename InputImageType,
typename OutputImageType>
86 static void Copy(
const InputImageType *inImage, OutputImageType *outImage,
87 const typename InputImageType::RegionType &inRegion,
88 const typename OutputImageType::RegionType &outRegion )
95 template<
typename TPixel1,
typename TPixel2,
unsigned int VImageDimension>
104 #
if defined(ITK_HAS_STLTR1_TR1_TYPE_TRAITS) || defined(ITK_HAS_STLTR1_TYPE_TRAITS)
105 , ITK_STD_TR1_NAMESPACE::is_convertible<
typename _ImageType1::PixelType,
106 typename _ImageType2::PixelType>()
116 template<
typename TPixel1,
typename TPixel2,
unsigned int VImageDimension>
117 static void Copy(
const VectorImage<TPixel1, VImageDimension> * inImage,
118 VectorImage<TPixel2, VImageDimension> * outImage,
119 const typename VectorImage<TPixel1, VImageDimension>::RegionType &inRegion,
120 const typename VectorImage<TPixel2, VImageDimension>::RegionType &outRegion )
122 typedef VectorImage<TPixel1, VImageDimension> _ImageType1;
123 typedef VectorImage<TPixel2, VImageDimension> _ImageType2;
125 #
if defined(ITK_HAS_STLTR1_TR1_TYPE_TRAITS) || defined(ITK_HAS_STLTR1_TYPE_TRAITS)
126 , ITK_STD_TR1_NAMESPACE::is_convertible<
typename _ImageType1::PixelType,
127 typename _ImageType2::PixelType>()
142 template<
typename InputImageType,
typename OutputImageType>
143 static typename OutputImageType::RegionType
145 const InputImageType* inputImage,
146 const OutputImageType* outputImage);
154 template<
typename InputImageType,
typename OutputImageType>
155 static void DispatchedCopy(
const InputImageType *inImage, OutputImageType *outImage,
156 const typename InputImageType::RegionType &inRegion,
157 const typename OutputImageType::RegionType &outRegion,
TrueType isSpecialized );
160 template<
typename InputImageType,
typename OutputImageType>
161 static void DispatchedCopy(
const InputImageType *inImage, OutputImageType *outImage,
162 const typename InputImageType::RegionType &inRegion,
163 const typename OutputImageType::RegionType &outRegion,
FalseType isSpecialized =
FalseType() );
169 template <
typename TImageType>
172 static size_t Get(
const TImageType *)
179 template <
typename TPixelType,
unsigned int VImageDimension>
180 struct PixelSize<
VectorImage<TPixelType, VImageDimension> >
183 static size_t Get(
const ImageType * i )
185 const size_t vectorLength = ImageType::AccessorFunctorType::GetVectorLength(i);
192 template<
typename TInputType,
typename TOutputType>
194 :
public std::unary_function<TInputType,TOutputType>
196 TOutputType
operator() (
const TInputType i) {
return static_cast<TOutputType
>(i); }
201 template<
typename TType>
202 static TType*
CopyHelper(
const TType *first,
const TType *last, TType *result)
207 return std::copy(first, last, result);
211 template<
typename TInputType,
typename TOutputType>
212 static TOutputType*
CopyHelper(
const TInputType *first,
const TInputType *last, TOutputType *result)
214 return std::transform(first, last, result, StaticCast<TInputType,TOutputType>());
223 #ifndef ITK_MANUAL_INSTANTIATION
224 #include "itkImageAlgorithm.hxx"
228 #endif //itkImageAlgorithm_h
static OutputImageType::RegionType EnlargeRegionOverBox(const typename InputImageType::RegionType &inputRegion, const InputImageType *inputImage, const OutputImageType *outputImage)
Sets the output region to the smallest region of the output image that fully contains the physical sp...
Superclass::RegionType RegionType
static void DispatchedCopy(const InputImageType *inImage, OutputImageType *outImage, const typename InputImageType::RegionType &inRegion, const typename OutputImageType::RegionType &outRegion, TrueType isSpecialized)
Templated n-dimensional vector image class.
static TType * CopyHelper(const TType *first, const TType *last, TType *result)
static vcl_size_t Get(const TImageType *)
static void Copy(const InputImageType *inImage, OutputImageType *outImage, const typename InputImageType::RegionType &inRegion, const typename OutputImageType::RegionType &outRegion)
This generic function copies a region from one image to another. It may perform optimizations on the ...
TOutputType operator()(const TInputType i)
A container of static functions which can operate on Images with Iterators.
Templated n-dimensional image class.