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 typename OutputImageType::RegionType
146 const InputImageType* inputImage,
147 const OutputImageType* outputImage);
155 template<
typename InputImageType,
typename OutputImageType>
156 static void DispatchedCopy(
const InputImageType *inImage, OutputImageType *outImage,
157 const typename InputImageType::RegionType &inRegion,
158 const typename OutputImageType::RegionType &outRegion,
TrueType isSpecialized );
161 template<
typename InputImageType,
typename OutputImageType>
162 static void DispatchedCopy(
const InputImageType *inImage, OutputImageType *outImage,
163 const typename InputImageType::RegionType &inRegion,
164 const typename OutputImageType::RegionType &outRegion,
FalseType isSpecialized =
FalseType() );
170 template <
typename TImageType>
173 static size_t Get(
const TImageType *)
180 template <
typename TPixelType,
unsigned int VImageDimension>
181 struct PixelSize<
VectorImage<TPixelType, VImageDimension> >
184 static size_t Get(
const ImageType * i )
186 const size_t vectorLength = ImageType::AccessorFunctorType::GetVectorLength(i);
194 template<
typename TInputType,
typename TOutputType>
196 :
public std::unary_function<TInputType,TOutputType>
198 TOutputType
operator() (
const TInputType i) {
return static_cast<TOutputType
>(i); }
203 template<
typename TType>
204 static TType*
CopyHelper(
const TType *first,
const TType *last, TType *result)
209 return std::copy(first, last, result);
213 template<
typename TInputType,
typename TOutputType>
214 static TOutputType*
CopyHelper(
const TInputType *first,
const TInputType *last, TOutputType *result)
216 return std::transform(first, last, result, StaticCast<TInputType,TOutputType>());
226 #ifndef ITK_MANUAL_INSTANTIATION
227 #include "itkImageAlgorithm.hxx"
231 #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.