34#ifndef AIMS_PYRAMID_CONVOLUTIONSUBSAMPLER_D_H
35#define AIMS_PYRAMID_CONVOLUTIONSUBSAMPLER_D_H
38#include <aims/utility/progress.h>
39#include <cartobase/config/verbose.h>
126 long size2 = ( size << 1 ) - 2;
127 ldiv_t modOp = std::ldiv( i, size2 );
128 return ( modOp.rem < size ) ? modOp.rem : ( size2 - modOp.rem );
137 template <
typename T>
140 long px,
long py,
long pz,
long pt,
144 return vol(
selectCoeff( px, fullsize[0], binf[0] ),
157 template <
typename F>
158 template <
typename OUT,
typename IN>
166 unsigned rX = ( doX ?
_factor[0] : 1 );
167 unsigned rY = ( doY ?
_factor[1] : 1 );
168 unsigned rZ = ( doZ ?
_factor[2] : 1 );
169 unsigned rT = ( doT ?
_factor[3] : 1 );
176 std::vector<float> vs( 4, 1. );
187 template <
typename F>
188 template <
typename OUT,
typename IN>
203 std::vector<int> s = tmp.
getSize();
204 Point4dl binf( b[0], b[2], b[4], b[6] );
205 Point4dl fullsize( s[0] + b[0] + b[1], s[1] + b[2] + b[3],
206 s[2] + b[4] + b[5], s[3] + b[6] + b[7] );
208 const F & fx =
_func[0];
218 unsigned rX = ( doX ?
_factor[0] : 1 );
219 unsigned rY = ( doY ?
_factor[1] : 1 );
220 unsigned rZ = ( doZ ?
_factor[2] : 1 );
221 unsigned rT = ( doT ?
_factor[3] : 1 );
223 long linf = ( doT ? (long)ft.support()[0] : 0 );
224 long lsup = ( doT ? (long)ft.support()[1] : 0 );
225 long kinf = ( doZ ? (long)fz.support()[0] : 0 );
226 long ksup = ( doZ ? (long)fz.support()[1] : 0 );
227 long jinf = ( doY ? (long)fy.support()[0] : 0 );
228 long jsup = ( doY ? (long)fy.support()[1] : 0 );
229 long iinf = ( doX ? (long)fx.support()[0] : 0 );
230 long isup = ( doX ? (long)fx.support()[1] : 0 );
237 for(
long t = 0, ot = 0; ot < out.
getSizeT(); t += rT, ++ot )
238 for(
long z = 0, oz = 0; oz < out.
getSizeZ(); z += rZ, ++oz )
239 for(
long y = 0, oy = 0; oy < out.
getSizeY(); y += rY, ++oy )
240 for(
long x = 0, ox = 0; ox < out.
getSizeX(); x += rX, ++ox )
245 for(
long l = linf; l <= lsup; ++l )
246 for(
long k = kinf; k <= ksup; ++k )
247 for(
long j = jinf; j <= jsup; ++j )
248 for(
long i = iinf; i <= isup; ++i )
250 double ct = doT ? ft( l ) : 1.;
251 double cz = doZ ? fz( k ) : 1.;
252 double cy = doY ? fy( j ) : 1.;
253 double cx = doX ? fx( i ) : 1.;
258 out( ox, oy, oz, ot ) = value;
262 std::cout << std::endl;
271 template <
typename F>
277 template <
typename F>
283 template <
typename F>
286 _func.assign( 4, func );
289 template <
typename F>
295 template <
typename F>
301 template <
typename F>
307 template <
typename F>
310 _dir.assign( 4,
true );
312 for( std::vector<bool>::size_type i = 0; i < dir.size() && i <
_dir.size(); ++i )
316 template <
typename F>
325 template <
typename F>
331 template <
typename F>
const Point4du & factor() const
std::vector< DiscreteBSpline > _func
virtual ~ConvolutionSubSampler()
carto::VolumeRef< OUT > execute(const carto::VolumeRef< IN > &in) const
Execution.
void setBasisFunction(const BasisFunction &func)
ConvolutionSubSampler(unsigned r=2)
Constructor / Destructor / Copy.
ConvolutionSubSampler & operator=(const ConvolutionSubSampler &other)
const std::vector< bool > & directions() const
Parameters.
void setDirections(const std::vector< bool > &dir)
void setVerbose(int verbose=1)
void setFactor(unsigned r)
virtual void print(const bool force=false)
void setProperty(const std::string &, const T &)
bool getProperty(const std::string &, T &) const
std::vector< int > getBorders() const
virtual void copyHeaderFrom(const PropertySet &other)
std::vector< int > getSize() const
const PropertySet & header() const
long mirrorCoeff(long i, long size)
const T & at(const carto::VolumeRef< T > &vol, long px, long py, long pz, long pt, const Point4dl &fullsize, const Point4dl &binf)
long selectCoeff(long i, long fullsize, long binf)
ProgressInfo< double, double > Progression
std::string toString(const T &object)
AimsVector< int64_t, 4 > Point4dl
AimsVector< uint32_t, 4 > Point4du