21 #ifndef IMG_ALG_TRANSFORM_SHIFT_HH
22 #define IMG_ALG_TRANSFORM_SHIFT_HH
30 unsigned int absmod(
int x,
unsigned int y)
32 return x<0 ? y+std::div(x,y).rem : std::div(x,y).rem;
37 namespace ost {
namespace img {
namespace alg {
44 template <
typename T,
class D>
46 boost::shared_ptr<ImageStateImpl<T,D> > isi = in_state.
CloneState(
false);
52 unsigned int p0=::absmod(shift_[0],width);
53 unsigned int p1=::absmod(shift_[1],height);
54 unsigned int p2=::absmod(shift_[2],depth);
56 for(
unsigned int u=0;u<width;++u) {
57 for(
unsigned int v=0;v<height;++v) {
58 for(
unsigned int w=0;w<depth;++w) {
59 isi->Value(
Index((u+p0)%width,(v+p1)%height,(w+p2)%depth))=in_state.
Value(
Index(u,v,w));
class encapsulating 1D to 3D point
ImageStateBasePtr VisitState(const ImageStateImpl< T, D > &in_state) const
static String GetAlgorithmName()
out-of-place modifying image state const visitor plus op algorithm
SharedPtrType CloneState(bool cc=true) const
virtual Extent GetExtent() const
Retrieve Extent.
T & Value(const Point &p)
#define DLLEXPORT_IMG_ALG
ImageStateConstModOPAlgorithm< ShiftFnc > Shift
boost::shared_ptr< ImageStateBase > ImageStateBasePtr