Commit c8c976a9c4d356cd201867cf1f206ecf4dff55e2

Authored by David Mayerich
1 parent 9d3ba0b1

replaced CImg with OpenCV, fixed warnings for a clean build, still not completely tested

stim/envi/envi.h
... ... @@ -1136,7 +1136,14 @@ public:
1136 1136 /// @param y0 is the lower-left y pixel coordinate to be included in the cropped image
1137 1137 /// @param x1 is the upper-right x pixel coordinate to be included in the cropped image
1138 1138 /// @param y1 is the upper-right y pixel coordinate to be included in the cropped image
1139   - bool crop(std::string outfile,unsigned x0, unsigned y0, unsigned x1, unsigned y1, unsigned b0, unsigned b1, bool PROGRESS = false){
  1139 + bool crop(std::string outfile,
  1140 + unsigned long long x0,
  1141 + unsigned long long y0,
  1142 + unsigned long long x1,
  1143 + unsigned long long y1,
  1144 + unsigned long long b0,
  1145 + unsigned long long b1,
  1146 + bool PROGRESS = false){
1140 1147  
1141 1148 //save the header for the cropped file
1142 1149 stim::envi_header new_header = header;
... ...
stim/image/CImg.h deleted
Changes suppressed. Click to show
1   -/*
2   - #
3   - # File : CImg.h
4   - # ( C++ header file )
5   - #
6   - # Description : The C++ Template Image Processing Toolkit.
7   - # This file is the main component of the CImg Library project.
8   - # ( http://cimg.eu )
9   - #
10   - # Project manager : David Tschumperle.
11   - # ( http://tschumperle.users.greyc.fr/ )
12   - #
13   - # A complete list of contributors is available in file 'README.txt'
14   - # distributed within the CImg package.
15   - #
16   - # Licenses : This file is 'dual-licensed', you have to choose one
17   - # of the two licenses below to apply.
18   - #
19   - # CeCILL-C
20   - # The CeCILL-C license is close to the GNU LGPL.
21   - # ( http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.html )
22   - #
23   - # or CeCILL v2.0
24   - # The CeCILL license is compatible with the GNU GPL.
25   - # ( http://www.cecill.info/licences/Licence_CeCILL_V2-en.html )
26   - #
27   - # This software is governed either by the CeCILL or the CeCILL-C license
28   - # under French law and abiding by the rules of distribution of free software.
29   - # You can use, modify and or redistribute the software under the terms of
30   - # the CeCILL or CeCILL-C licenses as circulated by CEA, CNRS and INRIA
31   - # at the following URL: "http://www.cecill.info".
32   - #
33   - # As a counterpart to the access to the source code and rights to copy,
34   - # modify and redistribute granted by the license, users are provided only
35   - # with a limited warranty and the software's author, the holder of the
36   - # economic rights, and the successive licensors have only limited
37   - # liability.
38   - #
39   - # In this respect, the user's attention is drawn to the risks associated
40   - # with loading, using, modifying and/or developing or reproducing the
41   - # software by the user in light of its specific status of free software,
42   - # that may mean that it is complicated to manipulate, and that also
43   - # therefore means that it is reserved for developers and experienced
44   - # professionals having in-depth computer knowledge. Users are therefore
45   - # encouraged to load and test the software's suitability as regards their
46   - # requirements in conditions enabling the security of their systems and/or
47   - # data to be ensured and, more generally, to use and operate it in the
48   - # same conditions as regards security.
49   - #
50   - # The fact that you are presently reading this means that you have had
51   - # knowledge of the CeCILL and CeCILL-C licenses and that you accept its terms.
52   - #
53   -*/
54   -
55   -// Set version number of the library.
56   -#ifndef cimg_version
57   -#define cimg_version 170
58   -
59   -/*-----------------------------------------------------------
60   - #
61   - # Test and possibly auto-set CImg configuration variables
62   - # and include required headers.
63   - #
64   - # If you find that the default configuration variables are
65   - # not adapted to your system, you can override their values
66   - # before including the header file "CImg.h"
67   - # (use the #define directive).
68   - #
69   - ------------------------------------------------------------*/
70   -
71   -// Include standard C++ headers.
72   -// This is the minimal set of required headers to make CImg-based codes compile.
73   -#include <cstdio>
74   -#include <cstdlib>
75   -#include <cstdarg>
76   -#include <cstring>
77   -#include <cmath>
78   -#include <cfloat>
79   -#include <climits>
80   -#include <ctime>
81   -#include <exception>
82   -
83   -// Detect/configure OS variables.
84   -//
85   -// Define 'cimg_OS' to: '0' for an unknown OS (will try to minize library dependencies).
86   -// '1' for a Unix-like OS (Linux, Solaris, BSD, MacOSX, Irix, ...).
87   -// '2' for Microsoft Windows.
88   -// (auto-detection is performed if 'cimg_OS' is not set by the user).
89   -#ifndef cimg_OS
90   -#if defined(unix) || defined(__unix) || defined(__unix__) \
91   - || defined(linux) || defined(__linux) || defined(__linux__) \
92   - || defined(sun) || defined(__sun) \
93   - || defined(BSD) || defined(__OpenBSD__) || defined(__NetBSD__) \
94   - || defined(__FreeBSD__) || defined (__DragonFly__) \
95   - || defined(sgi) || defined(__sgi) \
96   - || defined(__MACOSX__) || defined(__APPLE__) \
97   - || defined(__CYGWIN__)
98   -#define cimg_OS 1
99   -#elif defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \
100   - || defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
101   -#define cimg_OS 2
102   -#else
103   -#define cimg_OS 0
104   -#endif
105   -#elif !(cimg_OS==0 || cimg_OS==1 || cimg_OS==2)
106   -#error CImg Library: Invalid configuration variable 'cimg_OS'.
107   -#error (correct values are '0 = unknown OS', '1 = Unix-like OS', '2 = Microsoft Windows').
108   -#endif
109   -
110   -// Disable silly warnings on some Microsoft VC++ compilers.
111   -#ifdef _MSC_VER
112   -#pragma warning(push)
113   -#pragma warning(disable:4127)
114   -#pragma warning(disable:4311)
115   -#pragma warning(disable:4312)
116   -#pragma warning(disable:4512)
117   -#pragma warning(disable:4571)
118   -#pragma warning(disable:4640)
119   -#pragma warning(disable:4706)
120   -#pragma warning(disable:4710)
121   -#pragma warning(disable:4800)
122   -#pragma warning(disable:4804)
123   -#pragma warning(disable:4820)
124   -#pragma warning(disable:4996)
125   -#define _CRT_SECURE_NO_DEPRECATE 1
126   -#define _CRT_SECURE_NO_WARNINGS 1
127   -#define _CRT_NONSTDC_NO_DEPRECATE 1
128   -#endif
129   -
130   -// Define correct string functions for each compiler and OS.
131   -#if cimg_OS==2 && defined(_MSC_VER)
132   -#define cimg_sscanf std::sscanf
133   -#define cimg_sprintf std::sprintf
134   -#define cimg_snprintf cimg::_snprintf
135   -#define cimg_vsnprintf cimg::_vsnprintf
136   -#else
137   -#include <stdio.h>
138   -#if defined(__MACOSX__) || defined(__APPLE__)
139   -#define cimg_sscanf cimg::_sscanf
140   -#define cimg_sprintf cimg::_sprintf
141   -#define cimg_snprintf cimg::_snprintf
142   -#define cimg_vsnprintf cimg::_vsnprintf
143   -#else
144   -#define cimg_sscanf std::sscanf
145   -#define cimg_sprintf std::sprintf
146   -#define cimg_snprintf snprintf
147   -#define cimg_vsnprintf vsnprintf
148   -#endif
149   -#endif
150   -
151   -// Include OS-specific headers.
152   -#if cimg_OS==1
153   -#include <sys/types.h>
154   -#include <sys/time.h>
155   -#include <sys/stat.h>
156   -#include <unistd.h>
157   -#include <dirent.h>
158   -#include <fnmatch.h>
159   -#elif cimg_OS==2
160   -#ifndef NOMINMAX
161   -#define NOMINMAX
162   -#endif
163   -#ifndef WIN32_LEAN_AND_MEAN
164   -#define WIN32_LEAN_AND_MEAN
165   -#endif
166   -#include <windows.h>
167   -#ifndef _WIN32_IE
168   -#define _WIN32_IE 0x0400
169   -#endif
170   -#include <shlobj.h>
171   -#include <process.h>
172   -#include <io.h>
173   -#endif
174   -
175   -// Look for C++11 features.
176   -#if !defined(cimg_use_cpp11) && __cplusplus>201100
177   -#define cimg_use_cpp11 1
178   -#endif
179   -#if defined(cimg_use_cpp11) && cimg_use_cpp11!=0
180   -#include <initializer_list>
181   -#include <utility>
182   -#endif
183   -
184   -// Configure the 'abort' signal handler (does nothing by default).
185   -// A typical signal handler can be defined in your own source like this:
186   -// Without OpenMP support: #define cimg_test_abort() if (is_abort) throw CImgAbortException("")
187   -//
188   -// or
189   -//
190   -// With OpenMP support: #define cimg_test_abort() if (!omp_get_thread_num() && is_abort) throw CImgAbortException("")
191   -//
192   -// where 'is_abort' is a boolean variable.
193   -#ifndef cimg_test_abort
194   -#define cimg_test_abort()
195   -#endif
196   -
197   -// Configure filename separator.
198   -//
199   -// Filename separator is set by default to '/', except for Windows where it is '\'.
200   -#ifndef cimg_file_separator
201   -#if cimg_OS==2
202   -#define cimg_file_separator '\\'
203   -#else
204   -#define cimg_file_separator '/'
205   -#endif
206   -#endif
207   -
208   -// Configure verbosity of output messages.
209   -//
210   -// Define 'cimg_verbosity' to: '0' to hide library messages (quiet mode).
211   -// '1' to output library messages on the console.
212   -// '2' to output library messages on a basic dialog window (default behavior).
213   -// '3' to do as '1' + add extra warnings (may slow down the code!).
214   -// '4' to do as '2' + add extra warnings (may slow down the code!).
215   -//
216   -// Define 'cimg_strict_warnings' to replace warning messages by exception throwns.
217   -//
218   -// Define 'cimg_use_vt100' to allow output of color messages on VT100-compatible terminals.
219   -#ifndef cimg_verbosity
220   -#if cimg_OS==2
221   -#define cimg_verbosity 2
222   -#else
223   -#define cimg_verbosity 1
224   -#endif
225   -#elif !(cimg_verbosity==0 || cimg_verbosity==1 || cimg_verbosity==2 || cimg_verbosity==3 || cimg_verbosity==4)
226   -#error CImg Library: Configuration variable 'cimg_verbosity' is badly defined.
227   -#error (should be { 0=quiet | 1=console | 2=dialog | 3=console+warnings | 4=dialog+warnings }).
228   -#endif
229   -
230   -// Configure display framework.
231   -//
232   -// Define 'cimg_display' to: '0' to disable display capabilities.
233   -// '1' to use the X-Window framework (X11).
234   -// '2' to use the Microsoft GDI32 framework.
235   -#ifndef cimg_display
236   -#if cimg_OS==0
237   -#define cimg_display 0
238   -#elif cimg_OS==1
239   -#define cimg_display 1
240   -#elif cimg_OS==2
241   -#define cimg_display 2
242   -#endif
243   -#elif !(cimg_display==0 || cimg_display==1 || cimg_display==2)
244   -#error CImg Library: Configuration variable 'cimg_display' is badly defined.
245   -#error (should be { 0=none | 1=X-Window (X11) | 2=Microsoft GDI32 }).
246   -#endif
247   -
248   -// Include display-specific headers.
249   -#if cimg_display==1
250   -#include <X11/Xlib.h>
251   -#include <X11/Xutil.h>
252   -#include <X11/keysym.h>
253   -#include <pthread.h>
254   -#ifdef cimg_use_xshm
255   -#include <sys/ipc.h>
256   -#include <sys/shm.h>
257   -#include <X11/extensions/XShm.h>
258   -#endif
259   -#ifdef cimg_use_xrandr
260   -#include <X11/extensions/Xrandr.h>
261   -#endif
262   -#endif
263   -#ifndef cimg_appname
264   -#define cimg_appname "CImg"
265   -#endif
266   -
267   -// Configure OpenMP support.
268   -// (http://www.openmp.org)
269   -//
270   -// Define 'cimg_use_openmp' to enable OpenMP support.
271   -//
272   -// OpenMP directives may be used in a (very) few CImg functions to get
273   -// advantages of multi-core CPUs.
274   -#ifdef cimg_use_openmp
275   -#include <omp.h>
276   -#endif
277   -
278   -// Configure OpenCV support.
279   -// (http://opencv.willowgarage.com/wiki/)
280   -//
281   -// Define 'cimg_use_opencv' to enable OpenCV support.
282   -//
283   -// OpenCV library may be used to access images from cameras
284   -// (see method 'CImg<T>::load_camera()').
285   -#ifdef cimg_use_opencv
286   -#ifdef True
287   -#undef True
288   -#define _cimg_redefine_True
289   -#endif
290   -#ifdef False
291   -#undef False
292   -#define _cimg_redefine_False
293   -#endif
294   -#include <cstddef>
295   -#include "cv.h"
296   -#include "highgui.h"
297   -#endif
298   -
299   -// Configure LibPNG support.
300   -// (http://www.libpng.org)
301   -//
302   -// Define 'cimg_use_png' to enable LibPNG support.
303   -//
304   -// PNG library may be used to get a native support of '.png' files.
305   -// (see methods 'CImg<T>::{load,save}_png()'.
306   -#ifdef cimg_use_png
307   -extern "C" {
308   -#include "png.h"
309   -}
310   -#endif
311   -
312   -// Configure LibJPEG support.
313   -// (http://en.wikipedia.org/wiki/Libjpeg)
314   -//
315   -// Define 'cimg_use_jpeg' to enable LibJPEG support.
316   -//
317   -// JPEG library may be used to get a native support of '.jpg' files.
318   -// (see methods 'CImg<T>::{load,save}_jpeg()').
319   -#ifdef cimg_use_jpeg
320   -extern "C" {
321   -#include "jpeglib.h"
322   -#include "setjmp.h"
323   -}
324   -#endif
325   -
326   -// Configure LibTIFF support.
327   -// (http://www.libtiff.org)
328   -//
329   -// Define 'cimg_use_tiff' to enable LibTIFF support.
330   -//
331   -// TIFF library may be used to get a native support of '.tif' files.
332   -// (see methods 'CImg[List]<T>::{load,save}_tiff()').
333   -#ifdef cimg_use_tiff
334   -extern "C" {
335   -#define uint64 uint64_hack_
336   -#define int64 int64_hack_
337   -#include "tiffio.h"
338   -#undef uint64
339   -#undef int64
340   -}
341   -#endif
342   -
343   -// Configure LibMINC2 support.
344   -// (http://en.wikibooks.org/wiki/MINC/Reference/MINC2.0_File_Format_Reference)
345   -//
346   -// Define 'cimg_use_minc2' to enable LibMINC2 support.
347   -//
348   -// MINC2 library may be used to get a native support of '.mnc' files.
349   -// (see methods 'CImg<T>::{load,save}_minc2()').
350   -#ifdef cimg_use_minc2
351   -#include "minc_io_simple_volume.h"
352   -#include "minc_1_simple.h"
353   -#include "minc_1_simple_rw.h"
354   -#endif
355   -
356   -// Configure Zlib support.
357   -// (http://www.zlib.net)
358   -//
359   -// Define 'cimg_use_zlib' to enable Zlib support.
360   -//
361   -// Zlib library may be used to allow compressed data in '.cimgz' files
362   -// (see methods 'CImg[List]<T>::{load,save}_cimg()').
363   -#ifdef cimg_use_zlib
364   -extern "C" {
365   -#include "zlib.h"
366   -}
367   -#endif
368   -
369   -// Configure libcurl support.
370   -// (http://curl.haxx.se/libcurl/)
371   -//
372   -// Define 'cimg_use_curl' to enable libcurl support.
373   -//
374   -// Libcurl may be used to get a native support of file downloading from the network.
375   -// (see method 'cimg::load_network()'.)
376   -#ifdef cimg_use_curl
377   -#include "curl/curl.h"
378   -#endif
379   -
380   -// Configure Magick++ support.
381   -// (http://www.imagemagick.org/Magick++)
382   -//
383   -// Define 'cimg_use_magick' to enable Magick++ support.
384   -//
385   -// Magick++ library may be used to get a native support of various image file formats.
386   -// (see methods 'CImg<T>::{load,save}()').
387   -#ifdef cimg_use_magick
388   -#include "Magick++.h"
389   -#endif
390   -
391   -// Configure FFTW3 support.
392   -// (http://www.fftw.org)
393   -//
394   -// Define 'cimg_use_fftw3' to enable libFFTW3 support.
395   -//
396   -// FFTW3 library may be used to efficiently compute the Fast Fourier Transform
397   -// of image data, without restriction on the image size.
398   -// (see method 'CImg[List]<T>::FFT()').
399   -#ifdef cimg_use_fftw3
400   -extern "C" {
401   -#include "fftw3.h"
402   -}
403   -#endif
404   -
405   -// Configure LibBoard support.
406   -// (http://libboard.sourceforge.net/)
407   -//
408   -// Define 'cimg_use_board' to enable Board support.
409   -//
410   -// Board library may be used to draw 3d objects in vector-graphics canvas
411   -// that can be saved as '.ps' or '.svg' files afterwards.
412   -// (see method 'CImg<T>::draw_object3d()').
413   -#ifdef cimg_use_board
414   -#ifdef None
415   -#undef None
416   -#define _cimg_redefine_None
417   -#endif
418   -#include "Board.h"
419   -#endif
420   -
421   -// Configure OpenEXR support.
422   -// (http://www.openexr.com/)
423   -//
424   -// Define 'cimg_use_openexr' to enable OpenEXR support.
425   -//
426   -// OpenEXR library may be used to get a native support of '.exr' files.
427   -// (see methods 'CImg<T>::{load,save}_exr()').
428   -#ifdef cimg_use_openexr
429   -#include "ImfRgbaFile.h"
430   -#include "ImfInputFile.h"
431   -#include "ImfChannelList.h"
432   -#include "ImfMatrixAttribute.h"
433   -#include "ImfArray.h"
434   -#endif
435   -
436   -// Lapack configuration.
437   -// (http://www.netlib.org/lapack)
438   -//
439   -// Define 'cimg_use_lapack' to enable LAPACK support.
440   -//
441   -// Lapack library may be used in several CImg methods to speed up
442   -// matrix computations (eigenvalues, inverse, ...).
443   -#ifdef cimg_use_lapack
444   -extern "C" {
445   - extern void sgetrf_(int*, int*, float*, int*, int*, int*);
446   - extern void sgetri_(int*, float*, int*, int*, float*, int*, int*);
447   - extern void sgetrs_(char*, int*, int*, float*, int*, int*, float*, int*, int*);
448   - extern void sgesvd_(char*, char*, int*, int*, float*, int*, float*, float*, int*, float*, int*, float*, int*, int*);
449   - extern void ssyev_(char*, char*, int*, float*, int*, float*, float*, int*, int*);
450   - extern void dgetrf_(int*, int*, double*, int*, int*, int*);
451   - extern void dgetri_(int*, double*, int*, int*, double*, int*, int*);
452   - extern void dgetrs_(char*, int*, int*, double*, int*, int*, double*, int*, int*);
453   - extern void dgesvd_(char*, char*, int*, int*, double*, int*, double*, double*,
454   - int*, double*, int*, double*, int*, int*);
455   - extern void dsyev_(char*, char*, int*, double*, int*, double*, double*, int*, int*);
456   - extern void dgels_(char*, int*,int*,int*,double*,int*,double*,int*,double*,int*,int*);
457   - extern void sgels_(char*, int*,int*,int*,float*,int*,float*,int*,float*,int*,int*);
458   -}
459   -#endif
460   -
461   -// Check if min/max/PI macros are defined.
462   -//
463   -// CImg does not compile if macros 'min', 'max' or 'PI' are defined,
464   -// because it redefines functions min(), max() and const variable PI in the cimg:: namespace.
465   -// so it '#undef' these macros if necessary, and restore them to reasonable
466   -// values at the end of this file.
467   -#ifdef min
468   -#undef min
469   -#define _cimg_redefine_min
470   -#endif
471   -#ifdef max
472   -#undef max
473   -#define _cimg_redefine_max
474   -#endif
475   -#ifdef PI
476   -#undef PI
477   -#define _cimg_redefine_PI
478   -#endif
479   -
480   -// Define 'cimg_library' namespace suffix.
481   -//
482   -// You may want to add a suffix to the 'cimg_library' namespace, for instance if you need to work
483   -// with several versions of the library at the same time.
484   -#ifdef cimg_namespace_suffix
485   -#define __cimg_library_suffixed(s) cimg_library_##s
486   -#define _cimg_library_suffixed(s) __cimg_library_suffixed(s)
487   -#define cimg_library_suffixed _cimg_library_suffixed(cimg_namespace_suffix)
488   -#else
489   -#define cimg_library_suffixed cimg_library
490   -#endif
491   -
492   -/*------------------------------------------------------------------------------
493   - #
494   - # Define user-friendly macros.
495   - #
496   - # These CImg macros are prefixed by 'cimg_' and can be used safely in your own
497   - # code. They are useful to parse command line options, or to write image loops.
498   - #
499   - ------------------------------------------------------------------------------*/
500   -
501   -// Macros to define program usage, and retrieve command line arguments.
502   -#define cimg_usage(usage) cimg_library_suffixed::cimg::option((char*)0,argc,argv,(char*)0,usage,false)
503   -#define cimg_help(str) cimg_library_suffixed::cimg::option((char*)0,argc,argv,str,(char*)0)
504   -#define cimg_option(name,defaut,usage) cimg_library_suffixed::cimg::option(name,argc,argv,defaut,usage)
505   -
506   -// Macros to define and manipulate local neighborhoods.
507   -#define CImg_2x2(I,T) T I[4]; \
508   - T& I##cc = I[0]; T& I##nc = I[1]; \
509   - T& I##cn = I[2]; T& I##nn = I[3]; \
510   - I##cc = I##nc = \
511   - I##cn = I##nn = 0
512   -
513   -#define CImg_3x3(I,T) T I[9]; \
514   - T& I##pp = I[0]; T& I##cp = I[1]; T& I##np = I[2]; \
515   - T& I##pc = I[3]; T& I##cc = I[4]; T& I##nc = I[5]; \
516   - T& I##pn = I[6]; T& I##cn = I[7]; T& I##nn = I[8]; \
517   - I##pp = I##cp = I##np = \
518   - I##pc = I##cc = I##nc = \
519   - I##pn = I##cn = I##nn = 0
520   -
521   -#define CImg_4x4(I,T) T I[16]; \
522   - T& I##pp = I[0]; T& I##cp = I[1]; T& I##np = I[2]; T& I##ap = I[3]; \
523   - T& I##pc = I[4]; T& I##cc = I[5]; T& I##nc = I[6]; T& I##ac = I[7]; \
524   - T& I##pn = I[8]; T& I##cn = I[9]; T& I##nn = I[10]; T& I##an = I[11]; \
525   - T& I##pa = I[12]; T& I##ca = I[13]; T& I##na = I[14]; T& I##aa = I[15]; \
526   - I##pp = I##cp = I##np = I##ap = \
527   - I##pc = I##cc = I##nc = I##ac = \
528   - I##pn = I##cn = I##nn = I##an = \
529   - I##pa = I##ca = I##na = I##aa = 0
530   -
531   -#define CImg_5x5(I,T) T I[25]; \
532   - T& I##bb = I[0]; T& I##pb = I[1]; T& I##cb = I[2]; T& I##nb = I[3]; T& I##ab = I[4]; \
533   - T& I##bp = I[5]; T& I##pp = I[6]; T& I##cp = I[7]; T& I##np = I[8]; T& I##ap = I[9]; \
534   - T& I##bc = I[10]; T& I##pc = I[11]; T& I##cc = I[12]; T& I##nc = I[13]; T& I##ac = I[14]; \
535   - T& I##bn = I[15]; T& I##pn = I[16]; T& I##cn = I[17]; T& I##nn = I[18]; T& I##an = I[19]; \
536   - T& I##ba = I[20]; T& I##pa = I[21]; T& I##ca = I[22]; T& I##na = I[23]; T& I##aa = I[24]; \
537   - I##bb = I##pb = I##cb = I##nb = I##ab = \
538   - I##bp = I##pp = I##cp = I##np = I##ap = \
539   - I##bc = I##pc = I##cc = I##nc = I##ac = \
540   - I##bn = I##pn = I##cn = I##nn = I##an = \
541   - I##ba = I##pa = I##ca = I##na = I##aa = 0
542   -
543   -#define CImg_2x2x2(I,T) T I[8]; \
544   - T& I##ccc = I[0]; T& I##ncc = I[1]; \
545   - T& I##cnc = I[2]; T& I##nnc = I[3]; \
546   - T& I##ccn = I[4]; T& I##ncn = I[5]; \
547   - T& I##cnn = I[6]; T& I##nnn = I[7]; \
548   - I##ccc = I##ncc = \
549   - I##cnc = I##nnc = \
550   - I##ccn = I##ncn = \
551   - I##cnn = I##nnn = 0
552   -
553   -#define CImg_3x3x3(I,T) T I[27]; \
554   - T& I##ppp = I[0]; T& I##cpp = I[1]; T& I##npp = I[2]; \
555   - T& I##pcp = I[3]; T& I##ccp = I[4]; T& I##ncp = I[5]; \
556   - T& I##pnp = I[6]; T& I##cnp = I[7]; T& I##nnp = I[8]; \
557   - T& I##ppc = I[9]; T& I##cpc = I[10]; T& I##npc = I[11]; \
558   - T& I##pcc = I[12]; T& I##ccc = I[13]; T& I##ncc = I[14]; \
559   - T& I##pnc = I[15]; T& I##cnc = I[16]; T& I##nnc = I[17]; \
560   - T& I##ppn = I[18]; T& I##cpn = I[19]; T& I##npn = I[20]; \
561   - T& I##pcn = I[21]; T& I##ccn = I[22]; T& I##ncn = I[23]; \
562   - T& I##pnn = I[24]; T& I##cnn = I[25]; T& I##nnn = I[26]; \
563   - I##ppp = I##cpp = I##npp = \
564   - I##pcp = I##ccp = I##ncp = \
565   - I##pnp = I##cnp = I##nnp = \
566   - I##ppc = I##cpc = I##npc = \
567   - I##pcc = I##ccc = I##ncc = \
568   - I##pnc = I##cnc = I##nnc = \
569   - I##ppn = I##cpn = I##npn = \
570   - I##pcn = I##ccn = I##ncn = \
571   - I##pnn = I##cnn = I##nnn = 0
572   -
573   -#define cimg_get2x2(img,x,y,z,c,I,T) \
574   - I[0] = (T)(img)(x,y,z,c), I[1] = (T)(img)(_n1##x,y,z,c), I[2] = (T)(img)(x,_n1##y,z,c), \
575   - I[3] = (T)(img)(_n1##x,_n1##y,z,c)
576   -
577   -#define cimg_get3x3(img,x,y,z,c,I,T) \
578   - I[0] = (T)(img)(_p1##x,_p1##y,z,c), I[1] = (T)(img)(x,_p1##y,z,c), I[2] = (T)(img)(_n1##x,_p1##y,z,c), \
579   - I[3] = (T)(img)(_p1##x,y,z,c), I[4] = (T)(img)(x,y,z,c), I[5] = (T)(img)(_n1##x,y,z,c), \
580   - I[6] = (T)(img)(_p1##x,_n1##y,z,c), I[7] = (T)(img)(x,_n1##y,z,c), I[8] = (T)(img)(_n1##x,_n1##y,z,c)
581   -
582   -#define cimg_get4x4(img,x,y,z,c,I,T) \
583   - I[0] = (T)(img)(_p1##x,_p1##y,z,c), I[1] = (T)(img)(x,_p1##y,z,c), I[2] = (T)(img)(_n1##x,_p1##y,z,c), \
584   - I[3] = (T)(img)(_n2##x,_p1##y,z,c), I[4] = (T)(img)(_p1##x,y,z,c), I[5] = (T)(img)(x,y,z,c), \
585   - I[6] = (T)(img)(_n1##x,y,z,c), I[7] = (T)(img)(_n2##x,y,z,c), I[8] = (T)(img)(_p1##x,_n1##y,z,c), \
586   - I[9] = (T)(img)(x,_n1##y,z,c), I[10] = (T)(img)(_n1##x,_n1##y,z,c), I[11] = (T)(img)(_n2##x,_n1##y,z,c), \
587   - I[12] = (T)(img)(_p1##x,_n2##y,z,c), I[13] = (T)(img)(x,_n2##y,z,c), I[14] = (T)(img)(_n1##x,_n2##y,z,c), \
588   - I[15] = (T)(img)(_n2##x,_n2##y,z,c)
589   -
590   -#define cimg_get5x5(img,x,y,z,c,I,T) \
591   - I[0] = (T)(img)(_p2##x,_p2##y,z,c), I[1] = (T)(img)(_p1##x,_p2##y,z,c), I[2] = (T)(img)(x,_p2##y,z,c), \
592   - I[3] = (T)(img)(_n1##x,_p2##y,z,c), I[4] = (T)(img)(_n2##x,_p2##y,z,c), I[5] = (T)(img)(_p2##x,_p1##y,z,c), \
593   - I[6] = (T)(img)(_p1##x,_p1##y,z,c), I[7] = (T)(img)(x,_p1##y,z,c), I[8] = (T)(img)(_n1##x,_p1##y,z,c), \
594   - I[9] = (T)(img)(_n2##x,_p1##y,z,c), I[10] = (T)(img)(_p2##x,y,z,c), I[11] = (T)(img)(_p1##x,y,z,c), \
595   - I[12] = (T)(img)(x,y,z,c), I[13] = (T)(img)(_n1##x,y,z,c), I[14] = (T)(img)(_n2##x,y,z,c), \
596   - I[15] = (T)(img)(_p2##x,_n1##y,z,c), I[16] = (T)(img)(_p1##x,_n1##y,z,c), I[17] = (T)(img)(x,_n1##y,z,c), \
597   - I[18] = (T)(img)(_n1##x,_n1##y,z,c), I[19] = (T)(img)(_n2##x,_n1##y,z,c), I[20] = (T)(img)(_p2##x,_n2##y,z,c), \
598   - I[21] = (T)(img)(_p1##x,_n2##y,z,c), I[22] = (T)(img)(x,_n2##y,z,c), I[23] = (T)(img)(_n1##x,_n2##y,z,c), \
599   - I[24] = (T)(img)(_n2##x,_n2##y,z,c)
600   -
601   -#define cimg_get6x6(img,x,y,z,c,I,T) \
602   - I[0] = (T)(img)(_p2##x,_p2##y,z,c), I[1] = (T)(img)(_p1##x,_p2##y,z,c), I[2] = (T)(img)(x,_p2##y,z,c), \
603   - I[3] = (T)(img)(_n1##x,_p2##y,z,c), I[4] = (T)(img)(_n2##x,_p2##y,z,c), I[5] = (T)(img)(_n3##x,_p2##y,z,c), \
604   - I[6] = (T)(img)(_p2##x,_p1##y,z,c), I[7] = (T)(img)(_p1##x,_p1##y,z,c), I[8] = (T)(img)(x,_p1##y,z,c), \
605   - I[9] = (T)(img)(_n1##x,_p1##y,z,c), I[10] = (T)(img)(_n2##x,_p1##y,z,c), I[11] = (T)(img)(_n3##x,_p1##y,z,c), \
606   - I[12] = (T)(img)(_p2##x,y,z,c), I[13] = (T)(img)(_p1##x,y,z,c), I[14] = (T)(img)(x,y,z,c), \
607   - I[15] = (T)(img)(_n1##x,y,z,c), I[16] = (T)(img)(_n2##x,y,z,c), I[17] = (T)(img)(_n3##x,y,z,c), \
608   - I[18] = (T)(img)(_p2##x,_n1##y,z,c), I[19] = (T)(img)(_p1##x,_n1##y,z,c), I[20] = (T)(img)(x,_n1##y,z,c), \
609   - I[21] = (T)(img)(_n1##x,_n1##y,z,c), I[22] = (T)(img)(_n2##x,_n1##y,z,c), I[23] = (T)(img)(_n3##x,_n1##y,z,c), \
610   - I[24] = (T)(img)(_p2##x,_n2##y,z,c), I[25] = (T)(img)(_p1##x,_n2##y,z,c), I[26] = (T)(img)(x,_n2##y,z,c), \
611   - I[27] = (T)(img)(_n1##x,_n2##y,z,c), I[28] = (T)(img)(_n2##x,_n2##y,z,c), I[29] = (T)(img)(_n3##x,_n2##y,z,c), \
612   - I[30] = (T)(img)(_p2##x,_n3##y,z,c), I[31] = (T)(img)(_p1##x,_n3##y,z,c), I[32] = (T)(img)(x,_n3##y,z,c), \
613   - I[33] = (T)(img)(_n1##x,_n3##y,z,c), I[34] = (T)(img)(_n2##x,_n3##y,z,c), I[35] = (T)(img)(_n3##x,_n3##y,z,c)
614   -
615   -#define cimg_get7x7(img,x,y,z,c,I,T) \
616   - I[0] = (T)(img)(_p3##x,_p3##y,z,c), I[1] = (T)(img)(_p2##x,_p3##y,z,c), I[2] = (T)(img)(_p1##x,_p3##y,z,c), \
617   - I[3] = (T)(img)(x,_p3##y,z,c), I[4] = (T)(img)(_n1##x,_p3##y,z,c), I[5] = (T)(img)(_n2##x,_p3##y,z,c), \
618   - I[6] = (T)(img)(_n3##x,_p3##y,z,c), I[7] = (T)(img)(_p3##x,_p2##y,z,c), I[8] = (T)(img)(_p2##x,_p2##y,z,c), \
619   - I[9] = (T)(img)(_p1##x,_p2##y,z,c), I[10] = (T)(img)(x,_p2##y,z,c), I[11] = (T)(img)(_n1##x,_p2##y,z,c), \
620   - I[12] = (T)(img)(_n2##x,_p2##y,z,c), I[13] = (T)(img)(_n3##x,_p2##y,z,c), I[14] = (T)(img)(_p3##x,_p1##y,z,c), \
621   - I[15] = (T)(img)(_p2##x,_p1##y,z,c), I[16] = (T)(img)(_p1##x,_p1##y,z,c), I[17] = (T)(img)(x,_p1##y,z,c), \
622   - I[18] = (T)(img)(_n1##x,_p1##y,z,c), I[19] = (T)(img)(_n2##x,_p1##y,z,c), I[20] = (T)(img)(_n3##x,_p1##y,z,c), \
623   - I[21] = (T)(img)(_p3##x,y,z,c), I[22] = (T)(img)(_p2##x,y,z,c), I[23] = (T)(img)(_p1##x,y,z,c), \
624   - I[24] = (T)(img)(x,y,z,c), I[25] = (T)(img)(_n1##x,y,z,c), I[26] = (T)(img)(_n2##x,y,z,c), \
625   - I[27] = (T)(img)(_n3##x,y,z,c), I[28] = (T)(img)(_p3##x,_n1##y,z,c), I[29] = (T)(img)(_p2##x,_n1##y,z,c), \
626   - I[30] = (T)(img)(_p1##x,_n1##y,z,c), I[31] = (T)(img)(x,_n1##y,z,c), I[32] = (T)(img)(_n1##x,_n1##y,z,c), \
627   - I[33] = (T)(img)(_n2##x,_n1##y,z,c), I[34] = (T)(img)(_n3##x,_n1##y,z,c), I[35] = (T)(img)(_p3##x,_n2##y,z,c), \
628   - I[36] = (T)(img)(_p2##x,_n2##y,z,c), I[37] = (T)(img)(_p1##x,_n2##y,z,c), I[38] = (T)(img)(x,_n2##y,z,c), \
629   - I[39] = (T)(img)(_n1##x,_n2##y,z,c), I[40] = (T)(img)(_n2##x,_n2##y,z,c), I[41] = (T)(img)(_n3##x,_n2##y,z,c), \
630   - I[42] = (T)(img)(_p3##x,_n3##y,z,c), I[43] = (T)(img)(_p2##x,_n3##y,z,c), I[44] = (T)(img)(_p1##x,_n3##y,z,c), \
631   - I[45] = (T)(img)(x,_n3##y,z,c), I[46] = (T)(img)(_n1##x,_n3##y,z,c), I[47] = (T)(img)(_n2##x,_n3##y,z,c), \
632   - I[48] = (T)(img)(_n3##x,_n3##y,z,c)
633   -
634   -#define cimg_get8x8(img,x,y,z,c,I,T) \
635   - I[0] = (T)(img)(_p3##x,_p3##y,z,c), I[1] = (T)(img)(_p2##x,_p3##y,z,c), I[2] = (T)(img)(_p1##x,_p3##y,z,c), \
636   - I[3] = (T)(img)(x,_p3##y,z,c), I[4] = (T)(img)(_n1##x,_p3##y,z,c), I[5] = (T)(img)(_n2##x,_p3##y,z,c), \
637   - I[6] = (T)(img)(_n3##x,_p3##y,z,c), I[7] = (T)(img)(_n4##x,_p3##y,z,c), I[8] = (T)(img)(_p3##x,_p2##y,z,c), \
638   - I[9] = (T)(img)(_p2##x,_p2##y,z,c), I[10] = (T)(img)(_p1##x,_p2##y,z,c), I[11] = (T)(img)(x,_p2##y,z,c), \
639   - I[12] = (T)(img)(_n1##x,_p2##y,z,c), I[13] = (T)(img)(_n2##x,_p2##y,z,c), I[14] = (T)(img)(_n3##x,_p2##y,z,c), \
640   - I[15] = (T)(img)(_n4##x,_p2##y,z,c), I[16] = (T)(img)(_p3##x,_p1##y,z,c), I[17] = (T)(img)(_p2##x,_p1##y,z,c), \
641   - I[18] = (T)(img)(_p1##x,_p1##y,z,c), I[19] = (T)(img)(x,_p1##y,z,c), I[20] = (T)(img)(_n1##x,_p1##y,z,c), \
642   - I[21] = (T)(img)(_n2##x,_p1##y,z,c), I[22] = (T)(img)(_n3##x,_p1##y,z,c), I[23] = (T)(img)(_n4##x,_p1##y,z,c), \
643   - I[24] = (T)(img)(_p3##x,y,z,c), I[25] = (T)(img)(_p2##x,y,z,c), I[26] = (T)(img)(_p1##x,y,z,c), \
644   - I[27] = (T)(img)(x,y,z,c), I[28] = (T)(img)(_n1##x,y,z,c), I[29] = (T)(img)(_n2##x,y,z,c), \
645   - I[30] = (T)(img)(_n3##x,y,z,c), I[31] = (T)(img)(_n4##x,y,z,c), I[32] = (T)(img)(_p3##x,_n1##y,z,c), \
646   - I[33] = (T)(img)(_p2##x,_n1##y,z,c), I[34] = (T)(img)(_p1##x,_n1##y,z,c), I[35] = (T)(img)(x,_n1##y,z,c), \
647   - I[36] = (T)(img)(_n1##x,_n1##y,z,c), I[37] = (T)(img)(_n2##x,_n1##y,z,c), I[38] = (T)(img)(_n3##x,_n1##y,z,c), \
648   - I[39] = (T)(img)(_n4##x,_n1##y,z,c), I[40] = (T)(img)(_p3##x,_n2##y,z,c), I[41] = (T)(img)(_p2##x,_n2##y,z,c), \
649   - I[42] = (T)(img)(_p1##x,_n2##y,z,c), I[43] = (T)(img)(x,_n2##y,z,c), I[44] = (T)(img)(_n1##x,_n2##y,z,c), \
650   - I[45] = (T)(img)(_n2##x,_n2##y,z,c), I[46] = (T)(img)(_n3##x,_n2##y,z,c), I[47] = (T)(img)(_n4##x,_n2##y,z,c), \
651   - I[48] = (T)(img)(_p3##x,_n3##y,z,c), I[49] = (T)(img)(_p2##x,_n3##y,z,c), I[50] = (T)(img)(_p1##x,_n3##y,z,c), \
652   - I[51] = (T)(img)(x,_n3##y,z,c), I[52] = (T)(img)(_n1##x,_n3##y,z,c), I[53] = (T)(img)(_n2##x,_n3##y,z,c), \
653   - I[54] = (T)(img)(_n3##x,_n3##y,z,c), I[55] = (T)(img)(_n4##x,_n3##y,z,c), I[56] = (T)(img)(_p3##x,_n4##y,z,c), \
654   - I[57] = (T)(img)(_p2##x,_n4##y,z,c), I[58] = (T)(img)(_p1##x,_n4##y,z,c), I[59] = (T)(img)(x,_n4##y,z,c), \
655   - I[60] = (T)(img)(_n1##x,_n4##y,z,c), I[61] = (T)(img)(_n2##x,_n4##y,z,c), I[62] = (T)(img)(_n3##x,_n4##y,z,c), \
656   - I[63] = (T)(img)(_n4##x,_n4##y,z,c);
657   -
658   -#define cimg_get9x9(img,x,y,z,c,I,T) \
659   - I[0] = (T)(img)(_p4##x,_p4##y,z,c), I[1] = (T)(img)(_p3##x,_p4##y,z,c), I[2] = (T)(img)(_p2##x,_p4##y,z,c), \
660   - I[3] = (T)(img)(_p1##x,_p4##y,z,c), I[4] = (T)(img)(x,_p4##y,z,c), I[5] = (T)(img)(_n1##x,_p4##y,z,c), \
661   - I[6] = (T)(img)(_n2##x,_p4##y,z,c), I[7] = (T)(img)(_n3##x,_p4##y,z,c), I[8] = (T)(img)(_n4##x,_p4##y,z,c), \
662   - I[9] = (T)(img)(_p4##x,_p3##y,z,c), I[10] = (T)(img)(_p3##x,_p3##y,z,c), I[11] = (T)(img)(_p2##x,_p3##y,z,c), \
663   - I[12] = (T)(img)(_p1##x,_p3##y,z,c), I[13] = (T)(img)(x,_p3##y,z,c), I[14] = (T)(img)(_n1##x,_p3##y,z,c), \
664   - I[15] = (T)(img)(_n2##x,_p3##y,z,c), I[16] = (T)(img)(_n3##x,_p3##y,z,c), I[17] = (T)(img)(_n4##x,_p3##y,z,c), \
665   - I[18] = (T)(img)(_p4##x,_p2##y,z,c), I[19] = (T)(img)(_p3##x,_p2##y,z,c), I[20] = (T)(img)(_p2##x,_p2##y,z,c), \
666   - I[21] = (T)(img)(_p1##x,_p2##y,z,c), I[22] = (T)(img)(x,_p2##y,z,c), I[23] = (T)(img)(_n1##x,_p2##y,z,c), \
667   - I[24] = (T)(img)(_n2##x,_p2##y,z,c), I[25] = (T)(img)(_n3##x,_p2##y,z,c), I[26] = (T)(img)(_n4##x,_p2##y,z,c), \
668   - I[27] = (T)(img)(_p4##x,_p1##y,z,c), I[28] = (T)(img)(_p3##x,_p1##y,z,c), I[29] = (T)(img)(_p2##x,_p1##y,z,c), \
669   - I[30] = (T)(img)(_p1##x,_p1##y,z,c), I[31] = (T)(img)(x,_p1##y,z,c), I[32] = (T)(img)(_n1##x,_p1##y,z,c), \
670   - I[33] = (T)(img)(_n2##x,_p1##y,z,c), I[34] = (T)(img)(_n3##x,_p1##y,z,c), I[35] = (T)(img)(_n4##x,_p1##y,z,c), \
671   - I[36] = (T)(img)(_p4##x,y,z,c), I[37] = (T)(img)(_p3##x,y,z,c), I[38] = (T)(img)(_p2##x,y,z,c), \
672   - I[39] = (T)(img)(_p1##x,y,z,c), I[40] = (T)(img)(x,y,z,c), I[41] = (T)(img)(_n1##x,y,z,c), \
673   - I[42] = (T)(img)(_n2##x,y,z,c), I[43] = (T)(img)(_n3##x,y,z,c), I[44] = (T)(img)(_n4##x,y,z,c), \
674   - I[45] = (T)(img)(_p4##x,_n1##y,z,c), I[46] = (T)(img)(_p3##x,_n1##y,z,c), I[47] = (T)(img)(_p2##x,_n1##y,z,c), \
675   - I[48] = (T)(img)(_p1##x,_n1##y,z,c), I[49] = (T)(img)(x,_n1##y,z,c), I[50] = (T)(img)(_n1##x,_n1##y,z,c), \
676   - I[51] = (T)(img)(_n2##x,_n1##y,z,c), I[52] = (T)(img)(_n3##x,_n1##y,z,c), I[53] = (T)(img)(_n4##x,_n1##y,z,c), \
677   - I[54] = (T)(img)(_p4##x,_n2##y,z,c), I[55] = (T)(img)(_p3##x,_n2##y,z,c), I[56] = (T)(img)(_p2##x,_n2##y,z,c), \
678   - I[57] = (T)(img)(_p1##x,_n2##y,z,c), I[58] = (T)(img)(x,_n2##y,z,c), I[59] = (T)(img)(_n1##x,_n2##y,z,c), \
679   - I[60] = (T)(img)(_n2##x,_n2##y,z,c), I[61] = (T)(img)(_n3##x,_n2##y,z,c), I[62] = (T)(img)(_n4##x,_n2##y,z,c), \
680   - I[63] = (T)(img)(_p4##x,_n3##y,z,c), I[64] = (T)(img)(_p3##x,_n3##y,z,c), I[65] = (T)(img)(_p2##x,_n3##y,z,c), \
681   - I[66] = (T)(img)(_p1##x,_n3##y,z,c), I[67] = (T)(img)(x,_n3##y,z,c), I[68] = (T)(img)(_n1##x,_n3##y,z,c), \
682   - I[69] = (T)(img)(_n2##x,_n3##y,z,c), I[70] = (T)(img)(_n3##x,_n3##y,z,c), I[71] = (T)(img)(_n4##x,_n3##y,z,c), \
683   - I[72] = (T)(img)(_p4##x,_n4##y,z,c), I[73] = (T)(img)(_p3##x,_n4##y,z,c), I[74] = (T)(img)(_p2##x,_n4##y,z,c), \
684   - I[75] = (T)(img)(_p1##x,_n4##y,z,c), I[76] = (T)(img)(x,_n4##y,z,c), I[77] = (T)(img)(_n1##x,_n4##y,z,c), \
685   - I[78] = (T)(img)(_n2##x,_n4##y,z,c), I[79] = (T)(img)(_n3##x,_n4##y,z,c), I[80] = (T)(img)(_n4##x,_n4##y,z,c)
686   -
687   -#define cimg_get2x2x2(img,x,y,z,c,I,T) \
688   - I[0] = (T)(img)(x,y,z,c), I[1] = (T)(img)(_n1##x,y,z,c), I[2] = (T)(img)(x,_n1##y,z,c), \
689   - I[3] = (T)(img)(_n1##x,_n1##y,z,c), I[4] = (T)(img)(x,y,_n1##z,c), I[5] = (T)(img)(_n1##x,y,_n1##z,c), \
690   - I[6] = (T)(img)(x,_n1##y,_n1##z,c), I[7] = (T)(img)(_n1##x,_n1##y,_n1##z,c)
691   -
692   -#define cimg_get3x3x3(img,x,y,z,c,I,T) \
693   - I[0] = (T)(img)(_p1##x,_p1##y,_p1##z,c), I[1] = (T)(img)(x,_p1##y,_p1##z,c), \
694   - I[2] = (T)(img)(_n1##x,_p1##y,_p1##z,c), I[3] = (T)(img)(_p1##x,y,_p1##z,c), I[4] = (T)(img)(x,y,_p1##z,c), \
695   - I[5] = (T)(img)(_n1##x,y,_p1##z,c), I[6] = (T)(img)(_p1##x,_n1##y,_p1##z,c), I[7] = (T)(img)(x,_n1##y,_p1##z,c), \
696   - I[8] = (T)(img)(_n1##x,_n1##y,_p1##z,c), I[9] = (T)(img)(_p1##x,_p1##y,z,c), I[10] = (T)(img)(x,_p1##y,z,c), \
697   - I[11] = (T)(img)(_n1##x,_p1##y,z,c), I[12] = (T)(img)(_p1##x,y,z,c), I[13] = (T)(img)(x,y,z,c), \
698   - I[14] = (T)(img)(_n1##x,y,z,c), I[15] = (T)(img)(_p1##x,_n1##y,z,c), I[16] = (T)(img)(x,_n1##y,z,c), \
699   - I[17] = (T)(img)(_n1##x,_n1##y,z,c), I[18] = (T)(img)(_p1##x,_p1##y,_n1##z,c), I[19] = (T)(img)(x,_p1##y,_n1##z,c), \
700   - I[20] = (T)(img)(_n1##x,_p1##y,_n1##z,c), I[21] = (T)(img)(_p1##x,y,_n1##z,c), I[22] = (T)(img)(x,y,_n1##z,c), \
701   - I[23] = (T)(img)(_n1##x,y,_n1##z,c), I[24] = (T)(img)(_p1##x,_n1##y,_n1##z,c), I[25] = (T)(img)(x,_n1##y,_n1##z,c), \
702   - I[26] = (T)(img)(_n1##x,_n1##y,_n1##z,c)
703   -
704   -// Macros to perform various image loops.
705   -//
706   -// These macros are simpler to use than loops with C++ iterators.
707   -#define cimg_for(img,ptrs,T_ptrs) \
708   - for (T_ptrs *ptrs = (img)._data, *_max##ptrs = (img)._data + (img).size(); ptrs<_max##ptrs; ++ptrs)
709   -#define cimg_rof(img,ptrs,T_ptrs) for (T_ptrs *ptrs = (img)._data + (img).size() - 1; ptrs>=(img)._data; --ptrs)
710   -#define cimg_foroff(img,off) for (unsigned long off = 0, _max##off = (img).size(); off<_max##off; ++off)
711   -
712   -#define cimg_for1(bound,i) for (int i = 0; i<(int)(bound); ++i)
713   -#define cimg_forX(img,x) cimg_for1((img)._width,x)
714   -#define cimg_forY(img,y) cimg_for1((img)._height,y)
715   -#define cimg_forZ(img,z) cimg_for1((img)._depth,z)
716   -#define cimg_forC(img,c) cimg_for1((img)._spectrum,c)
717   -#define cimg_forXY(img,x,y) cimg_forY(img,y) cimg_forX(img,x)
718   -#define cimg_forXZ(img,x,z) cimg_forZ(img,z) cimg_forX(img,x)
719   -#define cimg_forYZ(img,y,z) cimg_forZ(img,z) cimg_forY(img,y)
720   -#define cimg_forXC(img,x,c) cimg_forC(img,c) cimg_forX(img,x)
721   -#define cimg_forYC(img,y,c) cimg_forC(img,c) cimg_forY(img,y)
722   -#define cimg_forZC(img,z,c) cimg_forC(img,c) cimg_forZ(img,z)
723   -#define cimg_forXYZ(img,x,y,z) cimg_forZ(img,z) cimg_forXY(img,x,y)
724   -#define cimg_forXYC(img,x,y,c) cimg_forC(img,c) cimg_forXY(img,x,y)
725   -#define cimg_forXZC(img,x,z,c) cimg_forC(img,c) cimg_forXZ(img,x,z)
726   -#define cimg_forYZC(img,y,z,c) cimg_forC(img,c) cimg_forYZ(img,y,z)
727   -#define cimg_forXYZC(img,x,y,z,c) cimg_forC(img,c) cimg_forXYZ(img,x,y,z)
728   -
729   -#define cimg_rof1(bound,i) for (int i = (int)(bound) - 1; i>=0; --i)
730   -#define cimg_rofX(img,x) cimg_rof1((img)._width,x)
731   -#define cimg_rofY(img,y) cimg_rof1((img)._height,y)
732   -#define cimg_rofZ(img,z) cimg_rof1((img)._depth,z)
733   -#define cimg_rofC(img,c) cimg_rof1((img)._spectrum,c)
734   -#define cimg_rofXY(img,x,y) cimg_rofY(img,y) cimg_rofX(img,x)
735   -#define cimg_rofXZ(img,x,z) cimg_rofZ(img,z) cimg_rofX(img,x)
736   -#define cimg_rofYZ(img,y,z) cimg_rofZ(img,z) cimg_rofY(img,y)
737   -#define cimg_rofXC(img,x,c) cimg_rofC(img,c) cimg_rofX(img,x)
738   -#define cimg_rofYC(img,y,c) cimg_rofC(img,c) cimg_rofY(img,y)
739   -#define cimg_rofZC(img,z,c) cimg_rofC(img,c) cimg_rofZ(img,z)
740   -#define cimg_rofXYZ(img,x,y,z) cimg_rofZ(img,z) cimg_rofXY(img,x,y)
741   -#define cimg_rofXYC(img,x,y,c) cimg_rofC(img,c) cimg_rofXY(img,x,y)
742   -#define cimg_rofXZC(img,x,z,c) cimg_rofC(img,c) cimg_rofXZ(img,x,z)
743   -#define cimg_rofYZC(img,y,z,c) cimg_rofC(img,c) cimg_rofYZ(img,y,z)
744   -#define cimg_rofXYZC(img,x,y,z,c) cimg_rofC(img,c) cimg_rofXYZ(img,x,y,z)
745   -
746   -#define cimg_for_in1(bound,i0,i1,i) \
747   - for (int i = (int)(i0)<0?0:(int)(i0), _max##i = (int)(i1)<(int)(bound)?(int)(i1):(int)(bound) - 1; i<=_max##i; ++i)
748   -#define cimg_for_inX(img,x0,x1,x) cimg_for_in1((img)._width,x0,x1,x)
749   -#define cimg_for_inY(img,y0,y1,y) cimg_for_in1((img)._height,y0,y1,y)
750   -#define cimg_for_inZ(img,z0,z1,z) cimg_for_in1((img)._depth,z0,z1,z)
751   -#define cimg_for_inC(img,c0,c1,c) cimg_for_in1((img)._spectrum,c0,c1,c)
752   -#define cimg_for_inXY(img,x0,y0,x1,y1,x,y) cimg_for_inY(img,y0,y1,y) cimg_for_inX(img,x0,x1,x)
753   -#define cimg_for_inXZ(img,x0,z0,x1,z1,x,z) cimg_for_inZ(img,z0,z1,z) cimg_for_inX(img,x0,x1,x)
754   -#define cimg_for_inXC(img,x0,c0,x1,c1,x,c) cimg_for_inC(img,c0,c1,c) cimg_for_inX(img,x0,x1,x)
755   -#define cimg_for_inYZ(img,y0,z0,y1,z1,y,z) cimg_for_inZ(img,x0,z1,z) cimg_for_inY(img,y0,y1,y)
756   -#define cimg_for_inYC(img,y0,c0,y1,c1,y,c) cimg_for_inC(img,c0,c1,c) cimg_for_inY(img,y0,y1,y)
757   -#define cimg_for_inZC(img,z0,c0,z1,c1,z,c) cimg_for_inC(img,c0,c1,c) cimg_for_inZ(img,z0,z1,z)
758   -#define cimg_for_inXYZ(img,x0,y0,z0,x1,y1,z1,x,y,z) cimg_for_inZ(img,z0,z1,z) cimg_for_inXY(img,x0,y0,x1,y1,x,y)
759   -#define cimg_for_inXYC(img,x0,y0,c0,x1,y1,c1,x,y,c) cimg_for_inC(img,c0,c1,c) cimg_for_inXY(img,x0,y0,x1,y1,x,y)
760   -#define cimg_for_inXZC(img,x0,z0,c0,x1,z1,c1,x,z,c) cimg_for_inC(img,c0,c1,c) cimg_for_inXZ(img,x0,z0,x1,z1,x,z)
761   -#define cimg_for_inYZC(img,y0,z0,c0,y1,z1,c1,y,z,c) cimg_for_inC(img,c0,c1,c) cimg_for_inYZ(img,y0,z0,y1,z1,y,z)
762   -#define cimg_for_inXYZC(img,x0,y0,z0,c0,x1,y1,z1,c1,x,y,z,c) \
763   - cimg_for_inC(img,c0,c1,c) cimg_for_inXYZ(img,x0,y0,z0,x1,y1,z1,x,y,z)
764   -#define cimg_for_insideX(img,x,n) cimg_for_inX(img,n,(img)._width - 1 - (n),x)
765   -#define cimg_for_insideY(img,y,n) cimg_for_inY(img,n,(img)._height - 1 - (n),y)
766   -#define cimg_for_insideZ(img,z,n) cimg_for_inZ(img,n,(img)._depth - 1 - (n),z)
767   -#define cimg_for_insideC(img,c,n) cimg_for_inC(img,n,(img)._spectrum - 1 - (n),c)
768   -#define cimg_for_insideXY(img,x,y,n) cimg_for_inXY(img,n,n,(img)._width - 1 - (n),(img)._height - 1 - (n),x,y)
769   -#define cimg_for_insideXYZ(img,x,y,z,n) \
770   - cimg_for_inXYZ(img,n,n,n,(img)._width - 1 - (n),(img)._height - 1 - (n),(img)._depth - 1 - (n),x,y,z)
771   -#define cimg_for_insideXYZC(img,x,y,z,c,n) \
772   - cimg_for_inXYZ(img,n,n,n,(img)._width - 1 - (n),(img)._height - 1 - (n),(img)._depth - 1 - (n),x,y,z)
773   -
774   -#define cimg_for_out1(boundi,i0,i1,i) \
775   - for (int i = (int)(i0)>0?0:(int)(i1) + 1; i<(int)(boundi); ++i, i = i==(int)(i0)?(int)(i1) + 1:i)
776   -#define cimg_for_out2(boundi,boundj,i0,j0,i1,j1,i,j) \
777   - for (int j = 0; j<(int)(boundj); ++j) \
778   - for (int _n1j = (int)(j<(int)(j0) || j>(int)(j1)), i = _n1j?0:(int)(i0)>0?0:(int)(i1) + 1; i<(int)(boundi); \
779   - ++i, i = _n1j?i:(i==(int)(i0)?(int)(i1) + 1:i))
780   -#define cimg_for_out3(boundi,boundj,boundk,i0,j0,k0,i1,j1,k1,i,j,k) \
781   - for (int k = 0; k<(int)(boundk); ++k) \
782   - for (int _n1k = (int)(k<(int)(k0) || k>(int)(k1)), j = 0; j<(int)(boundj); ++j) \
783   - for (int _n1j = (int)(j<(int)(j0) || j>(int)(j1)), i = _n1j || _n1k?0:(int)(i0)>0?0:(int)(i1) + 1; i<(int)(boundi); \
784   - ++i, i = _n1j || _n1k?i:(i==(int)(i0)?(int)(i1) + 1:i))
785   -#define cimg_for_out4(boundi,boundj,boundk,boundl,i0,j0,k0,l0,i1,j1,k1,l1,i,j,k,l) \
786   - for (int l = 0; l<(int)(boundl); ++l) \
787   - for (int _n1l = (int)(l<(int)(l0) || l>(int)(l1)), k = 0; k<(int)(boundk); ++k) \
788   - for (int _n1k = (int)(k<(int)(k0) || k>(int)(k1)), j = 0; j<(int)(boundj); ++j) \
789   - for (int _n1j = (int)(j<(int)(j0) || j>(int)(j1)), i = _n1j || _n1k || _n1l?0:(int)(i0)>0?0:(int)(i1) + 1; \
790   - i<(int)(boundi); ++i, i = _n1j || _n1k || _n1l?i:(i==(int)(i0)?(int)(i1) + 1:i))
791   -#define cimg_for_outX(img,x0,x1,x) cimg_for_out1((img)._width,x0,x1,x)
792   -#define cimg_for_outY(img,y0,y1,y) cimg_for_out1((img)._height,y0,y1,y)
793   -#define cimg_for_outZ(img,z0,z1,z) cimg_for_out1((img)._depth,z0,z1,z)
794   -#define cimg_for_outC(img,c0,c1,c) cimg_for_out1((img)._spectrum,c0,c1,c)
795   -#define cimg_for_outXY(img,x0,y0,x1,y1,x,y) cimg_for_out2((img)._width,(img)._height,x0,y0,x1,y1,x,y)
796   -#define cimg_for_outXZ(img,x0,z0,x1,z1,x,z) cimg_for_out2((img)._width,(img)._depth,x0,z0,x1,z1,x,z)
797   -#define cimg_for_outXC(img,x0,c0,x1,c1,x,c) cimg_for_out2((img)._width,(img)._spectrum,x0,c0,x1,c1,x,c)
798   -#define cimg_for_outYZ(img,y0,z0,y1,z1,y,z) cimg_for_out2((img)._height,(img)._depth,y0,z0,y1,z1,y,z)
799   -#define cimg_for_outYC(img,y0,c0,y1,c1,y,c) cimg_for_out2((img)._height,(img)._spectrum,y0,c0,y1,c1,y,c)
800   -#define cimg_for_outZC(img,z0,c0,z1,c1,z,c) cimg_for_out2((img)._depth,(img)._spectrum,z0,c0,z1,c1,z,c)
801   -#define cimg_for_outXYZ(img,x0,y0,z0,x1,y1,z1,x,y,z) \
802   - cimg_for_out3((img)._width,(img)._height,(img)._depth,x0,y0,z0,x1,y1,z1,x,y,z)
803   -#define cimg_for_outXYC(img,x0,y0,c0,x1,y1,c1,x,y,c) \
804   - cimg_for_out3((img)._width,(img)._height,(img)._spectrum,x0,y0,c0,x1,y1,c1,x,y,c)
805   -#define cimg_for_outXZC(img,x0,z0,c0,x1,z1,c1,x,z,c) \
806   - cimg_for_out3((img)._width,(img)._depth,(img)._spectrum,x0,z0,c0,x1,z1,c1,x,z,c)
807   -#define cimg_for_outYZC(img,y0,z0,c0,y1,z1,c1,y,z,c) \
808   - cimg_for_out3((img)._height,(img)._depth,(img)._spectrum,y0,z0,c0,y1,z1,c1,y,z,c)
809   -#define cimg_for_outXYZC(img,x0,y0,z0,c0,x1,y1,z1,c1,x,y,z,c) \
810   - cimg_for_out4((img)._width,(img)._height,(img)._depth,(img)._spectrum,x0,y0,z0,c0,x1,y1,z1,c1,x,y,z,c)
811   -#define cimg_for_borderX(img,x,n) cimg_for_outX(img,n,(img)._width - 1 - (n),x)
812   -#define cimg_for_borderY(img,y,n) cimg_for_outY(img,n,(img)._height - 1 - (n),y)
813   -#define cimg_for_borderZ(img,z,n) cimg_for_outZ(img,n,(img)._depth - 1 - (n),z)
814   -#define cimg_for_borderC(img,c,n) cimg_for_outC(img,n,(img)._spectrum - 1 - (n),c)
815   -#define cimg_for_borderXY(img,x,y,n) cimg_for_outXY(img,n,n,(img)._width - 1 - (n),(img)._height - 1 - (n),x,y)
816   -#define cimg_for_borderXYZ(img,x,y,z,n) \
817   - cimg_for_outXYZ(img,n,n,n,(img)._width - 1 - (n),(img)._height - 1 - (n),(img)._depth - 1 - (n),x,y,z)
818   -#define cimg_for_borderXYZC(img,x,y,z,c,n) \
819   - cimg_for_outXYZC(img,n,n,n,n,(img)._width - 1 - (n),(img)._height - 1 - (n), \
820   - (img)._depth - 1 - (n),(img)._spectrum - 1 - (n),x,y,z,c)
821   -
822   -#define cimg_for_spiralXY(img,x,y) \
823   - for (int x = 0, y = 0, _n1##x = 1, _n1##y = (img).width()*(img).height(); _n1##y; \
824   - --_n1##y, _n1##x+=(_n1##x>>2) - ((!(_n1##x&3)?--y:((_n1##x&3)==1?(img)._width - 1 - ++x:\
825   - ((_n1##x&3)==2?(img)._height - 1 - ++y:--x))))?0:1)
826   -
827   -#define cimg_for_lineXY(x,y,x0,y0,x1,y1) \
828   - for (int x = (int)(x0), y = (int)(y0), _sx = 1, _sy = 1, _steep = 0, \
829   - _dx=(x1)>(x0)?(int)(x1) - (int)(x0):(_sx=-1,(int)(x0) - (int)(x1)), \
830   - _dy=(y1)>(y0)?(int)(y1) - (int)(y0):(_sy=-1,(int)(y0) - (int)(y1)), \
831   - _counter = _dx, \
832   - _err = _dx>_dy?(_dy>>1):((_steep=1),(_counter=_dy),(_dx>>1)); \
833   - _counter>=0; \
834   - --_counter, x+=_steep? \
835   - (y+=_sy,(_err-=_dx)<0?_err+=_dy,_sx:0): \
836   - (y+=(_err-=_dy)<0?_err+=_dx,_sy:0,_sx))
837   -
838   -#define cimg_for2(bound,i) \
839   - for (int i = 0, _n1##i = 1>=(bound)?(int)(bound) - 1:1; \
840   - _n1##i<(int)(bound) || i==--_n1##i; \
841   - ++i, ++_n1##i)
842   -#define cimg_for2X(img,x) cimg_for2((img)._width,x)
843   -#define cimg_for2Y(img,y) cimg_for2((img)._height,y)
844   -#define cimg_for2Z(img,z) cimg_for2((img)._depth,z)
845   -#define cimg_for2C(img,c) cimg_for2((img)._spectrum,c)
846   -#define cimg_for2XY(img,x,y) cimg_for2Y(img,y) cimg_for2X(img,x)
847   -#define cimg_for2XZ(img,x,z) cimg_for2Z(img,z) cimg_for2X(img,x)
848   -#define cimg_for2XC(img,x,c) cimg_for2C(img,c) cimg_for2X(img,x)
849   -#define cimg_for2YZ(img,y,z) cimg_for2Z(img,z) cimg_for2Y(img,y)
850   -#define cimg_for2YC(img,y,c) cimg_for2C(img,c) cimg_for2Y(img,y)
851   -#define cimg_for2ZC(img,z,c) cimg_for2C(img,c) cimg_for2Z(img,z)
852   -#define cimg_for2XYZ(img,x,y,z) cimg_for2Z(img,z) cimg_for2XY(img,x,y)
853   -#define cimg_for2XZC(img,x,z,c) cimg_for2C(img,c) cimg_for2XZ(img,x,z)
854   -#define cimg_for2YZC(img,y,z,c) cimg_for2C(img,c) cimg_for2YZ(img,y,z)
855   -#define cimg_for2XYZC(img,x,y,z,c) cimg_for2C(img,c) cimg_for2XYZ(img,x,y,z)
856   -
857   -#define cimg_for_in2(bound,i0,i1,i) \
858   - for (int i = (int)(i0)<0?0:(int)(i0), \
859   - _n1##i = i + 1>=(int)(bound)?(int)(bound) - 1:i + 1; \
860   - i<=(int)(i1) && (_n1##i<(int)(bound) || i==--_n1##i); \
861   - ++i, ++_n1##i)
862   -#define cimg_for_in2X(img,x0,x1,x) cimg_for_in2((img)._width,x0,x1,x)
863   -#define cimg_for_in2Y(img,y0,y1,y) cimg_for_in2((img)._height,y0,y1,y)
864   -#define cimg_for_in2Z(img,z0,z1,z) cimg_for_in2((img)._depth,z0,z1,z)
865   -#define cimg_for_in2C(img,c0,c1,c) cimg_for_in2((img)._spectrum,c0,c1,c)
866   -#define cimg_for_in2XY(img,x0,y0,x1,y1,x,y) cimg_for_in2Y(img,y0,y1,y) cimg_for_in2X(img,x0,x1,x)
867   -#define cimg_for_in2XZ(img,x0,z0,x1,z1,x,z) cimg_for_in2Z(img,z0,z1,z) cimg_for_in2X(img,x0,x1,x)
868   -#define cimg_for_in2XC(img,x0,c0,x1,c1,x,c) cimg_for_in2C(img,c0,c1,c) cimg_for_in2X(img,x0,x1,x)
869   -#define cimg_for_in2YZ(img,y0,z0,y1,z1,y,z) cimg_for_in2Z(img,z0,z1,z) cimg_for_in2Y(img,y0,y1,y)
870   -#define cimg_for_in2YC(img,y0,c0,y1,c1,y,c) cimg_for_in2C(img,c0,c1,c) cimg_for_in2Y(img,y0,y1,y)
871   -#define cimg_for_in2ZC(img,z0,c0,z1,c1,z,c) cimg_for_in2C(img,c0,c1,c) cimg_for_in2Z(img,z0,z1,z)
872   -#define cimg_for_in2XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z) cimg_for_in2Z(img,z0,z1,z) cimg_for_in2XY(img,x0,y0,x1,y1,x,y)
873   -#define cimg_for_in2XZC(img,x0,z0,c0,x1,y1,c1,x,z,c) cimg_for_in2C(img,c0,c1,c) cimg_for_in2XZ(img,x0,y0,x1,y1,x,z)
874   -#define cimg_for_in2YZC(img,y0,z0,c0,y1,z1,c1,y,z,c) cimg_for_in2C(img,c0,c1,c) cimg_for_in2YZ(img,y0,z0,y1,z1,y,z)
875   -#define cimg_for_in2XYZC(img,x0,y0,z0,c0,x1,y1,z1,c1,x,y,z,c) \
876   - cimg_for_in2C(img,c0,c1,c) cimg_for_in2XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z)
877   -
878   -#define cimg_for3(bound,i) \
879   - for (int i = 0, _p1##i = 0, \
880   - _n1##i = 1>=(bound)?(int)(bound) - 1:1; \
881   - _n1##i<(int)(bound) || i==--_n1##i; \
882   - _p1##i = i++, ++_n1##i)
883   -#define cimg_for3X(img,x) cimg_for3((img)._width,x)
884   -#define cimg_for3Y(img,y) cimg_for3((img)._height,y)
885   -#define cimg_for3Z(img,z) cimg_for3((img)._depth,z)
886   -#define cimg_for3C(img,c) cimg_for3((img)._spectrum,c)
887   -#define cimg_for3XY(img,x,y) cimg_for3Y(img,y) cimg_for3X(img,x)
888   -#define cimg_for3XZ(img,x,z) cimg_for3Z(img,z) cimg_for3X(img,x)
889   -#define cimg_for3XC(img,x,c) cimg_for3C(img,c) cimg_for3X(img,x)
890   -#define cimg_for3YZ(img,y,z) cimg_for3Z(img,z) cimg_for3Y(img,y)
891   -#define cimg_for3YC(img,y,c) cimg_for3C(img,c) cimg_for3Y(img,y)
892   -#define cimg_for3ZC(img,z,c) cimg_for3C(img,c) cimg_for3Z(img,z)
893   -#define cimg_for3XYZ(img,x,y,z) cimg_for3Z(img,z) cimg_for3XY(img,x,y)
894   -#define cimg_for3XZC(img,x,z,c) cimg_for3C(img,c) cimg_for3XZ(img,x,z)
895   -#define cimg_for3YZC(img,y,z,c) cimg_for3C(img,c) cimg_for3YZ(img,y,z)
896   -#define cimg_for3XYZC(img,x,y,z,c) cimg_for3C(img,c) cimg_for3XYZ(img,x,y,z)
897   -
898   -#define cimg_for_in3(bound,i0,i1,i) \
899   - for (int i = (int)(i0)<0?0:(int)(i0), \
900   - _p1##i = i - 1<0?0:i - 1, \
901   - _n1##i = i + 1>=(int)(bound)?(int)(bound) - 1:i + 1; \
902   - i<=(int)(i1) && (_n1##i<(int)(bound) || i==--_n1##i); \
903   - _p1##i = i++, ++_n1##i)
904   -#define cimg_for_in3X(img,x0,x1,x) cimg_for_in3((img)._width,x0,x1,x)
905   -#define cimg_for_in3Y(img,y0,y1,y) cimg_for_in3((img)._height,y0,y1,y)
906   -#define cimg_for_in3Z(img,z0,z1,z) cimg_for_in3((img)._depth,z0,z1,z)
907   -#define cimg_for_in3C(img,c0,c1,c) cimg_for_in3((img)._spectrum,c0,c1,c)
908   -#define cimg_for_in3XY(img,x0,y0,x1,y1,x,y) cimg_for_in3Y(img,y0,y1,y) cimg_for_in3X(img,x0,x1,x)
909   -#define cimg_for_in3XZ(img,x0,z0,x1,z1,x,z) cimg_for_in3Z(img,z0,z1,z) cimg_for_in3X(img,x0,x1,x)
910   -#define cimg_for_in3XC(img,x0,c0,x1,c1,x,c) cimg_for_in3C(img,c0,c1,c) cimg_for_in3X(img,x0,x1,x)
911   -#define cimg_for_in3YZ(img,y0,z0,y1,z1,y,z) cimg_for_in3Z(img,z0,z1,z) cimg_for_in3Y(img,y0,y1,y)
912   -#define cimg_for_in3YC(img,y0,c0,y1,c1,y,c) cimg_for_in3C(img,c0,c1,c) cimg_for_in3Y(img,y0,y1,y)
913   -#define cimg_for_in3ZC(img,z0,c0,z1,c1,z,c) cimg_for_in3C(img,c0,c1,c) cimg_for_in3Z(img,z0,z1,z)
914   -#define cimg_for_in3XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z) cimg_for_in3Z(img,z0,z1,z) cimg_for_in3XY(img,x0,y0,x1,y1,x,y)
915   -#define cimg_for_in3XZC(img,x0,z0,c0,x1,y1,c1,x,z,c) cimg_for_in3C(img,c0,c1,c) cimg_for_in3XZ(img,x0,y0,x1,y1,x,z)
916   -#define cimg_for_in3YZC(img,y0,z0,c0,y1,z1,c1,y,z,c) cimg_for_in3C(img,c0,c1,c) cimg_for_in3YZ(img,y0,z0,y1,z1,y,z)
917   -#define cimg_for_in3XYZC(img,x0,y0,z0,c0,x1,y1,z1,c1,x,y,z,c) \
918   - cimg_for_in3C(img,c0,c1,c) cimg_for_in3XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z)
919   -
920   -#define cimg_for4(bound,i) \
921   - for (int i = 0, _p1##i = 0, _n1##i = 1>=(bound)?(int)(bound) - 1:1, \
922   - _n2##i = 2>=(bound)?(int)(bound) - 1:2; \
923   - _n2##i<(int)(bound) || _n1##i==--_n2##i || i==(_n2##i = --_n1##i); \
924   - _p1##i = i++, ++_n1##i, ++_n2##i)
925   -#define cimg_for4X(img,x) cimg_for4((img)._width,x)
926   -#define cimg_for4Y(img,y) cimg_for4((img)._height,y)
927   -#define cimg_for4Z(img,z) cimg_for4((img)._depth,z)
928   -#define cimg_for4C(img,c) cimg_for4((img)._spectrum,c)
929   -#define cimg_for4XY(img,x,y) cimg_for4Y(img,y) cimg_for4X(img,x)
930   -#define cimg_for4XZ(img,x,z) cimg_for4Z(img,z) cimg_for4X(img,x)
931   -#define cimg_for4XC(img,x,c) cimg_for4C(img,c) cimg_for4X(img,x)
932   -#define cimg_for4YZ(img,y,z) cimg_for4Z(img,z) cimg_for4Y(img,y)
933   -#define cimg_for4YC(img,y,c) cimg_for4C(img,c) cimg_for4Y(img,y)
934   -#define cimg_for4ZC(img,z,c) cimg_for4C(img,c) cimg_for4Z(img,z)
935   -#define cimg_for4XYZ(img,x,y,z) cimg_for4Z(img,z) cimg_for4XY(img,x,y)
936   -#define cimg_for4XZC(img,x,z,c) cimg_for4C(img,c) cimg_for4XZ(img,x,z)
937   -#define cimg_for4YZC(img,y,z,c) cimg_for4C(img,c) cimg_for4YZ(img,y,z)
938   -#define cimg_for4XYZC(img,x,y,z,c) cimg_for4C(img,c) cimg_for4XYZ(img,x,y,z)
939   -
940   -#define cimg_for_in4(bound,i0,i1,i) \
941   - for (int i = (int)(i0)<0?0:(int)(i0), \
942   - _p1##i = i - 1<0?0:i - 1, \
943   - _n1##i = i + 1>=(int)(bound)?(int)(bound) - 1:i + 1, \
944   - _n2##i = i + 2>=(int)(bound)?(int)(bound) - 1:i + 2; \
945   - i<=(int)(i1) && (_n2##i<(int)(bound) || _n1##i==--_n2##i || i==(_n2##i = --_n1##i)); \
946   - _p1##i = i++, ++_n1##i, ++_n2##i)
947   -#define cimg_for_in4X(img,x0,x1,x) cimg_for_in4((img)._width,x0,x1,x)
948   -#define cimg_for_in4Y(img,y0,y1,y) cimg_for_in4((img)._height,y0,y1,y)
949   -#define cimg_for_in4Z(img,z0,z1,z) cimg_for_in4((img)._depth,z0,z1,z)
950   -#define cimg_for_in4C(img,c0,c1,c) cimg_for_in4((img)._spectrum,c0,c1,c)
951   -#define cimg_for_in4XY(img,x0,y0,x1,y1,x,y) cimg_for_in4Y(img,y0,y1,y) cimg_for_in4X(img,x0,x1,x)
952   -#define cimg_for_in4XZ(img,x0,z0,x1,z1,x,z) cimg_for_in4Z(img,z0,z1,z) cimg_for_in4X(img,x0,x1,x)
953   -#define cimg_for_in4XC(img,x0,c0,x1,c1,x,c) cimg_for_in4C(img,c0,c1,c) cimg_for_in4X(img,x0,x1,x)
954   -#define cimg_for_in4YZ(img,y0,z0,y1,z1,y,z) cimg_for_in4Z(img,z0,z1,z) cimg_for_in4Y(img,y0,y1,y)
955   -#define cimg_for_in4YC(img,y0,c0,y1,c1,y,c) cimg_for_in4C(img,c0,c1,c) cimg_for_in4Y(img,y0,y1,y)
956   -#define cimg_for_in4ZC(img,z0,c0,z1,c1,z,c) cimg_for_in4C(img,c0,c1,c) cimg_for_in4Z(img,z0,z1,z)
957   -#define cimg_for_in4XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z) cimg_for_in4Z(img,z0,z1,z) cimg_for_in4XY(img,x0,y0,x1,y1,x,y)
958   -#define cimg_for_in4XZC(img,x0,z0,c0,x1,y1,c1,x,z,c) cimg_for_in4C(img,c0,c1,c) cimg_for_in4XZ(img,x0,y0,x1,y1,x,z)
959   -#define cimg_for_in4YZC(img,y0,z0,c0,y1,z1,c1,y,z,c) cimg_for_in4C(img,c0,c1,c) cimg_for_in4YZ(img,y0,z0,y1,z1,y,z)
960   -#define cimg_for_in4XYZC(img,x0,y0,z0,c0,x1,y1,z1,c1,x,y,z,c) \
961   - cimg_for_in4C(img,c0,c1,c) cimg_for_in4XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z)
962   -
963   -#define cimg_for5(bound,i) \
964   - for (int i = 0, _p2##i = 0, _p1##i = 0, \
965   - _n1##i = 1>=(bound)?(int)(bound) - 1:1, \
966   - _n2##i = 2>=(bound)?(int)(bound) - 1:2; \
967   - _n2##i<(int)(bound) || _n1##i==--_n2##i || i==(_n2##i = --_n1##i); \
968   - _p2##i = _p1##i, _p1##i = i++, ++_n1##i, ++_n2##i)
969   -#define cimg_for5X(img,x) cimg_for5((img)._width,x)
970   -#define cimg_for5Y(img,y) cimg_for5((img)._height,y)
971   -#define cimg_for5Z(img,z) cimg_for5((img)._depth,z)
972   -#define cimg_for5C(img,c) cimg_for5((img)._spectrum,c)
973   -#define cimg_for5XY(img,x,y) cimg_for5Y(img,y) cimg_for5X(img,x)
974   -#define cimg_for5XZ(img,x,z) cimg_for5Z(img,z) cimg_for5X(img,x)
975   -#define cimg_for5XC(img,x,c) cimg_for5C(img,c) cimg_for5X(img,x)
976   -#define cimg_for5YZ(img,y,z) cimg_for5Z(img,z) cimg_for5Y(img,y)
977   -#define cimg_for5YC(img,y,c) cimg_for5C(img,c) cimg_for5Y(img,y)
978   -#define cimg_for5ZC(img,z,c) cimg_for5C(img,c) cimg_for5Z(img,z)
979   -#define cimg_for5XYZ(img,x,y,z) cimg_for5Z(img,z) cimg_for5XY(img,x,y)
980   -#define cimg_for5XZC(img,x,z,c) cimg_for5C(img,c) cimg_for5XZ(img,x,z)
981   -#define cimg_for5YZC(img,y,z,c) cimg_for5C(img,c) cimg_for5YZ(img,y,z)
982   -#define cimg_for5XYZC(img,x,y,z,c) cimg_for5C(img,c) cimg_for5XYZ(img,x,y,z)
983   -
984   -#define cimg_for_in5(bound,i0,i1,i) \
985   - for (int i = (int)(i0)<0?0:(int)(i0), \
986   - _p2##i = i - 2<0?0:i - 2, \
987   - _p1##i = i - 1<0?0:i - 1, \
988   - _n1##i = i + 1>=(int)(bound)?(int)(bound) - 1:i + 1, \
989   - _n2##i = i + 2>=(int)(bound)?(int)(bound) - 1:i + 2; \
990   - i<=(int)(i1) && (_n2##i<(int)(bound) || _n1##i==--_n2##i || i==(_n2##i = --_n1##i)); \
991   - _p2##i = _p1##i, _p1##i = i++, ++_n1##i, ++_n2##i)
992   -#define cimg_for_in5X(img,x0,x1,x) cimg_for_in5((img)._width,x0,x1,x)
993   -#define cimg_for_in5Y(img,y0,y1,y) cimg_for_in5((img)._height,y0,y1,y)
994   -#define cimg_for_in5Z(img,z0,z1,z) cimg_for_in5((img)._depth,z0,z1,z)
995   -#define cimg_for_in5C(img,c0,c1,c) cimg_for_in5((img)._spectrum,c0,c1,c)
996   -#define cimg_for_in5XY(img,x0,y0,x1,y1,x,y) cimg_for_in5Y(img,y0,y1,y) cimg_for_in5X(img,x0,x1,x)
997   -#define cimg_for_in5XZ(img,x0,z0,x1,z1,x,z) cimg_for_in5Z(img,z0,z1,z) cimg_for_in5X(img,x0,x1,x)
998   -#define cimg_for_in5XC(img,x0,c0,x1,c1,x,c) cimg_for_in5C(img,c0,c1,c) cimg_for_in5X(img,x0,x1,x)
999   -#define cimg_for_in5YZ(img,y0,z0,y1,z1,y,z) cimg_for_in5Z(img,z0,z1,z) cimg_for_in5Y(img,y0,y1,y)
1000   -#define cimg_for_in5YC(img,y0,c0,y1,c1,y,c) cimg_for_in5C(img,c0,c1,c) cimg_for_in5Y(img,y0,y1,y)
1001   -#define cimg_for_in5ZC(img,z0,c0,z1,c1,z,c) cimg_for_in5C(img,c0,c1,c) cimg_for_in5Z(img,z0,z1,z)
1002   -#define cimg_for_in5XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z) cimg_for_in5Z(img,z0,z1,z) cimg_for_in5XY(img,x0,y0,x1,y1,x,y)
1003   -#define cimg_for_in5XZC(img,x0,z0,c0,x1,y1,c1,x,z,c) cimg_for_in5C(img,c0,c1,c) cimg_for_in5XZ(img,x0,y0,x1,y1,x,z)
1004   -#define cimg_for_in5YZC(img,y0,z0,c0,y1,z1,c1,y,z,c) cimg_for_in5C(img,c0,c1,c) cimg_for_in5YZ(img,y0,z0,y1,z1,y,z)
1005   -#define cimg_for_in5XYZC(img,x0,y0,z0,c0,x1,y1,z1,c1,x,y,z,c) \
1006   - cimg_for_in5C(img,c0,c1,c) cimg_for_in5XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z)
1007   -
1008   -#define cimg_for6(bound,i) \
1009   - for (int i = 0, _p2##i = 0, _p1##i = 0, \
1010   - _n1##i = 1>=(bound)?(int)(bound) - 1:1, \
1011   - _n2##i = 2>=(bound)?(int)(bound) - 1:2, \
1012   - _n3##i = 3>=(bound)?(int)(bound) - 1:3; \
1013   - _n3##i<(int)(bound) || _n2##i==--_n3##i || _n1##i==--_n2##i || i==(_n3##i = _n2##i = --_n1##i); \
1014   - _p2##i = _p1##i, _p1##i = i++, ++_n1##i, ++_n2##i, ++_n3##i)
1015   -#define cimg_for6X(img,x) cimg_for6((img)._width,x)
1016   -#define cimg_for6Y(img,y) cimg_for6((img)._height,y)
1017   -#define cimg_for6Z(img,z) cimg_for6((img)._depth,z)
1018   -#define cimg_for6C(img,c) cimg_for6((img)._spectrum,c)
1019   -#define cimg_for6XY(img,x,y) cimg_for6Y(img,y) cimg_for6X(img,x)
1020   -#define cimg_for6XZ(img,x,z) cimg_for6Z(img,z) cimg_for6X(img,x)
1021   -#define cimg_for6XC(img,x,c) cimg_for6C(img,c) cimg_for6X(img,x)
1022   -#define cimg_for6YZ(img,y,z) cimg_for6Z(img,z) cimg_for6Y(img,y)
1023   -#define cimg_for6YC(img,y,c) cimg_for6C(img,c) cimg_for6Y(img,y)
1024   -#define cimg_for6ZC(img,z,c) cimg_for6C(img,c) cimg_for6Z(img,z)
1025   -#define cimg_for6XYZ(img,x,y,z) cimg_for6Z(img,z) cimg_for6XY(img,x,y)
1026   -#define cimg_for6XZC(img,x,z,c) cimg_for6C(img,c) cimg_for6XZ(img,x,z)
1027   -#define cimg_for6YZC(img,y,z,c) cimg_for6C(img,c) cimg_for6YZ(img,y,z)
1028   -#define cimg_for6XYZC(img,x,y,z,c) cimg_for6C(img,c) cimg_for6XYZ(img,x,y,z)
1029   -
1030   -#define cimg_for_in6(bound,i0,i1,i) \
1031   - for (int i = (int)(i0)<0?0:(int)(i0), \
1032   - _p2##i = i - 2<0?0:i - 2, \
1033   - _p1##i = i - 1<0?0:i - 1, \
1034   - _n1##i = i + 1>=(int)(bound)?(int)(bound) - 1:i + 1, \
1035   - _n2##i = i + 2>=(int)(bound)?(int)(bound) - 1:i + 2, \
1036   - _n3##i = i + 3>=(int)(bound)?(int)(bound) - 1:i + 3; \
1037   - i<=(int)(i1) && \
1038   - (_n3##i<(int)(bound) || _n2##i==--_n3##i || _n1##i==--_n2##i || i==(_n3##i = _n2##i = --_n1##i)); \
1039   - _p2##i = _p1##i, _p1##i = i++, ++_n1##i, ++_n2##i, ++_n3##i)
1040   -#define cimg_for_in6X(img,x0,x1,x) cimg_for_in6((img)._width,x0,x1,x)
1041   -#define cimg_for_in6Y(img,y0,y1,y) cimg_for_in6((img)._height,y0,y1,y)
1042   -#define cimg_for_in6Z(img,z0,z1,z) cimg_for_in6((img)._depth,z0,z1,z)
1043   -#define cimg_for_in6C(img,c0,c1,c) cimg_for_in6((img)._spectrum,c0,c1,c)
1044   -#define cimg_for_in6XY(img,x0,y0,x1,y1,x,y) cimg_for_in6Y(img,y0,y1,y) cimg_for_in6X(img,x0,x1,x)
1045   -#define cimg_for_in6XZ(img,x0,z0,x1,z1,x,z) cimg_for_in6Z(img,z0,z1,z) cimg_for_in6X(img,x0,x1,x)
1046   -#define cimg_for_in6XC(img,x0,c0,x1,c1,x,c) cimg_for_in6C(img,c0,c1,c) cimg_for_in6X(img,x0,x1,x)
1047   -#define cimg_for_in6YZ(img,y0,z0,y1,z1,y,z) cimg_for_in6Z(img,z0,z1,z) cimg_for_in6Y(img,y0,y1,y)
1048   -#define cimg_for_in6YC(img,y0,c0,y1,c1,y,c) cimg_for_in6C(img,c0,c1,c) cimg_for_in6Y(img,y0,y1,y)
1049   -#define cimg_for_in6ZC(img,z0,c0,z1,c1,z,c) cimg_for_in6C(img,c0,c1,c) cimg_for_in6Z(img,z0,z1,z)
1050   -#define cimg_for_in6XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z) cimg_for_in6Z(img,z0,z1,z) cimg_for_in6XY(img,x0,y0,x1,y1,x,y)
1051   -#define cimg_for_in6XZC(img,x0,z0,c0,x1,y1,c1,x,z,c) cimg_for_in6C(img,c0,c1,c) cimg_for_in6XZ(img,x0,y0,x1,y1,x,z)
1052   -#define cimg_for_in6YZC(img,y0,z0,c0,y1,z1,c1,y,z,c) cimg_for_in6C(img,c0,c1,c) cimg_for_in6YZ(img,y0,z0,y1,z1,y,z)
1053   -#define cimg_for_in6XYZC(img,x0,y0,z0,c0,x1,y1,z1,c1,x,y,z,c) \
1054   - cimg_for_in6C(img,c0,c1,c) cimg_for_in6XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z)
1055   -
1056   -#define cimg_for7(bound,i) \
1057   - for (int i = 0, _p3##i = 0, _p2##i = 0, _p1##i = 0, \
1058   - _n1##i = 1>=(bound)?(int)(bound) - 1:1, \
1059   - _n2##i = 2>=(bound)?(int)(bound) - 1:2, \
1060   - _n3##i = 3>=(bound)?(int)(bound) - 1:3; \
1061   - _n3##i<(int)(bound) || _n2##i==--_n3##i || _n1##i==--_n2##i || i==(_n3##i = _n2##i = --_n1##i); \
1062   - _p3##i = _p2##i, _p2##i = _p1##i, _p1##i = i++, ++_n1##i, ++_n2##i, ++_n3##i)
1063   -#define cimg_for7X(img,x) cimg_for7((img)._width,x)
1064   -#define cimg_for7Y(img,y) cimg_for7((img)._height,y)
1065   -#define cimg_for7Z(img,z) cimg_for7((img)._depth,z)
1066   -#define cimg_for7C(img,c) cimg_for7((img)._spectrum,c)
1067   -#define cimg_for7XY(img,x,y) cimg_for7Y(img,y) cimg_for7X(img,x)
1068   -#define cimg_for7XZ(img,x,z) cimg_for7Z(img,z) cimg_for7X(img,x)
1069   -#define cimg_for7XC(img,x,c) cimg_for7C(img,c) cimg_for7X(img,x)
1070   -#define cimg_for7YZ(img,y,z) cimg_for7Z(img,z) cimg_for7Y(img,y)
1071   -#define cimg_for7YC(img,y,c) cimg_for7C(img,c) cimg_for7Y(img,y)
1072   -#define cimg_for7ZC(img,z,c) cimg_for7C(img,c) cimg_for7Z(img,z)
1073   -#define cimg_for7XYZ(img,x,y,z) cimg_for7Z(img,z) cimg_for7XY(img,x,y)
1074   -#define cimg_for7XZC(img,x,z,c) cimg_for7C(img,c) cimg_for7XZ(img,x,z)
1075   -#define cimg_for7YZC(img,y,z,c) cimg_for7C(img,c) cimg_for7YZ(img,y,z)
1076   -#define cimg_for7XYZC(img,x,y,z,c) cimg_for7C(img,c) cimg_for7XYZ(img,x,y,z)
1077   -
1078   -#define cimg_for_in7(bound,i0,i1,i) \
1079   - for (int i = (int)(i0)<0?0:(int)(i0), \
1080   - _p3##i = i - 3<0?0:i - 3, \
1081   - _p2##i = i - 2<0?0:i - 2, \
1082   - _p1##i = i - 1<0?0:i - 1, \
1083   - _n1##i = i + 1>=(int)(bound)?(int)(bound) - 1:i + 1, \
1084   - _n2##i = i + 2>=(int)(bound)?(int)(bound) - 1:i + 2, \
1085   - _n3##i = i + 3>=(int)(bound)?(int)(bound) - 1:i + 3; \
1086   - i<=(int)(i1) && \
1087   - (_n3##i<(int)(bound) || _n2##i==--_n3##i || _n1##i==--_n2##i || i==(_n3##i = _n2##i = --_n1##i)); \
1088   - _p3##i = _p2##i, _p2##i = _p1##i, _p1##i = i++, ++_n1##i, ++_n2##i, ++_n3##i)
1089   -#define cimg_for_in7X(img,x0,x1,x) cimg_for_in7((img)._width,x0,x1,x)
1090   -#define cimg_for_in7Y(img,y0,y1,y) cimg_for_in7((img)._height,y0,y1,y)
1091   -#define cimg_for_in7Z(img,z0,z1,z) cimg_for_in7((img)._depth,z0,z1,z)
1092   -#define cimg_for_in7C(img,c0,c1,c) cimg_for_in7((img)._spectrum,c0,c1,c)
1093   -#define cimg_for_in7XY(img,x0,y0,x1,y1,x,y) cimg_for_in7Y(img,y0,y1,y) cimg_for_in7X(img,x0,x1,x)
1094   -#define cimg_for_in7XZ(img,x0,z0,x1,z1,x,z) cimg_for_in7Z(img,z0,z1,z) cimg_for_in7X(img,x0,x1,x)
1095   -#define cimg_for_in7XC(img,x0,c0,x1,c1,x,c) cimg_for_in7C(img,c0,c1,c) cimg_for_in7X(img,x0,x1,x)
1096   -#define cimg_for_in7YZ(img,y0,z0,y1,z1,y,z) cimg_for_in7Z(img,z0,z1,z) cimg_for_in7Y(img,y0,y1,y)
1097   -#define cimg_for_in7YC(img,y0,c0,y1,c1,y,c) cimg_for_in7C(img,c0,c1,c) cimg_for_in7Y(img,y0,y1,y)
1098   -#define cimg_for_in7ZC(img,z0,c0,z1,c1,z,c) cimg_for_in7C(img,c0,c1,c) cimg_for_in7Z(img,z0,z1,z)
1099   -#define cimg_for_in7XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z) cimg_for_in7Z(img,z0,z1,z) cimg_for_in7XY(img,x0,y0,x1,y1,x,y)
1100   -#define cimg_for_in7XZC(img,x0,z0,c0,x1,y1,c1,x,z,c) cimg_for_in7C(img,c0,c1,c) cimg_for_in7XZ(img,x0,y0,x1,y1,x,z)
1101   -#define cimg_for_in7YZC(img,y0,z0,c0,y1,z1,c1,y,z,c) cimg_for_in7C(img,c0,c1,c) cimg_for_in7YZ(img,y0,z0,y1,z1,y,z)
1102   -#define cimg_for_in7XYZC(img,x0,y0,z0,c0,x1,y1,z1,c1,x,y,z,c) \
1103   - cimg_for_in7C(img,c0,c1,c) cimg_for_in7XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z)
1104   -
1105   -#define cimg_for8(bound,i) \
1106   - for (int i = 0, _p3##i = 0, _p2##i = 0, _p1##i = 0, \
1107   - _n1##i = 1>=(bound)?(int)(bound) - 1:1, \
1108   - _n2##i = 2>=(bound)?(int)(bound) - 1:2, \
1109   - _n3##i = 3>=(bound)?(int)(bound) - 1:3, \
1110   - _n4##i = 4>=(bound)?(int)(bound) - 1:4; \
1111   - _n4##i<(int)(bound) || _n3##i==--_n4##i || _n2##i==--_n3##i || _n1##i==--_n2##i || \
1112   - i==(_n4##i = _n3##i = _n2##i = --_n1##i); \
1113   - _p3##i = _p2##i, _p2##i = _p1##i, _p1##i = i++, ++_n1##i, ++_n2##i, ++_n3##i, ++_n4##i)
1114   -#define cimg_for8X(img,x) cimg_for8((img)._width,x)
1115   -#define cimg_for8Y(img,y) cimg_for8((img)._height,y)
1116   -#define cimg_for8Z(img,z) cimg_for8((img)._depth,z)
1117   -#define cimg_for8C(img,c) cimg_for8((img)._spectrum,c)
1118   -#define cimg_for8XY(img,x,y) cimg_for8Y(img,y) cimg_for8X(img,x)
1119   -#define cimg_for8XZ(img,x,z) cimg_for8Z(img,z) cimg_for8X(img,x)
1120   -#define cimg_for8XC(img,x,c) cimg_for8C(img,c) cimg_for8X(img,x)
1121   -#define cimg_for8YZ(img,y,z) cimg_for8Z(img,z) cimg_for8Y(img,y)
1122   -#define cimg_for8YC(img,y,c) cimg_for8C(img,c) cimg_for8Y(img,y)
1123   -#define cimg_for8ZC(img,z,c) cimg_for8C(img,c) cimg_for8Z(img,z)
1124   -#define cimg_for8XYZ(img,x,y,z) cimg_for8Z(img,z) cimg_for8XY(img,x,y)
1125   -#define cimg_for8XZC(img,x,z,c) cimg_for8C(img,c) cimg_for8XZ(img,x,z)
1126   -#define cimg_for8YZC(img,y,z,c) cimg_for8C(img,c) cimg_for8YZ(img,y,z)
1127   -#define cimg_for8XYZC(img,x,y,z,c) cimg_for8C(img,c) cimg_for8XYZ(img,x,y,z)
1128   -
1129   -#define cimg_for_in8(bound,i0,i1,i) \
1130   - for (int i = (int)(i0)<0?0:(int)(i0), \
1131   - _p3##i = i - 3<0?0:i - 3, \
1132   - _p2##i = i - 2<0?0:i - 2, \
1133   - _p1##i = i - 1<0?0:i - 1, \
1134   - _n1##i = i + 1>=(int)(bound)?(int)(bound) - 1:i + 1, \
1135   - _n2##i = i + 2>=(int)(bound)?(int)(bound) - 1:i + 2, \
1136   - _n3##i = i + 3>=(int)(bound)?(int)(bound) - 1:i + 3, \
1137   - _n4##i = i + 4>=(int)(bound)?(int)(bound) - 1:i + 4; \
1138   - i<=(int)(i1) && (_n4##i<(int)(bound) || _n3##i==--_n4##i || _n2##i==--_n3##i || _n1##i==--_n2##i || \
1139   - i==(_n4##i = _n3##i = _n2##i = --_n1##i)); \
1140   - _p3##i = _p2##i, _p2##i = _p1##i, _p1##i = i++, ++_n1##i, ++_n2##i, ++_n3##i, ++_n4##i)
1141   -#define cimg_for_in8X(img,x0,x1,x) cimg_for_in8((img)._width,x0,x1,x)
1142   -#define cimg_for_in8Y(img,y0,y1,y) cimg_for_in8((img)._height,y0,y1,y)
1143   -#define cimg_for_in8Z(img,z0,z1,z) cimg_for_in8((img)._depth,z0,z1,z)
1144   -#define cimg_for_in8C(img,c0,c1,c) cimg_for_in8((img)._spectrum,c0,c1,c)
1145   -#define cimg_for_in8XY(img,x0,y0,x1,y1,x,y) cimg_for_in8Y(img,y0,y1,y) cimg_for_in8X(img,x0,x1,x)
1146   -#define cimg_for_in8XZ(img,x0,z0,x1,z1,x,z) cimg_for_in8Z(img,z0,z1,z) cimg_for_in8X(img,x0,x1,x)
1147   -#define cimg_for_in8XC(img,x0,c0,x1,c1,x,c) cimg_for_in8C(img,c0,c1,c) cimg_for_in8X(img,x0,x1,x)
1148   -#define cimg_for_in8YZ(img,y0,z0,y1,z1,y,z) cimg_for_in8Z(img,z0,z1,z) cimg_for_in8Y(img,y0,y1,y)
1149   -#define cimg_for_in8YC(img,y0,c0,y1,c1,y,c) cimg_for_in8C(img,c0,c1,c) cimg_for_in8Y(img,y0,y1,y)
1150   -#define cimg_for_in8ZC(img,z0,c0,z1,c1,z,c) cimg_for_in8C(img,c0,c1,c) cimg_for_in8Z(img,z0,z1,z)
1151   -#define cimg_for_in8XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z) cimg_for_in8Z(img,z0,z1,z) cimg_for_in8XY(img,x0,y0,x1,y1,x,y)
1152   -#define cimg_for_in8XZC(img,x0,z0,c0,x1,y1,c1,x,z,c) cimg_for_in8C(img,c0,c1,c) cimg_for_in8XZ(img,x0,y0,x1,y1,x,z)
1153   -#define cimg_for_in8YZC(img,y0,z0,c0,y1,z1,c1,y,z,c) cimg_for_in8C(img,c0,c1,c) cimg_for_in8YZ(img,y0,z0,y1,z1,y,z)
1154   -#define cimg_for_in8XYZC(img,x0,y0,z0,c0,x1,y1,z1,c1,x,y,z,c) \
1155   - cimg_for_in8C(img,c0,c1,c) cimg_for_in8XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z)
1156   -
1157   -#define cimg_for9(bound,i) \
1158   - for (int i = 0, _p4##i = 0, _p3##i = 0, _p2##i = 0, _p1##i = 0, \
1159   - _n1##i = 1>=(int)(bound)?(int)(bound) - 1:1, \
1160   - _n2##i = 2>=(int)(bound)?(int)(bound) - 1:2, \
1161   - _n3##i = 3>=(int)(bound)?(int)(bound) - 1:3, \
1162   - _n4##i = 4>=(int)(bound)?(int)(bound) - 1:4; \
1163   - _n4##i<(int)(bound) || _n3##i==--_n4##i || _n2##i==--_n3##i || _n1##i==--_n2##i || \
1164   - i==(_n4##i = _n3##i = _n2##i = --_n1##i); \
1165   - _p4##i = _p3##i, _p3##i = _p2##i, _p2##i = _p1##i, _p1##i = i++, ++_n1##i, ++_n2##i, ++_n3##i, ++_n4##i)
1166   -#define cimg_for9X(img,x) cimg_for9((img)._width,x)
1167   -#define cimg_for9Y(img,y) cimg_for9((img)._height,y)
1168   -#define cimg_for9Z(img,z) cimg_for9((img)._depth,z)
1169   -#define cimg_for9C(img,c) cimg_for9((img)._spectrum,c)
1170   -#define cimg_for9XY(img,x,y) cimg_for9Y(img,y) cimg_for9X(img,x)
1171   -#define cimg_for9XZ(img,x,z) cimg_for9Z(img,z) cimg_for9X(img,x)
1172   -#define cimg_for9XC(img,x,c) cimg_for9C(img,c) cimg_for9X(img,x)
1173   -#define cimg_for9YZ(img,y,z) cimg_for9Z(img,z) cimg_for9Y(img,y)
1174   -#define cimg_for9YC(img,y,c) cimg_for9C(img,c) cimg_for9Y(img,y)
1175   -#define cimg_for9ZC(img,z,c) cimg_for9C(img,c) cimg_for9Z(img,z)
1176   -#define cimg_for9XYZ(img,x,y,z) cimg_for9Z(img,z) cimg_for9XY(img,x,y)
1177   -#define cimg_for9XZC(img,x,z,c) cimg_for9C(img,c) cimg_for9XZ(img,x,z)
1178   -#define cimg_for9YZC(img,y,z,c) cimg_for9C(img,c) cimg_for9YZ(img,y,z)
1179   -#define cimg_for9XYZC(img,x,y,z,c) cimg_for9C(img,c) cimg_for9XYZ(img,x,y,z)
1180   -
1181   -#define cimg_for_in9(bound,i0,i1,i) \
1182   - for (int i = (int)(i0)<0?0:(int)(i0), \
1183   - _p4##i = i - 4<0?0:i - 4, \
1184   - _p3##i = i - 3<0?0:i - 3, \
1185   - _p2##i = i - 2<0?0:i - 2, \
1186   - _p1##i = i - 1<0?0:i - 1, \
1187   - _n1##i = i + 1>=(int)(bound)?(int)(bound) - 1:i + 1, \
1188   - _n2##i = i + 2>=(int)(bound)?(int)(bound) - 1:i + 2, \
1189   - _n3##i = i + 3>=(int)(bound)?(int)(bound) - 1:i + 3, \
1190   - _n4##i = i + 4>=(int)(bound)?(int)(bound) - 1:i + 4; \
1191   - i<=(int)(i1) && (_n4##i<(int)(bound) || _n3##i==--_n4##i || _n2##i==--_n3##i || _n1##i==--_n2##i || \
1192   - i==(_n4##i = _n3##i = _n2##i = --_n1##i)); \
1193   - _p4##i = _p3##i, _p3##i = _p2##i, _p2##i = _p1##i, _p1##i = i++, ++_n1##i, ++_n2##i, ++_n3##i, ++_n4##i)
1194   -#define cimg_for_in9X(img,x0,x1,x) cimg_for_in9((img)._width,x0,x1,x)
1195   -#define cimg_for_in9Y(img,y0,y1,y) cimg_for_in9((img)._height,y0,y1,y)
1196   -#define cimg_for_in9Z(img,z0,z1,z) cimg_for_in9((img)._depth,z0,z1,z)
1197   -#define cimg_for_in9C(img,c0,c1,c) cimg_for_in9((img)._spectrum,c0,c1,c)
1198   -#define cimg_for_in9XY(img,x0,y0,x1,y1,x,y) cimg_for_in9Y(img,y0,y1,y) cimg_for_in9X(img,x0,x1,x)
1199   -#define cimg_for_in9XZ(img,x0,z0,x1,z1,x,z) cimg_for_in9Z(img,z0,z1,z) cimg_for_in9X(img,x0,x1,x)
1200   -#define cimg_for_in9XC(img,x0,c0,x1,c1,x,c) cimg_for_in9C(img,c0,c1,c) cimg_for_in9X(img,x0,x1,x)
1201   -#define cimg_for_in9YZ(img,y0,z0,y1,z1,y,z) cimg_for_in9Z(img,z0,z1,z) cimg_for_in9Y(img,y0,y1,y)
1202   -#define cimg_for_in9YC(img,y0,c0,y1,c1,y,c) cimg_for_in9C(img,c0,c1,c) cimg_for_in9Y(img,y0,y1,y)
1203   -#define cimg_for_in9ZC(img,z0,c0,z1,c1,z,c) cimg_for_in9C(img,c0,c1,c) cimg_for_in9Z(img,z0,z1,z)
1204   -#define cimg_for_in9XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z) cimg_for_in9Z(img,z0,z1,z) cimg_for_in9XY(img,x0,y0,x1,y1,x,y)
1205   -#define cimg_for_in9XZC(img,x0,z0,c0,x1,y1,c1,x,z,c) cimg_for_in9C(img,c0,c1,c) cimg_for_in9XZ(img,x0,y0,x1,y1,x,z)
1206   -#define cimg_for_in9YZC(img,y0,z0,c0,y1,z1,c1,y,z,c) cimg_for_in9C(img,c0,c1,c) cimg_for_in9YZ(img,y0,z0,y1,z1,y,z)
1207   -#define cimg_for_in9XYZC(img,x0,y0,z0,c0,x1,y1,z1,c1,x,y,z,c) \
1208   - cimg_for_in9C(img,c0,c1,c) cimg_for_in9XYZ(img,x0,y0,z0,x1,y1,z1,x,y,z)
1209   -
1210   -#define cimg_for2x2(img,x,y,z,c,I,T) \
1211   - cimg_for2((img)._height,y) for (int x = 0, \
1212   - _n1##x = (int)( \
1213   - (I[0] = (T)(img)(0,y,z,c)), \
1214   - (I[2] = (T)(img)(0,_n1##y,z,c)), \
1215   - 1>=(img)._width?(img).width() - 1:1); \
1216   - (_n1##x<(img).width() && ( \
1217   - (I[1] = (T)(img)(_n1##x,y,z,c)), \
1218   - (I[3] = (T)(img)(_n1##x,_n1##y,z,c)),1)) || \
1219   - x==--_n1##x; \
1220   - I[0] = I[1], \
1221   - I[2] = I[3], \
1222   - ++x, ++_n1##x)
1223   -
1224   -#define cimg_for_in2x2(img,x0,y0,x1,y1,x,y,z,c,I,T) \
1225   - cimg_for_in2((img)._height,y0,y1,y) for (int x = (int)(x0)<0?0:(int)(x0), \
1226   - _n1##x = (int)( \
1227   - (I[0] = (T)(img)(x,y,z,c)), \
1228   - (I[2] = (T)(img)(x,_n1##y,z,c)), \
1229   - x + 1>=(int)(img)._width?(img).width() - 1:x + 1); \
1230   - x<=(int)(x1) && ((_n1##x<(img).width() && ( \
1231   - (I[1] = (T)(img)(_n1##x,y,z,c)), \
1232   - (I[3] = (T)(img)(_n1##x,_n1##y,z,c)),1)) || \
1233   - x==--_n1##x); \
1234   - I[0] = I[1], \
1235   - I[2] = I[3], \
1236   - ++x, ++_n1##x)
1237   -
1238   -#define cimg_for3x3(img,x,y,z,c,I,T) \
1239   - cimg_for3((img)._height,y) for (int x = 0, \
1240   - _p1##x = 0, \
1241   - _n1##x = (int)( \
1242   - (I[0] = I[1] = (T)(img)(_p1##x,_p1##y,z,c)), \
1243   - (I[3] = I[4] = (T)(img)(0,y,z,c)), \
1244   - (I[6] = I[7] = (T)(img)(0,_n1##y,z,c)), \
1245   - 1>=(img)._width?(img).width() - 1:1); \
1246   - (_n1##x<(img).width() && ( \
1247   - (I[2] = (T)(img)(_n1##x,_p1##y,z,c)), \
1248   - (I[5] = (T)(img)(_n1##x,y,z,c)), \
1249   - (I[8] = (T)(img)(_n1##x,_n1##y,z,c)),1)) || \
1250   - x==--_n1##x; \
1251   - I[0] = I[1], I[1] = I[2], \
1252   - I[3] = I[4], I[4] = I[5], \
1253   - I[6] = I[7], I[7] = I[8], \
1254   - _p1##x = x++, ++_n1##x)
1255   -
1256   -#define cimg_for_in3x3(img,x0,y0,x1,y1,x,y,z,c,I,T) \
1257   - cimg_for_in3((img)._height,y0,y1,y) for (int x = (int)(x0)<0?0:(int)(x0), \
1258   - _p1##x = x - 1<0?0:x - 1, \
1259   - _n1##x = (int)( \
1260   - (I[0] = (T)(img)(_p1##x,_p1##y,z,c)), \
1261   - (I[3] = (T)(img)(_p1##x,y,z,c)), \
1262   - (I[6] = (T)(img)(_p1##x,_n1##y,z,c)), \
1263   - (I[1] = (T)(img)(x,_p1##y,z,c)), \
1264   - (I[4] = (T)(img)(x,y,z,c)), \
1265   - (I[7] = (T)(img)(x,_n1##y,z,c)), \
1266   - x + 1>=(int)(img)._width?(img).width() - 1:x + 1); \
1267   - x<=(int)(x1) && ((_n1##x<(img).width() && ( \
1268   - (I[2] = (T)(img)(_n1##x,_p1##y,z,c)), \
1269   - (I[5] = (T)(img)(_n1##x,y,z,c)), \
1270   - (I[8] = (T)(img)(_n1##x,_n1##y,z,c)),1)) || \
1271   - x==--_n1##x); \
1272   - I[0] = I[1], I[1] = I[2], \
1273   - I[3] = I[4], I[4] = I[5], \
1274   - I[6] = I[7], I[7] = I[8], \
1275   - _p1##x = x++, ++_n1##x)
1276   -
1277   -#define cimg_for4x4(img,x,y,z,c,I,T) \
1278   - cimg_for4((img)._height,y) for (int x = 0, \
1279   - _p1##x = 0, \
1280   - _n1##x = 1>=(img)._width?(img).width() - 1:1, \
1281   - _n2##x = (int)( \
1282   - (I[0] = I[1] = (T)(img)(_p1##x,_p1##y,z,c)), \
1283   - (I[4] = I[5] = (T)(img)(0,y,z,c)), \
1284   - (I[8] = I[9] = (T)(img)(0,_n1##y,z,c)), \
1285   - (I[12] = I[13] = (T)(img)(0,_n2##y,z,c)), \
1286   - (I[2] = (T)(img)(_n1##x,_p1##y,z,c)), \
1287   - (I[6] = (T)(img)(_n1##x,y,z,c)), \
1288   - (I[10] = (T)(img)(_n1##x,_n1##y,z,c)), \
1289   - (I[14] = (T)(img)(_n1##x,_n2##y,z,c)), \
1290   - 2>=(img)._width?(img).width() - 1:2); \
1291   - (_n2##x<(img).width() && ( \
1292   - (I[3] = (T)(img)(_n2##x,_p1##y,z,c)), \
1293   - (I[7] = (T)(img)(_n2##x,y,z,c)), \
1294   - (I[11] = (T)(img)(_n2##x,_n1##y,z,c)), \
1295   - (I[15] = (T)(img)(_n2##x,_n2##y,z,c)),1)) || \
1296   - _n1##x==--_n2##x || x==(_n2##x = --_n1##x); \
1297   - I[0] = I[1], I[1] = I[2], I[2] = I[3], \
1298   - I[4] = I[5], I[5] = I[6], I[6] = I[7], \
1299   - I[8] = I[9], I[9] = I[10], I[10] = I[11], \
1300   - I[12] = I[13], I[13] = I[14], I[14] = I[15], \
1301   - _p1##x = x++, ++_n1##x, ++_n2##x)
1302   -
1303   -#define cimg_for_in4x4(img,x0,y0,x1,y1,x,y,z,c,I,T) \
1304   - cimg_for_in4((img)._height,y0,y1,y) for (int x = (int)(x0)<0?0:(int)(x0), \
1305   - _p1##x = x - 1<0?0:x - 1, \
1306   - _n1##x = x + 1>=(int)(img)._width?(img).width() - 1:x + 1, \
1307   - _n2##x = (int)( \
1308   - (I[0] = (T)(img)(_p1##x,_p1##y,z,c)), \
1309   - (I[4] = (T)(img)(_p1##x,y,z,c)), \
1310   - (I[8] = (T)(img)(_p1##x,_n1##y,z,c)), \
1311   - (I[12] = (T)(img)(_p1##x,_n2##y,z,c)), \
1312   - (I[1] = (T)(img)(x,_p1##y,z,c)), \
1313   - (I[5] = (T)(img)(x,y,z,c)), \
1314   - (I[9] = (T)(img)(x,_n1##y,z,c)), \
1315   - (I[13] = (T)(img)(x,_n2##y,z,c)), \
1316   - (I[2] = (T)(img)(_n1##x,_p1##y,z,c)), \
1317   - (I[6] = (T)(img)(_n1##x,y,z,c)), \
1318   - (I[10] = (T)(img)(_n1##x,_n1##y,z,c)), \
1319   - (I[14] = (T)(img)(_n1##x,_n2##y,z,c)), \
1320   - x + 2>=(int)(img)._width?(img).width() - 1:x + 2); \
1321   - x<=(int)(x1) && ((_n2##x<(img).width() && ( \
1322   - (I[3] = (T)(img)(_n2##x,_p1##y,z,c)), \
1323   - (I[7] = (T)(img)(_n2##x,y,z,c)), \
1324   - (I[11] = (T)(img)(_n2##x,_n1##y,z,c)), \
1325   - (I[15] = (T)(img)(_n2##x,_n2##y,z,c)),1)) || \
1326   - _n1##x==--_n2##x || x==(_n2##x = --_n1##x)); \
1327   - I[0] = I[1], I[1] = I[2], I[2] = I[3], \
1328   - I[4] = I[5], I[5] = I[6], I[6] = I[7], \
1329   - I[8] = I[9], I[9] = I[10], I[10] = I[11], \
1330   - I[12] = I[13], I[13] = I[14], I[14] = I[15], \
1331   - _p1##x = x++, ++_n1##x, ++_n2##x)
1332   -
1333   -#define cimg_for5x5(img,x,y,z,c,I,T) \
1334   - cimg_for5((img)._height,y) for (int x = 0, \
1335   - _p2##x = 0, _p1##x = 0, \
1336   - _n1##x = 1>=(img)._width?(img).width() - 1:1, \
1337   - _n2##x = (int)( \
1338   - (I[0] = I[1] = I[2] = (T)(img)(_p2##x,_p2##y,z,c)), \
1339   - (I[5] = I[6] = I[7] = (T)(img)(0,_p1##y,z,c)), \
1340   - (I[10] = I[11] = I[12] = (T)(img)(0,y,z,c)), \
1341   - (I[15] = I[16] = I[17] = (T)(img)(0,_n1##y,z,c)), \
1342   - (I[20] = I[21] = I[22] = (T)(img)(0,_n2##y,z,c)), \
1343   - (I[3] = (T)(img)(_n1##x,_p2##y,z,c)), \
1344   - (I[8] = (T)(img)(_n1##x,_p1##y,z,c)), \
1345   - (I[13] = (T)(img)(_n1##x,y,z,c)), \
1346   - (I[18] = (T)(img)(_n1##x,_n1##y,z,c)), \
1347   - (I[23] = (T)(img)(_n1##x,_n2##y,z,c)), \
1348   - 2>=(img)._width?(img).width() - 1:2); \
1349   - (_n2##x<(img).width() && ( \
1350   - (I[4] = (T)(img)(_n2##x,_p2##y,z,c)), \
1351   - (I[9] = (T)(img)(_n2##x,_p1##y,z,c)), \
1352   - (I[14] = (T)(img)(_n2##x,y,z,c)), \
1353   - (I[19] = (T)(img)(_n2##x,_n1##y,z,c)), \
1354   - (I[24] = (T)(img)(_n2##x,_n2##y,z,c)),1)) || \
1355   - _n1##x==--_n2##x || x==(_n2##x = --_n1##x); \
1356   - I[0] = I[1], I[1] = I[2], I[2] = I[3], I[3] = I[4], \
1357   - I[5] = I[6], I[6] = I[7], I[7] = I[8], I[8] = I[9], \
1358   - I[10] = I[11], I[11] = I[12], I[12] = I[13], I[13] = I[14], \
1359   - I[15] = I[16], I[16] = I[17], I[17] = I[18], I[18] = I[19], \
1360   - I[20] = I[21], I[21] = I[22], I[22] = I[23], I[23] = I[24], \
1361   - _p2##x = _p1##x, _p1##x = x++, ++_n1##x, ++_n2##x)
1362   -
1363   -#define cimg_for_in5x5(img,x0,y0,x1,y1,x,y,z,c,I,T) \
1364   - cimg_for_in5((img)._height,y0,y1,y) for (int x = (int)(x0)<0?0:(int)(x0), \
1365   - _p2##x = x - 2<0?0:x - 2, \
1366   - _p1##x = x - 1<0?0:x - 1, \
1367   - _n1##x = x + 1>=(int)(img)._width?(img).width() - 1:x + 1, \
1368   - _n2##x = (int)( \
1369   - (I[0] = (T)(img)(_p2##x,_p2##y,z,c)), \
1370   - (I[5] = (T)(img)(_p2##x,_p1##y,z,c)), \
1371   - (I[10] = (T)(img)(_p2##x,y,z,c)), \
1372   - (I[15] = (T)(img)(_p2##x,_n1##y,z,c)), \
1373   - (I[20] = (T)(img)(_p2##x,_n2##y,z,c)), \
1374   - (I[1] = (T)(img)(_p1##x,_p2##y,z,c)), \
1375   - (I[6] = (T)(img)(_p1##x,_p1##y,z,c)), \
1376   - (I[11] = (T)(img)(_p1##x,y,z,c)), \
1377   - (I[16] = (T)(img)(_p1##x,_n1##y,z,c)), \
1378   - (I[21] = (T)(img)(_p1##x,_n2##y,z,c)), \
1379   - (I[2] = (T)(img)(x,_p2##y,z,c)), \
1380   - (I[7] = (T)(img)(x,_p1##y,z,c)), \
1381   - (I[12] = (T)(img)(x,y,z,c)), \
1382   - (I[17] = (T)(img)(x,_n1##y,z,c)), \
1383   - (I[22] = (T)(img)(x,_n2##y,z,c)), \
1384   - (I[3] = (T)(img)(_n1##x,_p2##y,z,c)), \
1385   - (I[8] = (T)(img)(_n1##x,_p1##y,z,c)), \
1386   - (I[13] = (T)(img)(_n1##x,y,z,c)), \
1387   - (I[18] = (T)(img)(_n1##x,_n1##y,z,c)), \
1388   - (I[23] = (T)(img)(_n1##x,_n2##y,z,c)), \
1389   - x + 2>=(int)(img)._width?(img).width() - 1:x + 2); \
1390   - x<=(int)(x1) && ((_n2##x<(img).width() && ( \
1391   - (I[4] = (T)(img)(_n2##x,_p2##y,z,c)), \
1392   - (I[9] = (T)(img)(_n2##x,_p1##y,z,c)), \
1393   - (I[14] = (T)(img)(_n2##x,y,z,c)), \
1394   - (I[19] = (T)(img)(_n2##x,_n1##y,z,c)), \
1395   - (I[24] = (T)(img)(_n2##x,_n2##y,z,c)),1)) || \
1396   - _n1##x==--_n2##x || x==(_n2##x = --_n1##x)); \
1397   - I[0] = I[1], I[1] = I[2], I[2] = I[3], I[3] = I[4], \
1398   - I[5] = I[6], I[6] = I[7], I[7] = I[8], I[8] = I[9], \
1399   - I[10] = I[11], I[11] = I[12], I[12] = I[13], I[13] = I[14], \
1400   - I[15] = I[16], I[16] = I[17], I[17] = I[18], I[18] = I[19], \
1401   - I[20] = I[21], I[21] = I[22], I[22] = I[23], I[23] = I[24], \
1402   - _p2##x = _p1##x, _p1##x = x++, ++_n1##x, ++_n2##x)
1403   -
1404   -#define cimg_for6x6(img,x,y,z,c,I,T) \
1405   - cimg_for6((img)._height,y) for (int x = 0, \
1406   - _p2##x = 0, _p1##x = 0, \
1407   - _n1##x = 1>=(img)._width?(img).width() - 1:1, \
1408   - _n2##x = 2>=(img)._width?(img).width() - 1:2, \
1409   - _n3##x = (int)( \
1410   - (I[0] = I[1] = I[2] = (T)(img)(_p2##x,_p2##y,z,c)), \
1411   - (I[6] = I[7] = I[8] = (T)(img)(0,_p1##y,z,c)), \
1412   - (I[12] = I[13] = I[14] = (T)(img)(0,y,z,c)), \
1413   - (I[18] = I[19] = I[20] = (T)(img)(0,_n1##y,z,c)), \
1414   - (I[24] = I[25] = I[26] = (T)(img)(0,_n2##y,z,c)), \
1415   - (I[30] = I[31] = I[32] = (T)(img)(0,_n3##y,z,c)), \
1416   - (I[3] = (T)(img)(_n1##x,_p2##y,z,c)), \
1417   - (I[9] = (T)(img)(_n1##x,_p1##y,z,c)), \
1418   - (I[15] = (T)(img)(_n1##x,y,z,c)), \
1419   - (I[21] = (T)(img)(_n1##x,_n1##y,z,c)), \
1420   - (I[27] = (T)(img)(_n1##x,_n2##y,z,c)), \
1421   - (I[33] = (T)(img)(_n1##x,_n3##y,z,c)), \
1422   - (I[4] = (T)(img)(_n2##x,_p2##y,z,c)), \
1423   - (I[10] = (T)(img)(_n2##x,_p1##y,z,c)), \
1424   - (I[16] = (T)(img)(_n2##x,y,z,c)), \
1425   - (I[22] = (T)(img)(_n2##x,_n1##y,z,c)), \
1426   - (I[28] = (T)(img)(_n2##x,_n2##y,z,c)), \
1427   - (I[34] = (T)(img)(_n2##x,_n3##y,z,c)), \
1428   - 3>=(img)._width?(img).width() - 1:3); \
1429   - (_n3##x<(img).width() && ( \
1430   - (I[5] = (T)(img)(_n3##x,_p2##y,z,c)), \
1431   - (I[11] = (T)(img)(_n3##x,_p1##y,z,c)), \
1432   - (I[17] = (T)(img)(_n3##x,y,z,c)), \
1433   - (I[23] = (T)(img)(_n3##x,_n1##y,z,c)), \
1434   - (I[29] = (T)(img)(_n3##x,_n2##y,z,c)), \
1435   - (I[35] = (T)(img)(_n3##x,_n3##y,z,c)),1)) || \
1436   - _n2##x==--_n3##x || _n1##x==--_n2##x || x==(_n3## x = _n2##x = --_n1##x); \
1437   - I[0] = I[1], I[1] = I[2], I[2] = I[3], I[3] = I[4], I[4] = I[5], \
1438   - I[6] = I[7], I[7] = I[8], I[8] = I[9], I[9] = I[10], I[10] = I[11], \
1439   - I[12] = I[13], I[13] = I[14], I[14] = I[15], I[15] = I[16], I[16] = I[17], \
1440   - I[18] = I[19], I[19] = I[20], I[20] = I[21], I[21] = I[22], I[22] = I[23], \
1441   - I[24] = I[25], I[25] = I[26], I[26] = I[27], I[27] = I[28], I[28] = I[29], \
1442   - I[30] = I[31], I[31] = I[32], I[32] = I[33], I[33] = I[34], I[34] = I[35], \
1443   - _p2##x = _p1##x, _p1##x = x++, ++_n1##x, ++_n2##x, ++_n3##x)
1444   -
1445   -#define cimg_for_in6x6(img,x0,y0,x1,y1,x,y,z,c,I,T) \
1446   - cimg_for_in6((img)._height,y0,y1,y) for (int x = (int)(x0)<0?0:(int)x0, \
1447   - _p2##x = x - 2<0?0:x - 2, \
1448   - _p1##x = x - 1<0?0:x - 1, \
1449   - _n1##x = x + 1>=(int)(img)._width?(img).width() - 1:x + 1, \
1450   - _n2##x = x + 2>=(int)(img)._width?(img).width() - 1:x + 2, \
1451   - _n3##x = (int)( \
1452   - (I[0] = (T)(img)(_p2##x,_p2##y,z,c)), \
1453   - (I[6] = (T)(img)(_p2##x,_p1##y,z,c)), \
1454   - (I[12] = (T)(img)(_p2##x,y,z,c)), \
1455   - (I[18] = (T)(img)(_p2##x,_n1##y,z,c)), \
1456   - (I[24] = (T)(img)(_p2##x,_n2##y,z,c)), \
1457   - (I[30] = (T)(img)(_p2##x,_n3##y,z,c)), \
1458   - (I[1] = (T)(img)(_p1##x,_p2##y,z,c)), \
1459   - (I[7] = (T)(img)(_p1##x,_p1##y,z,c)), \
1460   - (I[13] = (T)(img)(_p1##x,y,z,c)), \
1461   - (I[19] = (T)(img)(_p1##x,_n1##y,z,c)), \
1462   - (I[25] = (T)(img)(_p1##x,_n2##y,z,c)), \
1463   - (I[31] = (T)(img)(_p1##x,_n3##y,z,c)), \
1464   - (I[2] = (T)(img)(x,_p2##y,z,c)), \
1465   - (I[8] = (T)(img)(x,_p1##y,z,c)), \
1466   - (I[14] = (T)(img)(x,y,z,c)), \
1467   - (I[20] = (T)(img)(x,_n1##y,z,c)), \
1468   - (I[26] = (T)(img)(x,_n2##y,z,c)), \
1469   - (I[32] = (T)(img)(x,_n3##y,z,c)), \
1470   - (I[3] = (T)(img)(_n1##x,_p2##y,z,c)), \
1471   - (I[9] = (T)(img)(_n1##x,_p1##y,z,c)), \
1472   - (I[15] = (T)(img)(_n1##x,y,z,c)), \
1473   - (I[21] = (T)(img)(_n1##x,_n1##y,z,c)), \
1474   - (I[27] = (T)(img)(_n1##x,_n2##y,z,c)), \
1475   - (I[33] = (T)(img)(_n1##x,_n3##y,z,c)), \
1476   - (I[4] = (T)(img)(_n2##x,_p2##y,z,c)), \
1477   - (I[10] = (T)(img)(_n2##x,_p1##y,z,c)), \
1478   - (I[16] = (T)(img)(_n2##x,y,z,c)), \
1479   - (I[22] = (T)(img)(_n2##x,_n1##y,z,c)), \
1480   - (I[28] = (T)(img)(_n2##x,_n2##y,z,c)), \
1481   - (I[34] = (T)(img)(_n2##x,_n3##y,z,c)), \
1482   - x + 3>=(int)(img)._width?(img).width() - 1:x + 3); \
1483   - x<=(int)(x1) && ((_n3##x<(img).width() && ( \
1484   - (I[5] = (T)(img)(_n3##x,_p2##y,z,c)), \
1485   - (I[11] = (T)(img)(_n3##x,_p1##y,z,c)), \
1486   - (I[17] = (T)(img)(_n3##x,y,z,c)), \
1487   - (I[23] = (T)(img)(_n3##x,_n1##y,z,c)), \
1488   - (I[29] = (T)(img)(_n3##x,_n2##y,z,c)), \
1489   - (I[35] = (T)(img)(_n3##x,_n3##y,z,c)),1)) || \
1490   - _n2##x==--_n3##x || _n1##x==--_n2##x || x==(_n3## x = _n2##x = --_n1##x)); \
1491   - I[0] = I[1], I[1] = I[2], I[2] = I[3], I[3] = I[4], I[4] = I[5], \
1492   - I[6] = I[7], I[7] = I[8], I[8] = I[9], I[9] = I[10], I[10] = I[11], \
1493   - I[12] = I[13], I[13] = I[14], I[14] = I[15], I[15] = I[16], I[16] = I[17], \
1494   - I[18] = I[19], I[19] = I[20], I[20] = I[21], I[21] = I[22], I[22] = I[23], \
1495   - I[24] = I[25], I[25] = I[26], I[26] = I[27], I[27] = I[28], I[28] = I[29], \
1496   - I[30] = I[31], I[31] = I[32], I[32] = I[33], I[33] = I[34], I[34] = I[35], \
1497   - _p2##x = _p1##x, _p1##x = x++, ++_n1##x, ++_n2##x, ++_n3##x)
1498   -
1499   -#define cimg_for7x7(img,x,y,z,c,I,T) \
1500   - cimg_for7((img)._height,y) for (int x = 0, \
1501   - _p3##x = 0, _p2##x = 0, _p1##x = 0, \
1502   - _n1##x = 1>=(img)._width?(img).width() - 1:1, \
1503   - _n2##x = 2>=(img)._width?(img).width() - 1:2, \
1504   - _n3##x = (int)( \
1505   - (I[0] = I[1] = I[2] = I[3] = (T)(img)(_p3##x,_p3##y,z,c)), \
1506   - (I[7] = I[8] = I[9] = I[10] = (T)(img)(0,_p2##y,z,c)), \
1507   - (I[14] = I[15] = I[16] = I[17] = (T)(img)(0,_p1##y,z,c)), \
1508   - (I[21] = I[22] = I[23] = I[24] = (T)(img)(0,y,z,c)), \
1509   - (I[28] = I[29] = I[30] = I[31] = (T)(img)(0,_n1##y,z,c)), \
1510   - (I[35] = I[36] = I[37] = I[38] = (T)(img)(0,_n2##y,z,c)), \
1511   - (I[42] = I[43] = I[44] = I[45] = (T)(img)(0,_n3##y,z,c)), \
1512   - (I[4] = (T)(img)(_n1##x,_p3##y,z,c)), \
1513   - (I[11] = (T)(img)(_n1##x,_p2##y,z,c)), \
1514   - (I[18] = (T)(img)(_n1##x,_p1##y,z,c)), \
1515   - (I[25] = (T)(img)(_n1##x,y,z,c)), \
1516   - (I[32] = (T)(img)(_n1##x,_n1##y,z,c)), \
1517   - (I[39] = (T)(img)(_n1##x,_n2##y,z,c)), \
1518   - (I[46] = (T)(img)(_n1##x,_n3##y,z,c)), \
1519   - (I[5] = (T)(img)(_n2##x,_p3##y,z,c)), \
1520   - (I[12] = (T)(img)(_n2##x,_p2##y,z,c)), \
1521   - (I[19] = (T)(img)(_n2##x,_p1##y,z,c)), \
1522   - (I[26] = (T)(img)(_n2##x,y,z,c)), \
1523   - (I[33] = (T)(img)(_n2##x,_n1##y,z,c)), \
1524   - (I[40] = (T)(img)(_n2##x,_n2##y,z,c)), \
1525   - (I[47] = (T)(img)(_n2##x,_n3##y,z,c)), \
1526   - 3>=(img)._width?(img).width() - 1:3); \
1527   - (_n3##x<(img).width() && ( \
1528   - (I[6] = (T)(img)(_n3##x,_p3##y,z,c)), \
1529   - (I[13] = (T)(img)(_n3##x,_p2##y,z,c)), \
1530   - (I[20] = (T)(img)(_n3##x,_p1##y,z,c)), \
1531   - (I[27] = (T)(img)(_n3##x,y,z,c)), \
1532   - (I[34] = (T)(img)(_n3##x,_n1##y,z,c)), \
1533   - (I[41] = (T)(img)(_n3##x,_n2##y,z,c)), \
1534   - (I[48] = (T)(img)(_n3##x,_n3##y,z,c)),1)) || \
1535   - _n2##x==--_n3##x || _n1##x==--_n2##x || x==(_n3##x = _n2##x = --_n1##x); \
1536   - I[0] = I[1], I[1] = I[2], I[2] = I[3], I[3] = I[4], I[4] = I[5], I[5] = I[6], \
1537   - I[7] = I[8], I[8] = I[9], I[9] = I[10], I[10] = I[11], I[11] = I[12], I[12] = I[13], \
1538   - I[14] = I[15], I[15] = I[16], I[16] = I[17], I[17] = I[18], I[18] = I[19], I[19] = I[20], \
1539   - I[21] = I[22], I[22] = I[23], I[23] = I[24], I[24] = I[25], I[25] = I[26], I[26] = I[27], \
1540   - I[28] = I[29], I[29] = I[30], I[30] = I[31], I[31] = I[32], I[32] = I[33], I[33] = I[34], \
1541   - I[35] = I[36], I[36] = I[37], I[37] = I[38], I[38] = I[39], I[39] = I[40], I[40] = I[41], \
1542   - I[42] = I[43], I[43] = I[44], I[44] = I[45], I[45] = I[46], I[46] = I[47], I[47] = I[48], \
1543   - _p3##x = _p2##x, _p2##x = _p1##x, _p1##x = x++, ++_n1##x, ++_n2##x, ++_n3##x)
1544   -
1545   -#define cimg_for_in7x7(img,x0,y0,x1,y1,x,y,z,c,I,T) \
1546   - cimg_for_in7((img)._height,y0,y1,y) for (int x = (int)(x0)<0?0:(int)(x0), \
1547   - _p3##x = x - 3<0?0:x - 3, \
1548   - _p2##x = x - 2<0?0:x - 2, \
1549   - _p1##x = x - 1<0?0:x - 1, \
1550   - _n1##x = x + 1>=(int)(img)._width?(img).width() - 1:x + 1, \
1551   - _n2##x = x + 2>=(int)(img)._width?(img).width() - 1:x + 2, \
1552   - _n3##x = (int)( \
1553   - (I[0] = (T)(img)(_p3##x,_p3##y,z,c)), \
1554   - (I[7] = (T)(img)(_p3##x,_p2##y,z,c)), \
1555   - (I[14] = (T)(img)(_p3##x,_p1##y,z,c)), \
1556   - (I[21] = (T)(img)(_p3##x,y,z,c)), \
1557   - (I[28] = (T)(img)(_p3##x,_n1##y,z,c)), \
1558   - (I[35] = (T)(img)(_p3##x,_n2##y,z,c)), \
1559   - (I[42] = (T)(img)(_p3##x,_n3##y,z,c)), \
1560   - (I[1] = (T)(img)(_p2##x,_p3##y,z,c)), \
1561   - (I[8] = (T)(img)(_p2##x,_p2##y,z,c)), \
1562   - (I[15] = (T)(img)(_p2##x,_p1##y,z,c)), \
1563   - (I[22] = (T)(img)(_p2##x,y,z,c)), \
1564   - (I[29] = (T)(img)(_p2##x,_n1##y,z,c)), \
1565   - (I[36] = (T)(img)(_p2##x,_n2##y,z,c)), \
1566   - (I[43] = (T)(img)(_p2##x,_n3##y,z,c)), \
1567   - (I[2] = (T)(img)(_p1##x,_p3##y,z,c)), \
1568   - (I[9] = (T)(img)(_p1##x,_p2##y,z,c)), \
1569   - (I[16] = (T)(img)(_p1##x,_p1##y,z,c)), \
1570   - (I[23] = (T)(img)(_p1##x,y,z,c)), \
1571   - (I[30] = (T)(img)(_p1##x,_n1##y,z,c)), \
1572   - (I[37] = (T)(img)(_p1##x,_n2##y,z,c)), \
1573   - (I[44] = (T)(img)(_p1##x,_n3##y,z,c)), \
1574   - (I[3] = (T)(img)(x,_p3##y,z,c)), \
1575   - (I[10] = (T)(img)(x,_p2##y,z,c)), \
1576   - (I[17] = (T)(img)(x,_p1##y,z,c)), \
1577   - (I[24] = (T)(img)(x,y,z,c)), \
1578   - (I[31] = (T)(img)(x,_n1##y,z,c)), \
1579   - (I[38] = (T)(img)(x,_n2##y,z,c)), \
1580   - (I[45] = (T)(img)(x,_n3##y,z,c)), \
1581   - (I[4] = (T)(img)(_n1##x,_p3##y,z,c)), \
1582   - (I[11] = (T)(img)(_n1##x,_p2##y,z,c)), \
1583   - (I[18] = (T)(img)(_n1##x,_p1##y,z,c)), \
1584   - (I[25] = (T)(img)(_n1##x,y,z,c)), \
1585   - (I[32] = (T)(img)(_n1##x,_n1##y,z,c)), \
1586   - (I[39] = (T)(img)(_n1##x,_n2##y,z,c)), \
1587   - (I[46] = (T)(img)(_n1##x,_n3##y,z,c)), \
1588   - (I[5] = (T)(img)(_n2##x,_p3##y,z,c)), \
1589   - (I[12] = (T)(img)(_n2##x,_p2##y,z,c)), \
1590   - (I[19] = (T)(img)(_n2##x,_p1##y,z,c)), \
1591   - (I[26] = (T)(img)(_n2##x,y,z,c)), \
1592   - (I[33] = (T)(img)(_n2##x,_n1##y,z,c)), \
1593   - (I[40] = (T)(img)(_n2##x,_n2##y,z,c)), \
1594   - (I[47] = (T)(img)(_n2##x,_n3##y,z,c)), \
1595   - x + 3>=(int)(img)._width?(img).width() - 1:x + 3); \
1596   - x<=(int)(x1) && ((_n3##x<(img).width() && ( \
1597   - (I[6] = (T)(img)(_n3##x,_p3##y,z,c)), \
1598   - (I[13] = (T)(img)(_n3##x,_p2##y,z,c)), \
1599   - (I[20] = (T)(img)(_n3##x,_p1##y,z,c)), \
1600   - (I[27] = (T)(img)(_n3##x,y,z,c)), \
1601   - (I[34] = (T)(img)(_n3##x,_n1##y,z,c)), \
1602   - (I[41] = (T)(img)(_n3##x,_n2##y,z,c)), \
1603   - (I[48] = (T)(img)(_n3##x,_n3##y,z,c)),1)) || \
1604   - _n2##x==--_n3##x || _n1##x==--_n2##x || x==(_n3##x = _n2##x = --_n1##x)); \
1605   - I[0] = I[1], I[1] = I[2], I[2] = I[3], I[3] = I[4], I[4] = I[5], I[5] = I[6], \
1606   - I[7] = I[8], I[8] = I[9], I[9] = I[10], I[10] = I[11], I[11] = I[12], I[12] = I[13], \
1607   - I[14] = I[15], I[15] = I[16], I[16] = I[17], I[17] = I[18], I[18] = I[19], I[19] = I[20], \
1608   - I[21] = I[22], I[22] = I[23], I[23] = I[24], I[24] = I[25], I[25] = I[26], I[26] = I[27], \
1609   - I[28] = I[29], I[29] = I[30], I[30] = I[31], I[31] = I[32], I[32] = I[33], I[33] = I[34], \
1610   - I[35] = I[36], I[36] = I[37], I[37] = I[38], I[38] = I[39], I[39] = I[40], I[40] = I[41], \
1611   - I[42] = I[43], I[43] = I[44], I[44] = I[45], I[45] = I[46], I[46] = I[47], I[47] = I[48], \
1612   - _p3##x = _p2##x, _p2##x = _p1##x, _p1##x = x++, ++_n1##x, ++_n2##x, ++_n3##x)
1613   -
1614   -#define cimg_for8x8(img,x,y,z,c,I,T) \
1615   - cimg_for8((img)._height,y) for (int x = 0, \
1616   - _p3##x = 0, _p2##x = 0, _p1##x = 0, \
1617   - _n1##x = 1>=((img)._width)?(img).width() - 1:1, \
1618   - _n2##x = 2>=((img)._width)?(img).width() - 1:2, \
1619   - _n3##x = 3>=((img)._width)?(img).width() - 1:3, \
1620   - _n4##x = (int)( \
1621   - (I[0] = I[1] = I[2] = I[3] = (T)(img)(_p3##x,_p3##y,z,c)), \
1622   - (I[8] = I[9] = I[10] = I[11] = (T)(img)(0,_p2##y,z,c)), \
1623   - (I[16] = I[17] = I[18] = I[19] = (T)(img)(0,_p1##y,z,c)), \
1624   - (I[24] = I[25] = I[26] = I[27] = (T)(img)(0,y,z,c)), \
1625   - (I[32] = I[33] = I[34] = I[35] = (T)(img)(0,_n1##y,z,c)), \
1626   - (I[40] = I[41] = I[42] = I[43] = (T)(img)(0,_n2##y,z,c)), \
1627   - (I[48] = I[49] = I[50] = I[51] = (T)(img)(0,_n3##y,z,c)), \
1628   - (I[56] = I[57] = I[58] = I[59] = (T)(img)(0,_n4##y,z,c)), \
1629   - (I[4] = (T)(img)(_n1##x,_p3##y,z,c)), \
1630   - (I[12] = (T)(img)(_n1##x,_p2##y,z,c)), \
1631   - (I[20] = (T)(img)(_n1##x,_p1##y,z,c)), \
1632   - (I[28] = (T)(img)(_n1##x,y,z,c)), \
1633   - (I[36] = (T)(img)(_n1##x,_n1##y,z,c)), \
1634   - (I[44] = (T)(img)(_n1##x,_n2##y,z,c)), \
1635   - (I[52] = (T)(img)(_n1##x,_n3##y,z,c)), \
1636   - (I[60] = (T)(img)(_n1##x,_n4##y,z,c)), \
1637   - (I[5] = (T)(img)(_n2##x,_p3##y,z,c)), \
1638   - (I[13] = (T)(img)(_n2##x,_p2##y,z,c)), \
1639   - (I[21] = (T)(img)(_n2##x,_p1##y,z,c)), \
1640   - (I[29] = (T)(img)(_n2##x,y,z,c)), \
1641   - (I[37] = (T)(img)(_n2##x,_n1##y,z,c)), \
1642   - (I[45] = (T)(img)(_n2##x,_n2##y,z,c)), \
1643   - (I[53] = (T)(img)(_n2##x,_n3##y,z,c)), \
1644   - (I[61] = (T)(img)(_n2##x,_n4##y,z,c)), \
1645   - (I[6] = (T)(img)(_n3##x,_p3##y,z,c)), \
1646   - (I[14] = (T)(img)(_n3##x,_p2##y,z,c)), \
1647   - (I[22] = (T)(img)(_n3##x,_p1##y,z,c)), \
1648   - (I[30] = (T)(img)(_n3##x,y,z,c)), \
1649   - (I[38] = (T)(img)(_n3##x,_n1##y,z,c)), \
1650   - (I[46] = (T)(img)(_n3##x,_n2##y,z,c)), \
1651   - (I[54] = (T)(img)(_n3##x,_n3##y,z,c)), \
1652   - (I[62] = (T)(img)(_n3##x,_n4##y,z,c)), \
1653   - 4>=((img)._width)?(img).width() - 1:4); \
1654   - (_n4##x<(img).width() && ( \
1655   - (I[7] = (T)(img)(_n4##x,_p3##y,z,c)), \
1656   - (I[15] = (T)(img)(_n4##x,_p2##y,z,c)), \
1657   - (I[23] = (T)(img)(_n4##x,_p1##y,z,c)), \
1658   - (I[31] = (T)(img)(_n4##x,y,z,c)), \
1659   - (I[39] = (T)(img)(_n4##x,_n1##y,z,c)), \
1660   - (I[47] = (T)(img)(_n4##x,_n2##y,z,c)), \
1661   - (I[55] = (T)(img)(_n4##x,_n3##y,z,c)), \
1662   - (I[63] = (T)(img)(_n4##x,_n4##y,z,c)),1)) || \
1663   - _n3##x==--_n4##x || _n2##x==--_n3##x || _n1##x==--_n2##x || x==(_n4##x = _n3##x = _n2##x = --_n1##x); \
1664   - I[0] = I[1], I[1] = I[2], I[2] = I[3], I[3] = I[4], I[4] = I[5], I[5] = I[6], I[6] = I[7], \
1665   - I[8] = I[9], I[9] = I[10], I[10] = I[11], I[11] = I[12], I[12] = I[13], I[13] = I[14], I[14] = I[15], \
1666   - I[16] = I[17], I[17] = I[18], I[18] = I[19], I[19] = I[20], I[20] = I[21], I[21] = I[22], I[22] = I[23], \
1667   - I[24] = I[25], I[25] = I[26], I[26] = I[27], I[27] = I[28], I[28] = I[29], I[29] = I[30], I[30] = I[31], \
1668   - I[32] = I[33], I[33] = I[34], I[34] = I[35], I[35] = I[36], I[36] = I[37], I[37] = I[38], I[38] = I[39], \
1669   - I[40] = I[41], I[41] = I[42], I[42] = I[43], I[43] = I[44], I[44] = I[45], I[45] = I[46], I[46] = I[47], \
1670   - I[48] = I[49], I[49] = I[50], I[50] = I[51], I[51] = I[52], I[52] = I[53], I[53] = I[54], I[54] = I[55], \
1671   - I[56] = I[57], I[57] = I[58], I[58] = I[59], I[59] = I[60], I[60] = I[61], I[61] = I[62], I[62] = I[63], \
1672   - _p3##x = _p2##x, _p2##x = _p1##x, _p1##x = x++, ++_n1##x, ++_n2##x, ++_n3##x, ++_n4##x)
1673   -
1674   -#define cimg_for_in8x8(img,x0,y0,x1,y1,x,y,z,c,I,T) \
1675   - cimg_for_in8((img)._height,y0,y1,y) for (int x = (int)(x0)<0?0:(int)(x0), \
1676   - _p3##x = x - 3<0?0:x - 3, \
1677   - _p2##x = x - 2<0?0:x - 2, \
1678 &