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>()
117 template<
typename TPixel1,
typename TPixel2,
unsigned int VImageDimension>
118 static void Copy(
const VectorImage<TPixel1, VImageDimension> * inImage,
119 VectorImage<TPixel2, VImageDimension> * outImage,
120 const typename VectorImage<TPixel1, VImageDimension>::RegionType &inRegion,
121 const typename VectorImage<TPixel2, VImageDimension>::RegionType &outRegion )
123 typedef VectorImage<TPixel1, VImageDimension> _ImageType1;
124 typedef VectorImage<TPixel2, VImageDimension> _ImageType2;
126 #
if defined(ITK_HAS_STLTR1_TR1_TYPE_TRAITS) || defined(ITK_HAS_STLTR1_TYPE_TRAITS)
127 , ITK_STD_TR1_NAMESPACE::is_convertible<
typename _ImageType1::PixelType,
128 typename _ImageType2::PixelType>()
143 template<
typename InputImageType,
typename OutputImageType>
144 static void DispatchedCopy(
const InputImageType *inImage, OutputImageType *outImage,
145 const typename InputImageType::RegionType &inRegion,
146 const typename OutputImageType::RegionType &outRegion,
TrueType isSpecialized );
149 template<
typename InputImageType,
typename OutputImageType>
150 static void DispatchedCopy(
const InputImageType *inImage, OutputImageType *outImage,
151 const typename InputImageType::RegionType &inRegion,
152 const typename OutputImageType::RegionType &outRegion,
FalseType isSpecialized =
FalseType() );
158 template <
typename TImageType>
161 static size_t Get(
const TImageType *)
168 template <
typename TPixelType,
unsigned int VImageDimension>
169 struct PixelSize<
VectorImage<TPixelType, VImageDimension> >
172 static size_t Get(
const ImageType * i )
174 const size_t vectorLength = ImageType::AccessorFunctorType::GetVectorLength(i);
182 template<
typename TInputType,
typename TOutputType>
184 :
public std::unary_function<TInputType,TOutputType>
186 TOutputType
operator() (
const TInputType i) {
return static_cast<TOutputType
>(i); }
191 template<
typename TType>
192 static TType*
CopyHelper(
const TType *first,
const TType *last, TType *result)
197 return std::copy(first, last, result);
201 template<
typename TInputType,
typename TOutputType>
202 static TOutputType*
CopyHelper(
const TInputType *first,
const TInputType *last, TOutputType *result)
204 return std::transform(first, last, result, StaticCast<TInputType,TOutputType>());
214 #ifndef ITK_MANUAL_INSTANTIATION
215 #include "itkImageAlgorithm.hxx"
219 #endif //__itkImageAlgorithm_h
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.