ForEachSeptenaryVoxelFunction.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2013-2015 Imperial College London
5  * Copyright 2013-2015 Andreas Schuh
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * ATTENTION: This source file has been automatically generated using the code
20  * generator mirtkForEachVoxelFunction.py! This generator is
21  * invoked during CMake configuration of the build system when this
22  * source file is missing from the project.
23  *
24  * DO NOT modify this file manually. Instead, modify the code
25  * generator, remove any existing mirtkForEach*VoxelFunction.h
26  * header file from the include/ directory and then re-run CMake.
27  * This will invoke the code generator to re-generate the source files.
28  */
29 
30 #ifndef MIRTK_ForEachSeptenaryVoxelFunction_H
31 #define MIRTK_ForEachSeptenaryVoxelFunction_H
32 
33 #include "mirtk/Stream.h"
34 #include "mirtk/VoxelFunction.h"
35 
36 
37 namespace mirtk {
38 
39 
40 inline void _foreachseptenaryvoxelfunction_must_not_be_reduction()
41 {
42  cerr << "(Parallel)ForEachVoxel(If): Voxel reductions must be passed by reference!"
43  " Pass voxel functor object(s) as last argument(s) instead of first." << endl;
44  exit(1);
45 }
46 
47 
48 // =============================================================================
49 // 7 const images
50 // =============================================================================
51 
52 // -----------------------------------------------------------------------------
53 /**
54  * ForEachVoxel body for voxel function of 7 const images
55  */
56 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
58 {
59  const GenericImage<T1> &im1;
60  const GenericImage<T2> &im2;
61  const GenericImage<T3> &im3;
62  const GenericImage<T4> &im4;
63  const GenericImage<T5> &im5;
64  const GenericImage<T6> &im6;
65  const GenericImage<T7> &im7;
66 
67  /// Constructor
69  const GenericImage<T2> &im2,
70  const GenericImage<T3> &im3,
71  const GenericImage<T4> &im4,
72  const GenericImage<T5> &im5,
73  const GenericImage<T6> &im6,
74  const GenericImage<T7> &im7,
75  VoxelFunc &vf)
76  :
77  ForEachVoxelBody<VoxelFunc>(vf, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
78  {}
79 
80  /// Copy constructor
82  :
83  ForEachVoxelBody<VoxelFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
84  {}
85 
86  /// Split constructor
88  :
89  ForEachVoxelBody<VoxelFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
90  {}
91 
92  /// Process entire image
93  void operator ()(const ImageAttributes &attr) const
94  {
95  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
96  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
97  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
98  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
99  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
100  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
101  const T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
102 
103  const int T = (attr._dt ? attr._t : 1);
104 
105  for (int l = 0; l < T; ++l)
106  for (int k = 0; k < attr._z; ++k)
107  for (int j = 0; j < attr._y; ++j)
108  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
109  // const_cast such that voxel functions need only implement
110  // non-const operator() which is required for parallel_reduce
111  const_cast<SeptenaryForEachVoxelBody_Const *>(this)->_VoxelFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
112  }
113  }
114 
115  /// Process image region using linear index
116  void operator ()(const blocked_range<int> &re) const
117  {
118  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
119  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
120  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
121  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
122  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
123  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
124  const T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
125 
126  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
127  // const_cast such that voxel functions need only implement
128  // non-const operator() which is required for parallel_reduce
129  const_cast<SeptenaryForEachVoxelBody_Const *>(this)->_VoxelFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
130  }
131  }
132 
133  /// Process 2D image region
134  void operator ()(const blocked_range2d<int> &re) const
135  {
136  const int bi = re.cols().begin();
137  const int bj = re.rows().begin();
138  const int ei = re.cols().end();
139  const int ej = re.rows().end();
140 
141  const int s1 = im7.GetX() - (ei - bi);
142 
143  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
144  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
145  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
146  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
147  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
148  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
149  const T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
150 
151  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
152  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
153  // const_cast such that voxel functions need only implement
154  // non-const operator() which is required for parallel_reduce
155  const_cast<SeptenaryForEachVoxelBody_Const *>(this)->_VoxelFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
156  }
157  }
158 
159  /// Process 3D image region
160  void operator ()(const blocked_range3d<int> &re) const
161  {
162  const int bi = re.cols ().begin();
163  const int bj = re.rows ().begin();
164  const int bk = re.pages().begin();
165  const int ei = re.cols ().end();
166  const int ej = re.rows ().end();
167  const int ek = re.pages().end();
168 
169  const int s1 = im7.GetX() - (ei - bi);
170  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
171 
172  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
173  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
174  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
175  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
176  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
177  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
178  const T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
179 
180  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
181  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
182  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
183  // const_cast such that voxel functions need only implement
184  // non-const operator() which is required for parallel_reduce
185  const_cast<SeptenaryForEachVoxelBody_Const *>(this)->_VoxelFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
186  }
187  }
188 };
189 
190 // -----------------------------------------------------------------------------
191 /**
192  * ForEachVoxel body for inside and outside unary voxel function of 7 const images
193  */
194 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7,
195  class VoxelFunc, class OutsideFunc = NaryVoxelFunction::NOP,
196  class Domain = ForEachVoxelDomain::Foreground>
197 struct SeptenaryForEachVoxelIfBody_Const : public ForEachVoxelIfBody<VoxelFunc, OutsideFunc>
198 {
199  const GenericImage<T1> &im1;
200  const GenericImage<T2> &im2;
201  const GenericImage<T3> &im3;
202  const GenericImage<T4> &im4;
203  const GenericImage<T5> &im5;
204  const GenericImage<T6> &im6;
205  const GenericImage<T7> &im7;
206 
207  /// Constructor
209  const GenericImage<T2> &im2,
210  const GenericImage<T3> &im3,
211  const GenericImage<T4> &im4,
212  const GenericImage<T5> &im5,
213  const GenericImage<T6> &im6,
214  const GenericImage<T7> &im7,
215  VoxelFunc &vf, OutsideFunc &of)
216  :
217  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(vf, of, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
218  {}
219 
220  /// Copy constructor
222  :
223  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
224  {}
225 
226  /// Split constructor
228  :
229  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
230  {}
231 
232  /// Process entire image
233  void operator ()(const ImageAttributes &attr) const
234  {
235  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
236  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
237  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
238  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
239  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
240  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
241  const T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
242 
243  const int T = (attr._dt ? attr._t : 1);
244 
245  for (int l = 0; l < T; ++l)
246  for (int k = 0; k < attr._z; ++k)
247  for (int j = 0; j < attr._y; ++j)
248  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
249  if (Domain::IsInside(im7, i, j, k, l, p7)) {
250  // const_cast such that voxel functions need only implement
251  // non-const operator() which is required for parallel_reduce
252  const_cast<SeptenaryForEachVoxelIfBody_Const *>(this)->_VoxelFunc (i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
253  } else const_cast<SeptenaryForEachVoxelIfBody_Const *>(this)->_OutsideFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
254  }
255  }
256 
257  /// Process image region using linear index
258  void operator ()(const blocked_range<int> &re) const
259  {
260  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
261  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
262  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
263  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
264  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
265  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
266  const T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
267 
268  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
269  if (Domain::IsInside(im7, idx, p7)) {
270  // const_cast such that voxel functions need only implement
271  // non-const operator() which is required for parallel_reduce
272  const_cast<SeptenaryForEachVoxelIfBody_Const *>(this)->_VoxelFunc (im7, idx, p1, p2, p3, p4, p5, p6, p7);
273  } else const_cast<SeptenaryForEachVoxelIfBody_Const *>(this)->_OutsideFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
274  }
275  }
276 
277  /// Process 2D image region
278  void operator ()(const blocked_range2d<int> &re) const
279  {
280  const int bi = re.cols().begin();
281  const int bj = re.rows().begin();
282  const int ei = re.cols().end();
283  const int ej = re.rows().end();
284 
285  const int s1 = im7.GetX() - (ei - bi);
286 
287  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
288  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
289  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
290  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
291  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
292  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
293  const T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
294 
295  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
296  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
297  if (Domain::IsInside(im7, i, j, this->_k, this->_l, p7)) {
298  // const_cast such that voxel functions need only implement
299  // non-const operator() which is required for parallel_reduce
300  const_cast<SeptenaryForEachVoxelIfBody_Const *>(this)->_VoxelFunc (i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
301  } else const_cast<SeptenaryForEachVoxelIfBody_Const *>(this)->_OutsideFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
302  }
303  }
304 
305  /// Process 3D image region
306  void operator ()(const blocked_range3d<int> &re) const
307  {
308  const int bi = re.cols ().begin();
309  const int bj = re.rows ().begin();
310  const int bk = re.pages().begin();
311  const int ei = re.cols ().end();
312  const int ej = re.rows ().end();
313  const int ek = re.pages().end();
314 
315  const int s1 = im7.GetX() - (ei - bi);
316  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
317 
318  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
319  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
320  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
321  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
322  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
323  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
324  const T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
325 
326  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
327  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
328  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
329  if (Domain::IsInside(im7, i, j, k, this->_l, p7)) {
330  // const_cast such that voxel functions need only implement
331  // non-const operator() which is required for parallel_reduce
332  const_cast<SeptenaryForEachVoxelIfBody_Const *>(this)->_VoxelFunc (i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
333  } else const_cast<SeptenaryForEachVoxelIfBody_Const *>(this)->_OutsideFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
334  }
335  }
336 };
337 
338 // -----------------------------------------------------------------------------
339 // ForEachVoxel
340 // -----------------------------------------------------------------------------
341 
342 //
343 // Image arguments by pointer
344 //
345 
346 // -----------------------------------------------------------------------------
347 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
348 void ForEachScalar(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
349 {
350  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
352  body(re);
353  vf.join(body._VoxelFunc);
354 }
355 
356 // -----------------------------------------------------------------------------
357 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
358 void ForEachScalar(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
359 {
360  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
361  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
362 }
363 
364 // -----------------------------------------------------------------------------
365 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
366 void ForEachVoxel(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
367 {
368  if (im7->GetTSize()) {
369  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
370  } else {
371  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
372  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
373  body(re);
374  vf.join(body._VoxelFunc);
375  }
376 }
377 
378 // -----------------------------------------------------------------------------
379 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
380 void ForEachVoxel(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
381 {
382  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
383  ForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
384 }
385 
386 // -----------------------------------------------------------------------------
387 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
388 void ForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
389 {
390  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
391  body(attr);
392  vf.join(body._VoxelFunc);
393 }
394 
395 // -----------------------------------------------------------------------------
396 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
397 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
398 {
399  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
400  ForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
401 }
402 
403 // -----------------------------------------------------------------------------
404 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
405 void ForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
406 {
407  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
408  body(re);
409  vf.join(body._VoxelFunc);
410 }
411 
412 // -----------------------------------------------------------------------------
413 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
414 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
415 {
416  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
417  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
418 }
419 
420 // -----------------------------------------------------------------------------
421 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
422 void ForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
423 {
424  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
425  body(re);
426  vf.join(body._VoxelFunc);
427 }
428 
429 // -----------------------------------------------------------------------------
430 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
431 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
432 {
433  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
434  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
435 }
436 
437 // -----------------------------------------------------------------------------
438 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
439 void ForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
440 {
441  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
442  body(re);
443  vf.join(body._VoxelFunc);
444 }
445 
446 // -----------------------------------------------------------------------------
447 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
448 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
449 {
450  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
451  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
452 }
453 
454 //
455 // Image arguments by reference
456 //
457 
458 // -----------------------------------------------------------------------------
459 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
460 void ForEachScalar(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
461 {
462  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
464  body(re);
465  vf.join(body._VoxelFunc);
466 }
467 
468 // -----------------------------------------------------------------------------
469 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
470 void ForEachScalar(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
471 {
472  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
473  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
474 }
475 
476 // -----------------------------------------------------------------------------
477 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
478 void ForEachVoxel(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
479 {
480  if (im7.GetTSize()) {
481  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
482  } else {
483  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
484  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
485  body(re);
486  vf.join(body._VoxelFunc);
487  }
488 }
489 
490 // -----------------------------------------------------------------------------
491 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
492 void ForEachVoxel(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
493 {
494  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
495  ForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
496 }
497 
498 // -----------------------------------------------------------------------------
499 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
500 void ForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
501 {
502  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
503  body(attr);
504  vf.join(body._VoxelFunc);
505 }
506 
507 // -----------------------------------------------------------------------------
508 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
509 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
510 {
511  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
512  ForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
513 }
514 
515 // -----------------------------------------------------------------------------
516 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
517 void ForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
518 {
519  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
520  body(re);
521  vf.join(body._VoxelFunc);
522 }
523 
524 // -----------------------------------------------------------------------------
525 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
526 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
527 {
528  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
529  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
530 }
531 
532 // -----------------------------------------------------------------------------
533 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
534 void ForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
535 {
536  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
537  body(re);
538  vf.join(body._VoxelFunc);
539 }
540 
541 // -----------------------------------------------------------------------------
542 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
543 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
544 {
545  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
546  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
547 }
548 
549 // -----------------------------------------------------------------------------
550 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
551 void ForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
552 {
553  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
554  body(re);
555  vf.join(body._VoxelFunc);
556 }
557 
558 // -----------------------------------------------------------------------------
559 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
560 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
561 {
562  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
563  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
564 }
565 
566 // -----------------------------------------------------------------------------
567 // ForEachVoxelIf
568 // -----------------------------------------------------------------------------
569 
570 //
571 // Image arguments by pointer
572 //
573 
574 // -----------------------------------------------------------------------------
575 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
576 void ForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
577 {
578  SeptenaryForEachVoxelIfBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
580  body(re);
581  vf.join(body._VoxelFunc);
582  of.join(body._OutsideFunc);
583 }
584 
585 // -----------------------------------------------------------------------------
586 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
587 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
588 {
589  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
590  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
591 }
592 
593 // -----------------------------------------------------------------------------
594 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
595 void ForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
596 {
598  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
599 }
600 
601 // -----------------------------------------------------------------------------
602 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
603 void ForEachScalarIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
604 {
605  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
606  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
607 }
608 
609 // -----------------------------------------------------------------------------
610 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
611 void ForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
612 {
613  if (im7->GetTSize()) {
614  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
615  } else {
616  SeptenaryForEachVoxelIfBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
617  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
618  body(re);
619  vf.join(body._VoxelFunc);
620  of.join(body._OutsideFunc);
621  }
622 }
623 
624 // -----------------------------------------------------------------------------
625 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
626 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
627 {
628  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
629  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
630 }
631 
632 // -----------------------------------------------------------------------------
633 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
634 void ForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
635 {
637  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
638 }
639 
640 // -----------------------------------------------------------------------------
641 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
642 void ForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
643 {
644  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
645  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
646 }
647 
648 // -----------------------------------------------------------------------------
649 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
650 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
651 {
652  SeptenaryForEachVoxelIfBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
653  body(attr);
654  vf.join(body._VoxelFunc);
655  of.join(body._OutsideFunc);
656 }
657 
658 // -----------------------------------------------------------------------------
659 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
660 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
661 {
662  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
663  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
664 }
665 
666 // -----------------------------------------------------------------------------
667 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
668 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
669 {
671  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
672 }
673 
674 // -----------------------------------------------------------------------------
675 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
676 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
677 {
678  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
679  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
680 }
681 
682 // -----------------------------------------------------------------------------
683 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
684 void ForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
685 {
686  SeptenaryForEachVoxelIfBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
687  body(re);
688  vf.join(body._VoxelFunc);
689  of.join(body._OutsideFunc);
690 }
691 
692 // -----------------------------------------------------------------------------
693 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
694 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
695 {
696  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
697  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
698 }
699 
700 // -----------------------------------------------------------------------------
701 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
702 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
703 {
704  SeptenaryForEachVoxelIfBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
705  body(re);
706  vf.join(body._VoxelFunc);
707  of.join(body._OutsideFunc);
708 }
709 
710 // -----------------------------------------------------------------------------
711 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
712 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
713 {
714  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
715  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
716 }
717 
718 // -----------------------------------------------------------------------------
719 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
720 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
721 {
723  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
724 }
725 
726 // -----------------------------------------------------------------------------
727 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
728 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
729 {
730  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
731  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
732 }
733 
734 // -----------------------------------------------------------------------------
735 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
736 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
737 {
738  SeptenaryForEachVoxelIfBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
739  body(re);
740  vf.join(body._VoxelFunc);
741  of.join(body._OutsideFunc);
742 }
743 
744 // -----------------------------------------------------------------------------
745 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
746 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
747 {
748  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
749  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
750 }
751 
752 // -----------------------------------------------------------------------------
753 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
754 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
755 {
757  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
758 }
759 
760 // -----------------------------------------------------------------------------
761 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
762 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
763 {
764  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
765  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
766 }
767 
768 //
769 // Image arguments by reference
770 //
771 
772 // -----------------------------------------------------------------------------
773 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
774 void ForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
775 {
778  body(re);
779  vf.join(body._VoxelFunc);
780  of.join(body._OutsideFunc);
781 }
782 
783 // -----------------------------------------------------------------------------
784 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
785 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
786 {
787  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
788  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
789 }
790 
791 // -----------------------------------------------------------------------------
792 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
793 void ForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
794 {
796  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
797 }
798 
799 // -----------------------------------------------------------------------------
800 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
801 void ForEachScalarIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
802 {
803  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
804  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
805 }
806 
807 // -----------------------------------------------------------------------------
808 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
809 void ForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
810 {
811  if (im7.GetTSize()) {
812  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
813  } else {
815  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
816  body(re);
817  vf.join(body._VoxelFunc);
818  of.join(body._OutsideFunc);
819  }
820 }
821 
822 // -----------------------------------------------------------------------------
823 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
824 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
825 {
826  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
827  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
828 }
829 
830 // -----------------------------------------------------------------------------
831 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
832 void ForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
833 {
835  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
836 }
837 
838 // -----------------------------------------------------------------------------
839 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
840 void ForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
841 {
842  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
843  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
844 }
845 
846 // -----------------------------------------------------------------------------
847 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
848 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
849 {
851  body(attr);
852  vf.join(body._VoxelFunc);
853  of.join(body._OutsideFunc);
854 }
855 
856 // -----------------------------------------------------------------------------
857 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
858 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
859 {
860  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
861  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
862 }
863 
864 // -----------------------------------------------------------------------------
865 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
866 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
867 {
869  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
870 }
871 
872 // -----------------------------------------------------------------------------
873 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
874 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
875 {
876  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
877  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
878 }
879 
880 // -----------------------------------------------------------------------------
881 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
882 void ForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
883 {
885  body(re);
886  vf.join(body._VoxelFunc);
887  of.join(body._OutsideFunc);
888 }
889 
890 // -----------------------------------------------------------------------------
891 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
892 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
893 {
894  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
895  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
896 }
897 
898 // -----------------------------------------------------------------------------
899 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
900 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
901 {
903  body(re);
904  vf.join(body._VoxelFunc);
905  of.join(body._OutsideFunc);
906 }
907 
908 // -----------------------------------------------------------------------------
909 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
910 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
911 {
912  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
913  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
914 }
915 
916 // -----------------------------------------------------------------------------
917 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
918 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
919 {
921  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
922 }
923 
924 // -----------------------------------------------------------------------------
925 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
926 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
927 {
928  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
929  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
930 }
931 
932 // -----------------------------------------------------------------------------
933 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
934 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
935 {
937  body(re);
938  vf.join(body._VoxelFunc);
939  of.join(body._OutsideFunc);
940 }
941 
942 // -----------------------------------------------------------------------------
943 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
944 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
945 {
946  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
947  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
948 }
949 
950 // -----------------------------------------------------------------------------
951 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
952 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
953 {
955  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
956 }
957 
958 // -----------------------------------------------------------------------------
959 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
960 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
961 {
962  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
963  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
964 }
965 
966 // -----------------------------------------------------------------------------
967 // ParallelForEachVoxel
968 // -----------------------------------------------------------------------------
969 
970 //
971 // Image arguments by pointer
972 //
973 
974 // -----------------------------------------------------------------------------
975 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
976 void ParallelForEachScalar(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
977 {
978  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
980  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
981  else parallel_for (re, body);
982 }
983 
984 // -----------------------------------------------------------------------------
985 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
986 void ParallelForEachScalar(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
987 {
988  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
989  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
990 }
991 
992 // -----------------------------------------------------------------------------
993 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
994 void ParallelForEachVoxel(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
995 {
996  if (im7->GetTSize()) {
997  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
998  } else {
999  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1000  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
1001  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
1002  else parallel_for (re, body);
1003  }
1004 }
1005 
1006 // -----------------------------------------------------------------------------
1007 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1008 void ParallelForEachVoxel(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1009 {
1010  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1011  ParallelForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1012 }
1013 
1014 // -----------------------------------------------------------------------------
1015 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1016 void ParallelForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
1017 {
1018  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1019  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
1020  if (VoxelFunc::IsReduction()) {
1021  if (attr._dt) {
1022  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
1023  } else {
1024  parallel_reduce(re, body);
1025  }
1026  vf.join(body._VoxelFunc);
1027  } else {
1028  if (attr._dt) {
1029  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
1030  } else {
1031  parallel_for(re, body);
1032  }
1033  }
1034 }
1035 
1036 // -----------------------------------------------------------------------------
1037 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1038 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1039 {
1040  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1041  ParallelForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1042 }
1043 
1044 // -----------------------------------------------------------------------------
1045 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1046 void ParallelForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
1047 {
1048  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1049  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
1050  else parallel_for (re, body);
1051 }
1052 
1053 // -----------------------------------------------------------------------------
1054 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1055 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1056 {
1057  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1058  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1059 }
1060 
1061 // -----------------------------------------------------------------------------
1062 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1063 void ParallelForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
1064 {
1065  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1066  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
1067  else parallel_for (re, body);
1068 }
1069 
1070 // -----------------------------------------------------------------------------
1071 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1072 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1073 {
1074  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1075  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1076 }
1077 
1078 // -----------------------------------------------------------------------------
1079 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1080 void ParallelForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
1081 {
1082  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1083  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
1084  else parallel_for (re, body);
1085 }
1086 
1087 // -----------------------------------------------------------------------------
1088 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1089 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1090 {
1091  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1092  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1093 }
1094 
1095 //
1096 // Image arguments by reference
1097 //
1098 
1099 // -----------------------------------------------------------------------------
1100 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1101 void ParallelForEachScalar(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
1102 {
1103  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
1105  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
1106  else parallel_for (re, body);
1107 }
1108 
1109 // -----------------------------------------------------------------------------
1110 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1111 void ParallelForEachScalar(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1112 {
1113  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1114  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
1115 }
1116 
1117 // -----------------------------------------------------------------------------
1118 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1119 void ParallelForEachVoxel(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
1120 {
1121  if (im7.GetTSize()) {
1122  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
1123  } else {
1124  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
1125  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
1126  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
1127  else parallel_for (re, body);
1128  }
1129 }
1130 
1131 // -----------------------------------------------------------------------------
1132 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1133 void ParallelForEachVoxel(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1134 {
1135  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1136  ParallelForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
1137 }
1138 
1139 // -----------------------------------------------------------------------------
1140 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1141 void ParallelForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
1142 {
1143  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
1144  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
1145  if (VoxelFunc::IsReduction()) {
1146  if (attr._dt) {
1147  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
1148  } else {
1149  parallel_reduce(re, body);
1150  }
1151  vf.join(body._VoxelFunc);
1152  } else {
1153  if (attr._dt) {
1154  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
1155  } else {
1156  parallel_for(re, body);
1157  }
1158  }
1159 }
1160 
1161 // -----------------------------------------------------------------------------
1162 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1163 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1164 {
1165  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1166  ParallelForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
1167 }
1168 
1169 // -----------------------------------------------------------------------------
1170 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1171 void ParallelForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
1172 {
1173  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
1174  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
1175  else parallel_for (re, body);
1176 }
1177 
1178 // -----------------------------------------------------------------------------
1179 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1180 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1181 {
1182  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1183  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
1184 }
1185 
1186 // -----------------------------------------------------------------------------
1187 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1188 void ParallelForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
1189 {
1190  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
1191  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
1192  else parallel_for (re, body);
1193 }
1194 
1195 // -----------------------------------------------------------------------------
1196 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1197 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1198 {
1199  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1200  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
1201 }
1202 
1203 // -----------------------------------------------------------------------------
1204 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1205 void ParallelForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
1206 {
1207  SeptenaryForEachVoxelBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
1208  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
1209  else parallel_for (re, body);
1210 }
1211 
1212 // -----------------------------------------------------------------------------
1213 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1214 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1215 {
1216  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1217  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
1218 }
1219 
1220 // -----------------------------------------------------------------------------
1221 // ParallelForEachVoxelIf
1222 // -----------------------------------------------------------------------------
1223 
1224 //
1225 // Image arguments by pointer
1226 //
1227 
1228 // -----------------------------------------------------------------------------
1229 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1230 void ParallelForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
1231 {
1232  SeptenaryForEachVoxelIfBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1233  blocked_range<int> re(0, im7->GetNumberOfVoxels());
1234  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
1235  parallel_reduce(re, body);
1236  vf.join(body._VoxelFunc);
1237  of.join(body._OutsideFunc);
1238  } else {
1239  parallel_for(re, body);
1240  }
1241 }
1242 
1243 // -----------------------------------------------------------------------------
1244 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1245 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1246 {
1247  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1248  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1249 }
1250 
1251 // -----------------------------------------------------------------------------
1252 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1253 void ParallelForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
1254 {
1256  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1257 }
1258 
1259 // -----------------------------------------------------------------------------
1260 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1261 void ParallelForEachScalarIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1262 {
1263  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1264  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1265 }
1266 
1267 // -----------------------------------------------------------------------------
1268 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1269 void ParallelForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
1270 {
1271  if (im7->GetTSize()) {
1272  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1273  } else {
1274  SeptenaryForEachVoxelIfBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1275  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
1276  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
1277  parallel_reduce(re, body);
1278  vf.join(body._VoxelFunc);
1279  of.join(body._OutsideFunc);
1280  } else {
1281  parallel_for(re, body);
1282  }
1283  }
1284 }
1285 
1286 // -----------------------------------------------------------------------------
1287 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1288 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1289 {
1290  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1291  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1292 }
1293 
1294 // -----------------------------------------------------------------------------
1295 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1296 void ParallelForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
1297 {
1299  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1300 }
1301 
1302 // -----------------------------------------------------------------------------
1303 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1304 void ParallelForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1305 {
1306  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1307  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1308 }
1309 
1310 // -----------------------------------------------------------------------------
1311 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1312 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
1313 {
1314  SeptenaryForEachVoxelIfBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1315  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
1316  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
1317  if (attr._dt) {
1318  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
1319  } else {
1320  parallel_reduce(re, body);
1321  }
1322  vf.join(body._VoxelFunc);
1323  of.join(body._OutsideFunc);
1324  } else {
1325  if (attr._dt) {
1326  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
1327  } else {
1328  parallel_for(re, body);
1329  }
1330  }
1331 }
1332 
1333 // -----------------------------------------------------------------------------
1334 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1335 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1336 {
1337  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1338  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1339 }
1340 
1341 // -----------------------------------------------------------------------------
1342 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1343 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
1344 {
1346  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1347 }
1348 
1349 // -----------------------------------------------------------------------------
1350 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1351 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1352 {
1353  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1354  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1355 }
1356 
1357 // -----------------------------------------------------------------------------
1358 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1359 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
1360 {
1361  SeptenaryForEachVoxelIfBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1362  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
1363  parallel_reduce(re, body);
1364  vf.join(body._VoxelFunc);
1365  of.join(body._OutsideFunc);
1366  } else {
1367  parallel_for(re, body);
1368  }
1369 }
1370 
1371 // -----------------------------------------------------------------------------
1372 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1373 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1374 {
1375  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1376  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1377 }
1378 
1379 // -----------------------------------------------------------------------------
1380 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1381 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
1382 {
1384  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1385 }
1386 
1387 // -----------------------------------------------------------------------------
1388 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1389 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1390 {
1391  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1392  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1393 }
1394 
1395 // -----------------------------------------------------------------------------
1396 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1397 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
1398 {
1399  SeptenaryForEachVoxelIfBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1400  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
1401  parallel_reduce(re, body);
1402  vf.join(body._VoxelFunc);
1403  of.join(body._OutsideFunc);
1404  } else {
1405  parallel_for(re, body);
1406  }
1407 }
1408 
1409 // -----------------------------------------------------------------------------
1410 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1411 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1412 {
1413  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1414  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1415 }
1416 
1417 // -----------------------------------------------------------------------------
1418 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1419 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
1420 {
1422  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1423 }
1424 
1425 // -----------------------------------------------------------------------------
1426 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1427 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1428 {
1429  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1430  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1431 }
1432 
1433 // -----------------------------------------------------------------------------
1434 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1435 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
1436 {
1437  SeptenaryForEachVoxelIfBody_Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1438  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
1439  parallel_reduce(re, body);
1440  vf.join(body._VoxelFunc);
1441  of.join(body._OutsideFunc);
1442  } else {
1443  parallel_for(re, body);
1444  }
1445 }
1446 
1447 // -----------------------------------------------------------------------------
1448 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1449 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1450 {
1451  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1452  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1453 }
1454 
1455 // -----------------------------------------------------------------------------
1456 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1457 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7, VoxelFunc &vf)
1458 {
1460  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
1461 }
1462 
1463 // -----------------------------------------------------------------------------
1464 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1465 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, const GenericImage<T7> *im7)
1466 {
1467  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1468  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
1469 }
1470 
1471 //
1472 // Image arguments by reference
1473 //
1474 
1475 // -----------------------------------------------------------------------------
1476 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1477 void ParallelForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
1478 {
1481  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
1482  parallel_reduce(re, body);
1483  vf.join(body._VoxelFunc);
1484  of.join(body._OutsideFunc);
1485  } else {
1486  parallel_for(re, body);
1487  }
1488 }
1489 
1490 // -----------------------------------------------------------------------------
1491 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1492 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1493 {
1494  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1495  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
1496 }
1497 
1498 // -----------------------------------------------------------------------------
1499 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1500 void ParallelForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
1501 {
1503  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
1504 }
1505 
1506 // -----------------------------------------------------------------------------
1507 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1508 void ParallelForEachScalarIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1509 {
1510  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1511  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
1512 }
1513 
1514 // -----------------------------------------------------------------------------
1515 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1516 void ParallelForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
1517 {
1518  if (im7.GetTSize()) {
1519  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
1520  } else {
1522  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
1523  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
1524  parallel_reduce(re, body);
1525  vf.join(body._VoxelFunc);
1526  of.join(body._OutsideFunc);
1527  } else {
1528  parallel_for(re, body);
1529  }
1530  }
1531 }
1532 
1533 // -----------------------------------------------------------------------------
1534 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1535 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1536 {
1537  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1538  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
1539 }
1540 
1541 // -----------------------------------------------------------------------------
1542 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1543 void ParallelForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
1544 {
1546  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
1547 }
1548 
1549 // -----------------------------------------------------------------------------
1550 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1551 void ParallelForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1552 {
1553  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1554  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
1555 }
1556 
1557 // -----------------------------------------------------------------------------
1558 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1559 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
1560 {
1562  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
1563  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
1564  if (attr._dt) {
1565  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
1566  } else {
1567  parallel_reduce(re, body);
1568  }
1569  vf.join(body._VoxelFunc);
1570  of.join(body._OutsideFunc);
1571  } else {
1572  if (attr._dt) {
1573  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
1574  } else {
1575  parallel_for(re, body);
1576  }
1577  }
1578 }
1579 
1580 // -----------------------------------------------------------------------------
1581 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1582 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1583 {
1584  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1585  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
1586 }
1587 
1588 // -----------------------------------------------------------------------------
1589 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1590 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
1591 {
1593  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
1594 }
1595 
1596 // -----------------------------------------------------------------------------
1597 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1598 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1599 {
1600  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1601  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
1602 }
1603 
1604 // -----------------------------------------------------------------------------
1605 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1606 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
1607 {
1609  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
1610  parallel_reduce(re, body);
1611  vf.join(body._VoxelFunc);
1612  of.join(body._OutsideFunc);
1613  } else {
1614  parallel_for(re, body);
1615  }
1616 }
1617 
1618 // -----------------------------------------------------------------------------
1619 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1620 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1621 {
1622  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1623  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
1624 }
1625 
1626 // -----------------------------------------------------------------------------
1627 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1628 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
1629 {
1631  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
1632 }
1633 
1634 // -----------------------------------------------------------------------------
1635 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1636 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1637 {
1638  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1639  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
1640 }
1641 
1642 // -----------------------------------------------------------------------------
1643 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1644 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
1645 {
1647  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
1648  parallel_reduce(re, body);
1649  vf.join(body._VoxelFunc);
1650  of.join(body._OutsideFunc);
1651  } else {
1652  parallel_for(re, body);
1653  }
1654 }
1655 
1656 // -----------------------------------------------------------------------------
1657 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1658 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1659 {
1660  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1661  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
1662 }
1663 
1664 // -----------------------------------------------------------------------------
1665 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1666 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
1667 {
1669  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
1670 }
1671 
1672 // -----------------------------------------------------------------------------
1673 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1674 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1675 {
1676  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1677  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
1678 }
1679 
1680 // -----------------------------------------------------------------------------
1681 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1682 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
1683 {
1685  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
1686  parallel_reduce(re, body);
1687  vf.join(body._VoxelFunc);
1688  of.join(body._OutsideFunc);
1689  } else {
1690  parallel_for(re, body);
1691  }
1692 }
1693 
1694 // -----------------------------------------------------------------------------
1695 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
1696 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1697 {
1698  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1699  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
1700 }
1701 
1702 // -----------------------------------------------------------------------------
1703 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1704 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7, VoxelFunc &vf)
1705 {
1707  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
1708 }
1709 
1710 // -----------------------------------------------------------------------------
1711 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1712 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, const GenericImage<T7> &im7)
1713 {
1714  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
1715  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
1716 }
1717 
1718 // =============================================================================
1719 // 6 const, 1 non-const images
1720 // =============================================================================
1721 
1722 // -----------------------------------------------------------------------------
1723 /**
1724  * ForEachVoxel body for voxel function of 6 const, 1 non-const images
1725  */
1726 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
1728 {
1729  const GenericImage<T1> &im1;
1730  const GenericImage<T2> &im2;
1731  const GenericImage<T3> &im3;
1732  const GenericImage<T4> &im4;
1733  const GenericImage<T5> &im5;
1734  const GenericImage<T6> &im6;
1735  GenericImage<T7> &im7;
1736 
1737  /// Constructor
1739  const GenericImage<T2> &im2,
1740  const GenericImage<T3> &im3,
1741  const GenericImage<T4> &im4,
1742  const GenericImage<T5> &im5,
1743  const GenericImage<T6> &im6,
1744  GenericImage<T7> &im7,
1745  VoxelFunc &vf)
1746  :
1747  ForEachVoxelBody<VoxelFunc>(vf, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
1748  {}
1749 
1750  /// Copy constructor
1752  :
1753  ForEachVoxelBody<VoxelFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
1754  {}
1755 
1756  /// Split constructor
1758  :
1759  ForEachVoxelBody<VoxelFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
1760  {}
1761 
1762  /// Process entire image
1763  void operator ()(const ImageAttributes &attr) const
1764  {
1765  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
1766  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
1767  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
1768  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
1769  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
1770  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
1771  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
1772 
1773  const int T = (attr._dt ? attr._t : 1);
1774 
1775  for (int l = 0; l < T; ++l)
1776  for (int k = 0; k < attr._z; ++k)
1777  for (int j = 0; j < attr._y; ++j)
1778  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
1779  // const_cast such that voxel functions need only implement
1780  // non-const operator() which is required for parallel_reduce
1781  const_cast<SeptenaryForEachVoxelBody_6Const *>(this)->_VoxelFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
1782  }
1783  }
1784 
1785  /// Process image region using linear index
1786  void operator ()(const blocked_range<int> &re) const
1787  {
1788  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
1789  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
1790  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
1791  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
1792  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
1793  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
1794  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
1795 
1796  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
1797  // const_cast such that voxel functions need only implement
1798  // non-const operator() which is required for parallel_reduce
1799  const_cast<SeptenaryForEachVoxelBody_6Const *>(this)->_VoxelFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
1800  }
1801  }
1802 
1803  /// Process 2D image region
1804  void operator ()(const blocked_range2d<int> &re) const
1805  {
1806  const int bi = re.cols().begin();
1807  const int bj = re.rows().begin();
1808  const int ei = re.cols().end();
1809  const int ej = re.rows().end();
1810 
1811  const int s1 = im7.GetX() - (ei - bi);
1812 
1813  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
1814  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
1815  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
1816  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
1817  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
1818  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
1819  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
1820 
1821  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
1822  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
1823  // const_cast such that voxel functions need only implement
1824  // non-const operator() which is required for parallel_reduce
1825  const_cast<SeptenaryForEachVoxelBody_6Const *>(this)->_VoxelFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
1826  }
1827  }
1828 
1829  /// Process 3D image region
1830  void operator ()(const blocked_range3d<int> &re) const
1831  {
1832  const int bi = re.cols ().begin();
1833  const int bj = re.rows ().begin();
1834  const int bk = re.pages().begin();
1835  const int ei = re.cols ().end();
1836  const int ej = re.rows ().end();
1837  const int ek = re.pages().end();
1838 
1839  const int s1 = im7.GetX() - (ei - bi);
1840  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
1841 
1842  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
1843  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
1844  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
1845  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
1846  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
1847  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
1848  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
1849 
1850  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
1851  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
1852  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
1853  // const_cast such that voxel functions need only implement
1854  // non-const operator() which is required for parallel_reduce
1855  const_cast<SeptenaryForEachVoxelBody_6Const *>(this)->_VoxelFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
1856  }
1857  }
1858 };
1859 
1860 // -----------------------------------------------------------------------------
1861 /**
1862  * ForEachVoxel body for inside and outside unary voxel function of 6 const, 1 non-const images
1863  */
1864 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7,
1865  class VoxelFunc, class OutsideFunc = NaryVoxelFunction::NOP,
1866  class Domain = ForEachVoxelDomain::Foreground>
1867 struct SeptenaryForEachVoxelIfBody_6Const : public ForEachVoxelIfBody<VoxelFunc, OutsideFunc>
1868 {
1869  const GenericImage<T1> &im1;
1870  const GenericImage<T2> &im2;
1871  const GenericImage<T3> &im3;
1872  const GenericImage<T4> &im4;
1873  const GenericImage<T5> &im5;
1874  const GenericImage<T6> &im6;
1875  GenericImage<T7> &im7;
1876 
1877  /// Constructor
1879  const GenericImage<T2> &im2,
1880  const GenericImage<T3> &im3,
1881  const GenericImage<T4> &im4,
1882  const GenericImage<T5> &im5,
1883  const GenericImage<T6> &im6,
1884  GenericImage<T7> &im7,
1885  VoxelFunc &vf, OutsideFunc &of)
1886  :
1887  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(vf, of, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
1888  {}
1889 
1890  /// Copy constructor
1892  :
1893  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
1894  {}
1895 
1896  /// Split constructor
1898  :
1899  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
1900  {}
1901 
1902  /// Process entire image
1903  void operator ()(const ImageAttributes &attr) const
1904  {
1905  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
1906  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
1907  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
1908  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
1909  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
1910  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
1911  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
1912 
1913  const int T = (attr._dt ? attr._t : 1);
1914 
1915  for (int l = 0; l < T; ++l)
1916  for (int k = 0; k < attr._z; ++k)
1917  for (int j = 0; j < attr._y; ++j)
1918  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
1919  if (Domain::IsInside(im7, i, j, k, l, p7)) {
1920  // const_cast such that voxel functions need only implement
1921  // non-const operator() which is required for parallel_reduce
1922  const_cast<SeptenaryForEachVoxelIfBody_6Const *>(this)->_VoxelFunc (i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
1923  } else const_cast<SeptenaryForEachVoxelIfBody_6Const *>(this)->_OutsideFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
1924  }
1925  }
1926 
1927  /// Process image region using linear index
1928  void operator ()(const blocked_range<int> &re) const
1929  {
1930  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
1931  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
1932  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
1933  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
1934  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
1935  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
1936  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
1937 
1938  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
1939  if (Domain::IsInside(im7, idx, p7)) {
1940  // const_cast such that voxel functions need only implement
1941  // non-const operator() which is required for parallel_reduce
1942  const_cast<SeptenaryForEachVoxelIfBody_6Const *>(this)->_VoxelFunc (im7, idx, p1, p2, p3, p4, p5, p6, p7);
1943  } else const_cast<SeptenaryForEachVoxelIfBody_6Const *>(this)->_OutsideFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
1944  }
1945  }
1946 
1947  /// Process 2D image region
1948  void operator ()(const blocked_range2d<int> &re) const
1949  {
1950  const int bi = re.cols().begin();
1951  const int bj = re.rows().begin();
1952  const int ei = re.cols().end();
1953  const int ej = re.rows().end();
1954 
1955  const int s1 = im7.GetX() - (ei - bi);
1956 
1957  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
1958  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
1959  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
1960  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
1961  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
1962  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
1963  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
1964 
1965  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
1966  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
1967  if (Domain::IsInside(im7, i, j, this->_k, this->_l, p7)) {
1968  // const_cast such that voxel functions need only implement
1969  // non-const operator() which is required for parallel_reduce
1970  const_cast<SeptenaryForEachVoxelIfBody_6Const *>(this)->_VoxelFunc (i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
1971  } else const_cast<SeptenaryForEachVoxelIfBody_6Const *>(this)->_OutsideFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
1972  }
1973  }
1974 
1975  /// Process 3D image region
1976  void operator ()(const blocked_range3d<int> &re) const
1977  {
1978  const int bi = re.cols ().begin();
1979  const int bj = re.rows ().begin();
1980  const int bk = re.pages().begin();
1981  const int ei = re.cols ().end();
1982  const int ej = re.rows ().end();
1983  const int ek = re.pages().end();
1984 
1985  const int s1 = im7.GetX() - (ei - bi);
1986  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
1987 
1988  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
1989  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
1990  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
1991  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
1992  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
1993  const T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
1994  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
1995 
1996  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
1997  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
1998  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
1999  if (Domain::IsInside(im7, i, j, k, this->_l, p7)) {
2000  // const_cast such that voxel functions need only implement
2001  // non-const operator() which is required for parallel_reduce
2002  const_cast<SeptenaryForEachVoxelIfBody_6Const *>(this)->_VoxelFunc (i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
2003  } else const_cast<SeptenaryForEachVoxelIfBody_6Const *>(this)->_OutsideFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
2004  }
2005  }
2006 };
2007 
2008 // -----------------------------------------------------------------------------
2009 // ForEachVoxel
2010 // -----------------------------------------------------------------------------
2011 
2012 //
2013 // Image arguments by pointer
2014 //
2015 
2016 // -----------------------------------------------------------------------------
2017 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2018 void ForEachScalar(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2019 {
2020  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2021  blocked_range<int> re(0, im7->GetNumberOfVoxels());
2022  body(re);
2023  vf.join(body._VoxelFunc);
2024 }
2025 
2026 // -----------------------------------------------------------------------------
2027 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2028 void ForEachScalar(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2029 {
2030  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2031  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2032 }
2033 
2034 // -----------------------------------------------------------------------------
2035 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2036 void ForEachVoxel(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2037 {
2038  if (im7->GetTSize()) {
2039  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2040  } else {
2041  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2042  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
2043  body(re);
2044  vf.join(body._VoxelFunc);
2045  }
2046 }
2047 
2048 // -----------------------------------------------------------------------------
2049 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2050 void ForEachVoxel(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2051 {
2052  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2053  ForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2054 }
2055 
2056 // -----------------------------------------------------------------------------
2057 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2058 void ForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2059 {
2060  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2061  body(attr);
2062  vf.join(body._VoxelFunc);
2063 }
2064 
2065 // -----------------------------------------------------------------------------
2066 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2067 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2068 {
2069  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2070  ForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2071 }
2072 
2073 // -----------------------------------------------------------------------------
2074 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2075 void ForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2076 {
2077  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2078  body(re);
2079  vf.join(body._VoxelFunc);
2080 }
2081 
2082 // -----------------------------------------------------------------------------
2083 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2084 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2085 {
2086  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2087  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2088 }
2089 
2090 // -----------------------------------------------------------------------------
2091 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2092 void ForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2093 {
2094  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2095  body(re);
2096  vf.join(body._VoxelFunc);
2097 }
2098 
2099 // -----------------------------------------------------------------------------
2100 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2101 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2102 {
2103  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2104  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2105 }
2106 
2107 // -----------------------------------------------------------------------------
2108 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2109 void ForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2110 {
2111  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2112  body(re);
2113  vf.join(body._VoxelFunc);
2114 }
2115 
2116 // -----------------------------------------------------------------------------
2117 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2118 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2119 {
2120  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2121  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2122 }
2123 
2124 //
2125 // Image arguments by reference
2126 //
2127 
2128 // -----------------------------------------------------------------------------
2129 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2130 void ForEachScalar(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2131 {
2132  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
2134  body(re);
2135  vf.join(body._VoxelFunc);
2136 }
2137 
2138 // -----------------------------------------------------------------------------
2139 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2140 void ForEachScalar(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2141 {
2142  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2143  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
2144 }
2145 
2146 // -----------------------------------------------------------------------------
2147 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2148 void ForEachVoxel(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2149 {
2150  if (im7.GetTSize()) {
2151  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
2152  } else {
2153  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
2154  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
2155  body(re);
2156  vf.join(body._VoxelFunc);
2157  }
2158 }
2159 
2160 // -----------------------------------------------------------------------------
2161 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2162 void ForEachVoxel(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2163 {
2164  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2165  ForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
2166 }
2167 
2168 // -----------------------------------------------------------------------------
2169 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2170 void ForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2171 {
2172  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
2173  body(attr);
2174  vf.join(body._VoxelFunc);
2175 }
2176 
2177 // -----------------------------------------------------------------------------
2178 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2179 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2180 {
2181  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2182  ForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
2183 }
2184 
2185 // -----------------------------------------------------------------------------
2186 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2187 void ForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2188 {
2189  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
2190  body(re);
2191  vf.join(body._VoxelFunc);
2192 }
2193 
2194 // -----------------------------------------------------------------------------
2195 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2196 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2197 {
2198  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2199  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
2200 }
2201 
2202 // -----------------------------------------------------------------------------
2203 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2204 void ForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2205 {
2206  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
2207  body(re);
2208  vf.join(body._VoxelFunc);
2209 }
2210 
2211 // -----------------------------------------------------------------------------
2212 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2213 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2214 {
2215  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2216  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
2217 }
2218 
2219 // -----------------------------------------------------------------------------
2220 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2221 void ForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2222 {
2223  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
2224  body(re);
2225  vf.join(body._VoxelFunc);
2226 }
2227 
2228 // -----------------------------------------------------------------------------
2229 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2230 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2231 {
2232  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2233  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
2234 }
2235 
2236 // -----------------------------------------------------------------------------
2237 // ForEachVoxelIf
2238 // -----------------------------------------------------------------------------
2239 
2240 //
2241 // Image arguments by pointer
2242 //
2243 
2244 // -----------------------------------------------------------------------------
2245 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2246 void ForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
2247 {
2248  SeptenaryForEachVoxelIfBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2249  blocked_range<int> re(0, im7->GetNumberOfVoxels());
2250  body(re);
2251  vf.join(body._VoxelFunc);
2252  of.join(body._OutsideFunc);
2253 }
2254 
2255 // -----------------------------------------------------------------------------
2256 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2257 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2258 {
2259  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2260  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2261 }
2262 
2263 // -----------------------------------------------------------------------------
2264 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2265 void ForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2266 {
2268  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2269 }
2270 
2271 // -----------------------------------------------------------------------------
2272 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2273 void ForEachScalarIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2274 {
2275  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2276  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2277 }
2278 
2279 // -----------------------------------------------------------------------------
2280 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2281 void ForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
2282 {
2283  if (im7->GetTSize()) {
2284  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2285  } else {
2286  SeptenaryForEachVoxelIfBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2287  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
2288  body(re);
2289  vf.join(body._VoxelFunc);
2290  of.join(body._OutsideFunc);
2291  }
2292 }
2293 
2294 // -----------------------------------------------------------------------------
2295 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2296 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2297 {
2298  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2299  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2300 }
2301 
2302 // -----------------------------------------------------------------------------
2303 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2304 void ForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2305 {
2307  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2308 }
2309 
2310 // -----------------------------------------------------------------------------
2311 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2312 void ForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2313 {
2314  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2315  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2316 }
2317 
2318 // -----------------------------------------------------------------------------
2319 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2320 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
2321 {
2322  SeptenaryForEachVoxelIfBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2323  body(attr);
2324  vf.join(body._VoxelFunc);
2325  of.join(body._OutsideFunc);
2326 }
2327 
2328 // -----------------------------------------------------------------------------
2329 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2330 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2331 {
2332  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2333  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2334 }
2335 
2336 // -----------------------------------------------------------------------------
2337 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2338 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2339 {
2341  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2342 }
2343 
2344 // -----------------------------------------------------------------------------
2345 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2346 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2347 {
2348  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2349  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2350 }
2351 
2352 // -----------------------------------------------------------------------------
2353 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2354 void ForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
2355 {
2356  SeptenaryForEachVoxelIfBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2357  body(re);
2358  vf.join(body._VoxelFunc);
2359  of.join(body._OutsideFunc);
2360 }
2361 
2362 // -----------------------------------------------------------------------------
2363 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2364 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2365 {
2366  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2367  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2368 }
2369 
2370 // -----------------------------------------------------------------------------
2371 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2372 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
2373 {
2374  SeptenaryForEachVoxelIfBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2375  body(re);
2376  vf.join(body._VoxelFunc);
2377  of.join(body._OutsideFunc);
2378 }
2379 
2380 // -----------------------------------------------------------------------------
2381 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2382 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2383 {
2384  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2385  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2386 }
2387 
2388 // -----------------------------------------------------------------------------
2389 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2390 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2391 {
2393  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2394 }
2395 
2396 // -----------------------------------------------------------------------------
2397 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2398 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2399 {
2400  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2401  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2402 }
2403 
2404 // -----------------------------------------------------------------------------
2405 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2406 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
2407 {
2408  SeptenaryForEachVoxelIfBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2409  body(re);
2410  vf.join(body._VoxelFunc);
2411  of.join(body._OutsideFunc);
2412 }
2413 
2414 // -----------------------------------------------------------------------------
2415 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2416 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2417 {
2418  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2419  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2420 }
2421 
2422 // -----------------------------------------------------------------------------
2423 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2424 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2425 {
2427  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2428 }
2429 
2430 // -----------------------------------------------------------------------------
2431 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2432 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2433 {
2434  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2435  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2436 }
2437 
2438 //
2439 // Image arguments by reference
2440 //
2441 
2442 // -----------------------------------------------------------------------------
2443 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2444 void ForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
2445 {
2448  body(re);
2449  vf.join(body._VoxelFunc);
2450  of.join(body._OutsideFunc);
2451 }
2452 
2453 // -----------------------------------------------------------------------------
2454 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2455 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2456 {
2457  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2458  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
2459 }
2460 
2461 // -----------------------------------------------------------------------------
2462 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2463 void ForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2464 {
2466  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
2467 }
2468 
2469 // -----------------------------------------------------------------------------
2470 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2471 void ForEachScalarIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2472 {
2473  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2474  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
2475 }
2476 
2477 // -----------------------------------------------------------------------------
2478 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2479 void ForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
2480 {
2481  if (im7.GetTSize()) {
2482  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
2483  } else {
2485  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
2486  body(re);
2487  vf.join(body._VoxelFunc);
2488  of.join(body._OutsideFunc);
2489  }
2490 }
2491 
2492 // -----------------------------------------------------------------------------
2493 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2494 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2495 {
2496  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2497  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
2498 }
2499 
2500 // -----------------------------------------------------------------------------
2501 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2502 void ForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2503 {
2505  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
2506 }
2507 
2508 // -----------------------------------------------------------------------------
2509 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2510 void ForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2511 {
2512  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2513  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
2514 }
2515 
2516 // -----------------------------------------------------------------------------
2517 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2518 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
2519 {
2521  body(attr);
2522  vf.join(body._VoxelFunc);
2523  of.join(body._OutsideFunc);
2524 }
2525 
2526 // -----------------------------------------------------------------------------
2527 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2528 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2529 {
2530  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2531  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
2532 }
2533 
2534 // -----------------------------------------------------------------------------
2535 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2536 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2537 {
2539  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
2540 }
2541 
2542 // -----------------------------------------------------------------------------
2543 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2544 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2545 {
2546  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2547  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
2548 }
2549 
2550 // -----------------------------------------------------------------------------
2551 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2552 void ForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
2553 {
2555  body(re);
2556  vf.join(body._VoxelFunc);
2557  of.join(body._OutsideFunc);
2558 }
2559 
2560 // -----------------------------------------------------------------------------
2561 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2562 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2563 {
2564  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2565  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
2566 }
2567 
2568 // -----------------------------------------------------------------------------
2569 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2570 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
2571 {
2573  body(re);
2574  vf.join(body._VoxelFunc);
2575  of.join(body._OutsideFunc);
2576 }
2577 
2578 // -----------------------------------------------------------------------------
2579 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2580 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2581 {
2582  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2583  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
2584 }
2585 
2586 // -----------------------------------------------------------------------------
2587 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2588 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2589 {
2591  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
2592 }
2593 
2594 // -----------------------------------------------------------------------------
2595 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2596 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2597 {
2598  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2599  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
2600 }
2601 
2602 // -----------------------------------------------------------------------------
2603 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2604 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
2605 {
2607  body(re);
2608  vf.join(body._VoxelFunc);
2609  of.join(body._OutsideFunc);
2610 }
2611 
2612 // -----------------------------------------------------------------------------
2613 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2614 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2615 {
2616  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2617  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
2618 }
2619 
2620 // -----------------------------------------------------------------------------
2621 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2622 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2623 {
2625  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
2626 }
2627 
2628 // -----------------------------------------------------------------------------
2629 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2630 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2631 {
2632  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2633  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
2634 }
2635 
2636 // -----------------------------------------------------------------------------
2637 // ParallelForEachVoxel
2638 // -----------------------------------------------------------------------------
2639 
2640 //
2641 // Image arguments by pointer
2642 //
2643 
2644 // -----------------------------------------------------------------------------
2645 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2646 void ParallelForEachScalar(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2647 {
2648  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2649  blocked_range<int> re(0, im7->GetNumberOfVoxels());
2650  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
2651  else parallel_for (re, body);
2652 }
2653 
2654 // -----------------------------------------------------------------------------
2655 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2656 void ParallelForEachScalar(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2657 {
2658  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2659  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2660 }
2661 
2662 // -----------------------------------------------------------------------------
2663 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2664 void ParallelForEachVoxel(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2665 {
2666  if (im7->GetTSize()) {
2667  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2668  } else {
2669  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2670  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
2671  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
2672  else parallel_for (re, body);
2673  }
2674 }
2675 
2676 // -----------------------------------------------------------------------------
2677 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2678 void ParallelForEachVoxel(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2679 {
2680  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2681  ParallelForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2682 }
2683 
2684 // -----------------------------------------------------------------------------
2685 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2686 void ParallelForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2687 {
2688  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2689  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
2690  if (VoxelFunc::IsReduction()) {
2691  if (attr._dt) {
2692  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
2693  } else {
2694  parallel_reduce(re, body);
2695  }
2696  vf.join(body._VoxelFunc);
2697  } else {
2698  if (attr._dt) {
2699  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
2700  } else {
2701  parallel_for(re, body);
2702  }
2703  }
2704 }
2705 
2706 // -----------------------------------------------------------------------------
2707 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2708 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2709 {
2710  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2711  ParallelForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2712 }
2713 
2714 // -----------------------------------------------------------------------------
2715 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2716 void ParallelForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2717 {
2718  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2719  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
2720  else parallel_for (re, body);
2721 }
2722 
2723 // -----------------------------------------------------------------------------
2724 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2725 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2726 {
2727  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2728  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2729 }
2730 
2731 // -----------------------------------------------------------------------------
2732 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2733 void ParallelForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2734 {
2735  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2736  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
2737  else parallel_for (re, body);
2738 }
2739 
2740 // -----------------------------------------------------------------------------
2741 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2742 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2743 {
2744  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2745  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2746 }
2747 
2748 // -----------------------------------------------------------------------------
2749 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2750 void ParallelForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2751 {
2752  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2753  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
2754  else parallel_for (re, body);
2755 }
2756 
2757 // -----------------------------------------------------------------------------
2758 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2759 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2760 {
2761  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2762  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2763 }
2764 
2765 //
2766 // Image arguments by reference
2767 //
2768 
2769 // -----------------------------------------------------------------------------
2770 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2771 void ParallelForEachScalar(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2772 {
2773  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
2775  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
2776  else parallel_for (re, body);
2777 }
2778 
2779 // -----------------------------------------------------------------------------
2780 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2781 void ParallelForEachScalar(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2782 {
2783  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2784  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
2785 }
2786 
2787 // -----------------------------------------------------------------------------
2788 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2789 void ParallelForEachVoxel(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2790 {
2791  if (im7.GetTSize()) {
2792  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
2793  } else {
2794  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
2795  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
2796  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
2797  else parallel_for (re, body);
2798  }
2799 }
2800 
2801 // -----------------------------------------------------------------------------
2802 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2803 void ParallelForEachVoxel(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2804 {
2805  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2806  ParallelForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
2807 }
2808 
2809 // -----------------------------------------------------------------------------
2810 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2811 void ParallelForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2812 {
2813  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
2814  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
2815  if (VoxelFunc::IsReduction()) {
2816  if (attr._dt) {
2817  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
2818  } else {
2819  parallel_reduce(re, body);
2820  }
2821  vf.join(body._VoxelFunc);
2822  } else {
2823  if (attr._dt) {
2824  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
2825  } else {
2826  parallel_for(re, body);
2827  }
2828  }
2829 }
2830 
2831 // -----------------------------------------------------------------------------
2832 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2833 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2834 {
2835  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2836  ParallelForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
2837 }
2838 
2839 // -----------------------------------------------------------------------------
2840 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2841 void ParallelForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2842 {
2843  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
2844  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
2845  else parallel_for (re, body);
2846 }
2847 
2848 // -----------------------------------------------------------------------------
2849 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2850 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2851 {
2852  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2853  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
2854 }
2855 
2856 // -----------------------------------------------------------------------------
2857 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2858 void ParallelForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2859 {
2860  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
2861  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
2862  else parallel_for (re, body);
2863 }
2864 
2865 // -----------------------------------------------------------------------------
2866 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2867 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2868 {
2869  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2870  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
2871 }
2872 
2873 // -----------------------------------------------------------------------------
2874 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2875 void ParallelForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
2876 {
2877  SeptenaryForEachVoxelBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
2878  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
2879  else parallel_for (re, body);
2880 }
2881 
2882 // -----------------------------------------------------------------------------
2883 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2884 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
2885 {
2886  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2887  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
2888 }
2889 
2890 // -----------------------------------------------------------------------------
2891 // ParallelForEachVoxelIf
2892 // -----------------------------------------------------------------------------
2893 
2894 //
2895 // Image arguments by pointer
2896 //
2897 
2898 // -----------------------------------------------------------------------------
2899 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2900 void ParallelForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
2901 {
2902  SeptenaryForEachVoxelIfBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2903  blocked_range<int> re(0, im7->GetNumberOfVoxels());
2904  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
2905  parallel_reduce(re, body);
2906  vf.join(body._VoxelFunc);
2907  of.join(body._OutsideFunc);
2908  } else {
2909  parallel_for(re, body);
2910  }
2911 }
2912 
2913 // -----------------------------------------------------------------------------
2914 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2915 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2916 {
2917  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2918  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2919 }
2920 
2921 // -----------------------------------------------------------------------------
2922 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2923 void ParallelForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2924 {
2926  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2927 }
2928 
2929 // -----------------------------------------------------------------------------
2930 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2931 void ParallelForEachScalarIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2932 {
2933  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2934  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2935 }
2936 
2937 // -----------------------------------------------------------------------------
2938 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2939 void ParallelForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
2940 {
2941  if (im7->GetTSize()) {
2942  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2943  } else {
2944  SeptenaryForEachVoxelIfBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2945  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
2946  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
2947  parallel_reduce(re, body);
2948  vf.join(body._VoxelFunc);
2949  of.join(body._OutsideFunc);
2950  } else {
2951  parallel_for(re, body);
2952  }
2953  }
2954 }
2955 
2956 // -----------------------------------------------------------------------------
2957 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2958 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2959 {
2960  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2961  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2962 }
2963 
2964 // -----------------------------------------------------------------------------
2965 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2966 void ParallelForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
2967 {
2969  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2970 }
2971 
2972 // -----------------------------------------------------------------------------
2973 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
2974 void ParallelForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
2975 {
2976  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
2977  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
2978 }
2979 
2980 // -----------------------------------------------------------------------------
2981 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
2982 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
2983 {
2984  SeptenaryForEachVoxelIfBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
2985  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
2986  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
2987  if (attr._dt) {
2988  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
2989  } else {
2990  parallel_reduce(re, body);
2991  }
2992  vf.join(body._VoxelFunc);
2993  of.join(body._OutsideFunc);
2994  } else {
2995  if (attr._dt) {
2996  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
2997  } else {
2998  parallel_for(re, body);
2999  }
3000  }
3001 }
3002 
3003 // -----------------------------------------------------------------------------
3004 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3005 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
3006 {
3007  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3008  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3009 }
3010 
3011 // -----------------------------------------------------------------------------
3012 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3013 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
3014 {
3016  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3017 }
3018 
3019 // -----------------------------------------------------------------------------
3020 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3021 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
3022 {
3023  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3024  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3025 }
3026 
3027 // -----------------------------------------------------------------------------
3028 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3029 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
3030 {
3031  SeptenaryForEachVoxelIfBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3032  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
3033  parallel_reduce(re, body);
3034  vf.join(body._VoxelFunc);
3035  of.join(body._OutsideFunc);
3036  } else {
3037  parallel_for(re, body);
3038  }
3039 }
3040 
3041 // -----------------------------------------------------------------------------
3042 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3043 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
3044 {
3045  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3046  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3047 }
3048 
3049 // -----------------------------------------------------------------------------
3050 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3051 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
3052 {
3054  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3055 }
3056 
3057 // -----------------------------------------------------------------------------
3058 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3059 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
3060 {
3061  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3062  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3063 }
3064 
3065 // -----------------------------------------------------------------------------
3066 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3067 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
3068 {
3069  SeptenaryForEachVoxelIfBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3070  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
3071  parallel_reduce(re, body);
3072  vf.join(body._VoxelFunc);
3073  of.join(body._OutsideFunc);
3074  } else {
3075  parallel_for(re, body);
3076  }
3077 }
3078 
3079 // -----------------------------------------------------------------------------
3080 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3081 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
3082 {
3083  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3084  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3085 }
3086 
3087 // -----------------------------------------------------------------------------
3088 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3089 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
3090 {
3092  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3093 }
3094 
3095 // -----------------------------------------------------------------------------
3096 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3097 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
3098 {
3099  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3100  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3101 }
3102 
3103 // -----------------------------------------------------------------------------
3104 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3105 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
3106 {
3107  SeptenaryForEachVoxelIfBody_6Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3108  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
3109  parallel_reduce(re, body);
3110  vf.join(body._VoxelFunc);
3111  of.join(body._OutsideFunc);
3112  } else {
3113  parallel_for(re, body);
3114  }
3115 }
3116 
3117 // -----------------------------------------------------------------------------
3118 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3119 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
3120 {
3121  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3122  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3123 }
3124 
3125 // -----------------------------------------------------------------------------
3126 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3127 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
3128 {
3130  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3131 }
3132 
3133 // -----------------------------------------------------------------------------
3134 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3135 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, const GenericImage<T6> *im6, GenericImage<T7> *im7)
3136 {
3137  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3138  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3139 }
3140 
3141 //
3142 // Image arguments by reference
3143 //
3144 
3145 // -----------------------------------------------------------------------------
3146 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3147 void ParallelForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
3148 {
3151  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
3152  parallel_reduce(re, body);
3153  vf.join(body._VoxelFunc);
3154  of.join(body._OutsideFunc);
3155  } else {
3156  parallel_for(re, body);
3157  }
3158 }
3159 
3160 // -----------------------------------------------------------------------------
3161 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3162 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
3163 {
3164  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3165  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
3166 }
3167 
3168 // -----------------------------------------------------------------------------
3169 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3170 void ParallelForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
3171 {
3173  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
3174 }
3175 
3176 // -----------------------------------------------------------------------------
3177 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3178 void ParallelForEachScalarIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
3179 {
3180  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3181  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
3182 }
3183 
3184 // -----------------------------------------------------------------------------
3185 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3186 void ParallelForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
3187 {
3188  if (im7.GetTSize()) {
3189  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
3190  } else {
3192  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
3193  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
3194  parallel_reduce(re, body);
3195  vf.join(body._VoxelFunc);
3196  of.join(body._OutsideFunc);
3197  } else {
3198  parallel_for(re, body);
3199  }
3200  }
3201 }
3202 
3203 // -----------------------------------------------------------------------------
3204 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3205 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
3206 {
3207  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3208  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
3209 }
3210 
3211 // -----------------------------------------------------------------------------
3212 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3213 void ParallelForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
3214 {
3216  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
3217 }
3218 
3219 // -----------------------------------------------------------------------------
3220 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3221 void ParallelForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
3222 {
3223  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3224  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
3225 }
3226 
3227 // -----------------------------------------------------------------------------
3228 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3229 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
3230 {
3232  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
3233  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
3234  if (attr._dt) {
3235  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
3236  } else {
3237  parallel_reduce(re, body);
3238  }
3239  vf.join(body._VoxelFunc);
3240  of.join(body._OutsideFunc);
3241  } else {
3242  if (attr._dt) {
3243  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
3244  } else {
3245  parallel_for(re, body);
3246  }
3247  }
3248 }
3249 
3250 // -----------------------------------------------------------------------------
3251 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3252 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
3253 {
3254  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3255  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
3256 }
3257 
3258 // -----------------------------------------------------------------------------
3259 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3260 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
3261 {
3263  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
3264 }
3265 
3266 // -----------------------------------------------------------------------------
3267 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3268 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
3269 {
3270  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3271  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
3272 }
3273 
3274 // -----------------------------------------------------------------------------
3275 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3276 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
3277 {
3279  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
3280  parallel_reduce(re, body);
3281  vf.join(body._VoxelFunc);
3282  of.join(body._OutsideFunc);
3283  } else {
3284  parallel_for(re, body);
3285  }
3286 }
3287 
3288 // -----------------------------------------------------------------------------
3289 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3290 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
3291 {
3292  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3293  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
3294 }
3295 
3296 // -----------------------------------------------------------------------------
3297 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3298 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
3299 {
3301  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
3302 }
3303 
3304 // -----------------------------------------------------------------------------
3305 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3306 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
3307 {
3308  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3309  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
3310 }
3311 
3312 // -----------------------------------------------------------------------------
3313 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3314 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
3315 {
3317  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
3318  parallel_reduce(re, body);
3319  vf.join(body._VoxelFunc);
3320  of.join(body._OutsideFunc);
3321  } else {
3322  parallel_for(re, body);
3323  }
3324 }
3325 
3326 // -----------------------------------------------------------------------------
3327 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3328 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
3329 {
3330  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3331  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
3332 }
3333 
3334 // -----------------------------------------------------------------------------
3335 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3336 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
3337 {
3339  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
3340 }
3341 
3342 // -----------------------------------------------------------------------------
3343 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3344 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
3345 {
3346  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3347  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
3348 }
3349 
3350 // -----------------------------------------------------------------------------
3351 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3352 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
3353 {
3355  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
3356  parallel_reduce(re, body);
3357  vf.join(body._VoxelFunc);
3358  of.join(body._OutsideFunc);
3359  } else {
3360  parallel_for(re, body);
3361  }
3362 }
3363 
3364 // -----------------------------------------------------------------------------
3365 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3366 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
3367 {
3368  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3369  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
3370 }
3371 
3372 // -----------------------------------------------------------------------------
3373 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3374 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
3375 {
3377  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
3378 }
3379 
3380 // -----------------------------------------------------------------------------
3381 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3382 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, const GenericImage<T6> &im6, GenericImage<T7> &im7)
3383 {
3384  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3385  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
3386 }
3387 
3388 // =============================================================================
3389 // 5 const, 2 non-const images
3390 // =============================================================================
3391 
3392 // -----------------------------------------------------------------------------
3393 /**
3394  * ForEachVoxel body for voxel function of 5 const, 2 non-const images
3395  */
3396 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3398 {
3399  const GenericImage<T1> &im1;
3400  const GenericImage<T2> &im2;
3401  const GenericImage<T3> &im3;
3402  const GenericImage<T4> &im4;
3403  const GenericImage<T5> &im5;
3404  GenericImage<T6> &im6;
3405  GenericImage<T7> &im7;
3406 
3407  /// Constructor
3409  const GenericImage<T2> &im2,
3410  const GenericImage<T3> &im3,
3411  const GenericImage<T4> &im4,
3412  const GenericImage<T5> &im5,
3413  GenericImage<T6> &im6,
3414  GenericImage<T7> &im7,
3415  VoxelFunc &vf)
3416  :
3417  ForEachVoxelBody<VoxelFunc>(vf, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
3418  {}
3419 
3420  /// Copy constructor
3422  :
3423  ForEachVoxelBody<VoxelFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
3424  {}
3425 
3426  /// Split constructor
3428  :
3429  ForEachVoxelBody<VoxelFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
3430  {}
3431 
3432  /// Process entire image
3433  void operator ()(const ImageAttributes &attr) const
3434  {
3435  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
3436  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
3437  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
3438  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
3439  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
3440  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
3441  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
3442 
3443  const int T = (attr._dt ? attr._t : 1);
3444 
3445  for (int l = 0; l < T; ++l)
3446  for (int k = 0; k < attr._z; ++k)
3447  for (int j = 0; j < attr._y; ++j)
3448  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
3449  // const_cast such that voxel functions need only implement
3450  // non-const operator() which is required for parallel_reduce
3451  const_cast<SeptenaryForEachVoxelBody_5Const *>(this)->_VoxelFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
3452  }
3453  }
3454 
3455  /// Process image region using linear index
3456  void operator ()(const blocked_range<int> &re) const
3457  {
3458  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
3459  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
3460  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
3461  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
3462  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
3463  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
3464  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
3465 
3466  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
3467  // const_cast such that voxel functions need only implement
3468  // non-const operator() which is required for parallel_reduce
3469  const_cast<SeptenaryForEachVoxelBody_5Const *>(this)->_VoxelFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
3470  }
3471  }
3472 
3473  /// Process 2D image region
3474  void operator ()(const blocked_range2d<int> &re) const
3475  {
3476  const int bi = re.cols().begin();
3477  const int bj = re.rows().begin();
3478  const int ei = re.cols().end();
3479  const int ej = re.rows().end();
3480 
3481  const int s1 = im7.GetX() - (ei - bi);
3482 
3483  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
3484  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
3485  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
3486  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
3487  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
3488  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
3489  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
3490 
3491  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
3492  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
3493  // const_cast such that voxel functions need only implement
3494  // non-const operator() which is required for parallel_reduce
3495  const_cast<SeptenaryForEachVoxelBody_5Const *>(this)->_VoxelFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
3496  }
3497  }
3498 
3499  /// Process 3D image region
3500  void operator ()(const blocked_range3d<int> &re) const
3501  {
3502  const int bi = re.cols ().begin();
3503  const int bj = re.rows ().begin();
3504  const int bk = re.pages().begin();
3505  const int ei = re.cols ().end();
3506  const int ej = re.rows ().end();
3507  const int ek = re.pages().end();
3508 
3509  const int s1 = im7.GetX() - (ei - bi);
3510  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
3511 
3512  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
3513  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
3514  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
3515  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
3516  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
3517  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
3518  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
3519 
3520  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
3521  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
3522  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
3523  // const_cast such that voxel functions need only implement
3524  // non-const operator() which is required for parallel_reduce
3525  const_cast<SeptenaryForEachVoxelBody_5Const *>(this)->_VoxelFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
3526  }
3527  }
3528 };
3529 
3530 // -----------------------------------------------------------------------------
3531 /**
3532  * ForEachVoxel body for inside and outside unary voxel function of 5 const, 2 non-const images
3533  */
3534 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7,
3535  class VoxelFunc, class OutsideFunc = NaryVoxelFunction::NOP,
3536  class Domain = ForEachVoxelDomain::Foreground>
3537 struct SeptenaryForEachVoxelIfBody_5Const : public ForEachVoxelIfBody<VoxelFunc, OutsideFunc>
3538 {
3539  const GenericImage<T1> &im1;
3540  const GenericImage<T2> &im2;
3541  const GenericImage<T3> &im3;
3542  const GenericImage<T4> &im4;
3543  const GenericImage<T5> &im5;
3544  GenericImage<T6> &im6;
3545  GenericImage<T7> &im7;
3546 
3547  /// Constructor
3549  const GenericImage<T2> &im2,
3550  const GenericImage<T3> &im3,
3551  const GenericImage<T4> &im4,
3552  const GenericImage<T5> &im5,
3553  GenericImage<T6> &im6,
3554  GenericImage<T7> &im7,
3555  VoxelFunc &vf, OutsideFunc &of)
3556  :
3557  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(vf, of, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
3558  {}
3559 
3560  /// Copy constructor
3562  :
3563  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
3564  {}
3565 
3566  /// Split constructor
3568  :
3569  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
3570  {}
3571 
3572  /// Process entire image
3573  void operator ()(const ImageAttributes &attr) const
3574  {
3575  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
3576  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
3577  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
3578  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
3579  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
3580  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
3581  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
3582 
3583  const int T = (attr._dt ? attr._t : 1);
3584 
3585  for (int l = 0; l < T; ++l)
3586  for (int k = 0; k < attr._z; ++k)
3587  for (int j = 0; j < attr._y; ++j)
3588  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
3589  if (Domain::IsInside(im7, i, j, k, l, p7)) {
3590  // const_cast such that voxel functions need only implement
3591  // non-const operator() which is required for parallel_reduce
3592  const_cast<SeptenaryForEachVoxelIfBody_5Const *>(this)->_VoxelFunc (i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
3593  } else const_cast<SeptenaryForEachVoxelIfBody_5Const *>(this)->_OutsideFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
3594  }
3595  }
3596 
3597  /// Process image region using linear index
3598  void operator ()(const blocked_range<int> &re) const
3599  {
3600  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
3601  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
3602  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
3603  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
3604  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
3605  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
3606  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
3607 
3608  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
3609  if (Domain::IsInside(im7, idx, p7)) {
3610  // const_cast such that voxel functions need only implement
3611  // non-const operator() which is required for parallel_reduce
3612  const_cast<SeptenaryForEachVoxelIfBody_5Const *>(this)->_VoxelFunc (im7, idx, p1, p2, p3, p4, p5, p6, p7);
3613  } else const_cast<SeptenaryForEachVoxelIfBody_5Const *>(this)->_OutsideFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
3614  }
3615  }
3616 
3617  /// Process 2D image region
3618  void operator ()(const blocked_range2d<int> &re) const
3619  {
3620  const int bi = re.cols().begin();
3621  const int bj = re.rows().begin();
3622  const int ei = re.cols().end();
3623  const int ej = re.rows().end();
3624 
3625  const int s1 = im7.GetX() - (ei - bi);
3626 
3627  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
3628  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
3629  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
3630  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
3631  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
3632  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
3633  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
3634 
3635  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
3636  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
3637  if (Domain::IsInside(im7, i, j, this->_k, this->_l, p7)) {
3638  // const_cast such that voxel functions need only implement
3639  // non-const operator() which is required for parallel_reduce
3640  const_cast<SeptenaryForEachVoxelIfBody_5Const *>(this)->_VoxelFunc (i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
3641  } else const_cast<SeptenaryForEachVoxelIfBody_5Const *>(this)->_OutsideFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
3642  }
3643  }
3644 
3645  /// Process 3D image region
3646  void operator ()(const blocked_range3d<int> &re) const
3647  {
3648  const int bi = re.cols ().begin();
3649  const int bj = re.rows ().begin();
3650  const int bk = re.pages().begin();
3651  const int ei = re.cols ().end();
3652  const int ej = re.rows ().end();
3653  const int ek = re.pages().end();
3654 
3655  const int s1 = im7.GetX() - (ei - bi);
3656  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
3657 
3658  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
3659  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
3660  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
3661  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
3662  const T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
3663  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
3664  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
3665 
3666  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
3667  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
3668  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
3669  if (Domain::IsInside(im7, i, j, k, this->_l, p7)) {
3670  // const_cast such that voxel functions need only implement
3671  // non-const operator() which is required for parallel_reduce
3672  const_cast<SeptenaryForEachVoxelIfBody_5Const *>(this)->_VoxelFunc (i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
3673  } else const_cast<SeptenaryForEachVoxelIfBody_5Const *>(this)->_OutsideFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
3674  }
3675  }
3676 };
3677 
3678 // -----------------------------------------------------------------------------
3679 // ForEachVoxel
3680 // -----------------------------------------------------------------------------
3681 
3682 //
3683 // Image arguments by pointer
3684 //
3685 
3686 // -----------------------------------------------------------------------------
3687 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3688 void ForEachScalar(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
3689 {
3690  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3691  blocked_range<int> re(0, im7->GetNumberOfVoxels());
3692  body(re);
3693  vf.join(body._VoxelFunc);
3694 }
3695 
3696 // -----------------------------------------------------------------------------
3697 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3698 void ForEachScalar(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
3699 {
3700  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3701  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3702 }
3703 
3704 // -----------------------------------------------------------------------------
3705 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3706 void ForEachVoxel(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
3707 {
3708  if (im7->GetTSize()) {
3709  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3710  } else {
3711  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3712  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
3713  body(re);
3714  vf.join(body._VoxelFunc);
3715  }
3716 }
3717 
3718 // -----------------------------------------------------------------------------
3719 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3720 void ForEachVoxel(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
3721 {
3722  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3723  ForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3724 }
3725 
3726 // -----------------------------------------------------------------------------
3727 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3728 void ForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
3729 {
3730  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3731  body(attr);
3732  vf.join(body._VoxelFunc);
3733 }
3734 
3735 // -----------------------------------------------------------------------------
3736 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3737 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
3738 {
3739  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3740  ForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3741 }
3742 
3743 // -----------------------------------------------------------------------------
3744 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3745 void ForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
3746 {
3747  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3748  body(re);
3749  vf.join(body._VoxelFunc);
3750 }
3751 
3752 // -----------------------------------------------------------------------------
3753 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3754 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
3755 {
3756  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3757  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3758 }
3759 
3760 // -----------------------------------------------------------------------------
3761 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3762 void ForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
3763 {
3764  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3765  body(re);
3766  vf.join(body._VoxelFunc);
3767 }
3768 
3769 // -----------------------------------------------------------------------------
3770 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3771 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
3772 {
3773  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3774  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3775 }
3776 
3777 // -----------------------------------------------------------------------------
3778 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3779 void ForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
3780 {
3781  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3782  body(re);
3783  vf.join(body._VoxelFunc);
3784 }
3785 
3786 // -----------------------------------------------------------------------------
3787 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3788 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
3789 {
3790  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3791  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3792 }
3793 
3794 //
3795 // Image arguments by reference
3796 //
3797 
3798 // -----------------------------------------------------------------------------
3799 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3800 void ForEachScalar(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
3801 {
3802  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
3804  body(re);
3805  vf.join(body._VoxelFunc);
3806 }
3807 
3808 // -----------------------------------------------------------------------------
3809 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3810 void ForEachScalar(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
3811 {
3812  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3813  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
3814 }
3815 
3816 // -----------------------------------------------------------------------------
3817 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3818 void ForEachVoxel(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
3819 {
3820  if (im7.GetTSize()) {
3821  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
3822  } else {
3823  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
3824  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
3825  body(re);
3826  vf.join(body._VoxelFunc);
3827  }
3828 }
3829 
3830 // -----------------------------------------------------------------------------
3831 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3832 void ForEachVoxel(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
3833 {
3834  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3835  ForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
3836 }
3837 
3838 // -----------------------------------------------------------------------------
3839 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3840 void ForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
3841 {
3842  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
3843  body(attr);
3844  vf.join(body._VoxelFunc);
3845 }
3846 
3847 // -----------------------------------------------------------------------------
3848 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3849 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
3850 {
3851  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3852  ForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
3853 }
3854 
3855 // -----------------------------------------------------------------------------
3856 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3857 void ForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
3858 {
3859  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
3860  body(re);
3861  vf.join(body._VoxelFunc);
3862 }
3863 
3864 // -----------------------------------------------------------------------------
3865 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3866 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
3867 {
3868  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3869  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
3870 }
3871 
3872 // -----------------------------------------------------------------------------
3873 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3874 void ForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
3875 {
3876  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
3877  body(re);
3878  vf.join(body._VoxelFunc);
3879 }
3880 
3881 // -----------------------------------------------------------------------------
3882 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3883 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
3884 {
3885  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3886  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
3887 }
3888 
3889 // -----------------------------------------------------------------------------
3890 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3891 void ForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
3892 {
3893  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
3894  body(re);
3895  vf.join(body._VoxelFunc);
3896 }
3897 
3898 // -----------------------------------------------------------------------------
3899 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3900 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
3901 {
3902  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3903  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
3904 }
3905 
3906 // -----------------------------------------------------------------------------
3907 // ForEachVoxelIf
3908 // -----------------------------------------------------------------------------
3909 
3910 //
3911 // Image arguments by pointer
3912 //
3913 
3914 // -----------------------------------------------------------------------------
3915 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3916 void ForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
3917 {
3918  SeptenaryForEachVoxelIfBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3919  blocked_range<int> re(0, im7->GetNumberOfVoxels());
3920  body(re);
3921  vf.join(body._VoxelFunc);
3922  of.join(body._OutsideFunc);
3923 }
3924 
3925 // -----------------------------------------------------------------------------
3926 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3927 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
3928 {
3929  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3930  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3931 }
3932 
3933 // -----------------------------------------------------------------------------
3934 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3935 void ForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
3936 {
3938  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3939 }
3940 
3941 // -----------------------------------------------------------------------------
3942 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3943 void ForEachScalarIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
3944 {
3945  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3946  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3947 }
3948 
3949 // -----------------------------------------------------------------------------
3950 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3951 void ForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
3952 {
3953  if (im7->GetTSize()) {
3954  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3955  } else {
3956  SeptenaryForEachVoxelIfBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3957  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
3958  body(re);
3959  vf.join(body._VoxelFunc);
3960  of.join(body._OutsideFunc);
3961  }
3962 }
3963 
3964 // -----------------------------------------------------------------------------
3965 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3966 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
3967 {
3968  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3969  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3970 }
3971 
3972 // -----------------------------------------------------------------------------
3973 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3974 void ForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
3975 {
3977  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3978 }
3979 
3980 // -----------------------------------------------------------------------------
3981 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
3982 void ForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
3983 {
3984  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
3985  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
3986 }
3987 
3988 // -----------------------------------------------------------------------------
3989 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
3990 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
3991 {
3992  SeptenaryForEachVoxelIfBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
3993  body(attr);
3994  vf.join(body._VoxelFunc);
3995  of.join(body._OutsideFunc);
3996 }
3997 
3998 // -----------------------------------------------------------------------------
3999 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4000 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4001 {
4002  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4003  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4004 }
4005 
4006 // -----------------------------------------------------------------------------
4007 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4008 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
4009 {
4011  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4012 }
4013 
4014 // -----------------------------------------------------------------------------
4015 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4016 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4017 {
4018  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4019  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4020 }
4021 
4022 // -----------------------------------------------------------------------------
4023 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4024 void ForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
4025 {
4026  SeptenaryForEachVoxelIfBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4027  body(re);
4028  vf.join(body._VoxelFunc);
4029  of.join(body._OutsideFunc);
4030 }
4031 
4032 // -----------------------------------------------------------------------------
4033 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4034 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4035 {
4036  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4037  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4038 }
4039 
4040 // -----------------------------------------------------------------------------
4041 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4042 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
4043 {
4044  SeptenaryForEachVoxelIfBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4045  body(re);
4046  vf.join(body._VoxelFunc);
4047  of.join(body._OutsideFunc);
4048 }
4049 
4050 // -----------------------------------------------------------------------------
4051 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4052 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4053 {
4054  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4055  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4056 }
4057 
4058 // -----------------------------------------------------------------------------
4059 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4060 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
4061 {
4063  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4064 }
4065 
4066 // -----------------------------------------------------------------------------
4067 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4068 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4069 {
4070  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4071  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4072 }
4073 
4074 // -----------------------------------------------------------------------------
4075 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4076 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
4077 {
4078  SeptenaryForEachVoxelIfBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4079  body(re);
4080  vf.join(body._VoxelFunc);
4081  of.join(body._OutsideFunc);
4082 }
4083 
4084 // -----------------------------------------------------------------------------
4085 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4086 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4087 {
4088  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4089  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4090 }
4091 
4092 // -----------------------------------------------------------------------------
4093 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4094 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
4095 {
4097  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4098 }
4099 
4100 // -----------------------------------------------------------------------------
4101 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4102 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4103 {
4104  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4105  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4106 }
4107 
4108 //
4109 // Image arguments by reference
4110 //
4111 
4112 // -----------------------------------------------------------------------------
4113 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4114 void ForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
4115 {
4118  body(re);
4119  vf.join(body._VoxelFunc);
4120  of.join(body._OutsideFunc);
4121 }
4122 
4123 // -----------------------------------------------------------------------------
4124 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4125 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4126 {
4127  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4128  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
4129 }
4130 
4131 // -----------------------------------------------------------------------------
4132 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4133 void ForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
4134 {
4136  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
4137 }
4138 
4139 // -----------------------------------------------------------------------------
4140 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4141 void ForEachScalarIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4142 {
4143  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4144  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
4145 }
4146 
4147 // -----------------------------------------------------------------------------
4148 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4149 void ForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
4150 {
4151  if (im7.GetTSize()) {
4152  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
4153  } else {
4155  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
4156  body(re);
4157  vf.join(body._VoxelFunc);
4158  of.join(body._OutsideFunc);
4159  }
4160 }
4161 
4162 // -----------------------------------------------------------------------------
4163 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4164 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4165 {
4166  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4167  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
4168 }
4169 
4170 // -----------------------------------------------------------------------------
4171 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4172 void ForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
4173 {
4175  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
4176 }
4177 
4178 // -----------------------------------------------------------------------------
4179 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4180 void ForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4181 {
4182  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4183  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
4184 }
4185 
4186 // -----------------------------------------------------------------------------
4187 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4188 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
4189 {
4191  body(attr);
4192  vf.join(body._VoxelFunc);
4193  of.join(body._OutsideFunc);
4194 }
4195 
4196 // -----------------------------------------------------------------------------
4197 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4198 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4199 {
4200  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4201  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
4202 }
4203 
4204 // -----------------------------------------------------------------------------
4205 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4206 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
4207 {
4209  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
4210 }
4211 
4212 // -----------------------------------------------------------------------------
4213 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4214 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4215 {
4216  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4217  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
4218 }
4219 
4220 // -----------------------------------------------------------------------------
4221 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4222 void ForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
4223 {
4225  body(re);
4226  vf.join(body._VoxelFunc);
4227  of.join(body._OutsideFunc);
4228 }
4229 
4230 // -----------------------------------------------------------------------------
4231 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4232 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4233 {
4234  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4235  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
4236 }
4237 
4238 // -----------------------------------------------------------------------------
4239 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4240 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
4241 {
4243  body(re);
4244  vf.join(body._VoxelFunc);
4245  of.join(body._OutsideFunc);
4246 }
4247 
4248 // -----------------------------------------------------------------------------
4249 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4250 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4251 {
4252  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4253  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
4254 }
4255 
4256 // -----------------------------------------------------------------------------
4257 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4258 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
4259 {
4261  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
4262 }
4263 
4264 // -----------------------------------------------------------------------------
4265 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4266 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4267 {
4268  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4269  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
4270 }
4271 
4272 // -----------------------------------------------------------------------------
4273 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4274 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
4275 {
4277  body(re);
4278  vf.join(body._VoxelFunc);
4279  of.join(body._OutsideFunc);
4280 }
4281 
4282 // -----------------------------------------------------------------------------
4283 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4284 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4285 {
4286  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4287  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
4288 }
4289 
4290 // -----------------------------------------------------------------------------
4291 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4292 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
4293 {
4295  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
4296 }
4297 
4298 // -----------------------------------------------------------------------------
4299 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4300 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4301 {
4302  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4303  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
4304 }
4305 
4306 // -----------------------------------------------------------------------------
4307 // ParallelForEachVoxel
4308 // -----------------------------------------------------------------------------
4309 
4310 //
4311 // Image arguments by pointer
4312 //
4313 
4314 // -----------------------------------------------------------------------------
4315 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4316 void ParallelForEachScalar(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
4317 {
4318  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4319  blocked_range<int> re(0, im7->GetNumberOfVoxels());
4320  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
4321  else parallel_for (re, body);
4322 }
4323 
4324 // -----------------------------------------------------------------------------
4325 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4326 void ParallelForEachScalar(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4327 {
4328  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4329  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4330 }
4331 
4332 // -----------------------------------------------------------------------------
4333 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4334 void ParallelForEachVoxel(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
4335 {
4336  if (im7->GetTSize()) {
4337  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4338  } else {
4339  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4340  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
4341  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
4342  else parallel_for (re, body);
4343  }
4344 }
4345 
4346 // -----------------------------------------------------------------------------
4347 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4348 void ParallelForEachVoxel(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4349 {
4350  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4351  ParallelForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4352 }
4353 
4354 // -----------------------------------------------------------------------------
4355 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4356 void ParallelForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
4357 {
4358  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4359  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
4360  if (VoxelFunc::IsReduction()) {
4361  if (attr._dt) {
4362  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
4363  } else {
4364  parallel_reduce(re, body);
4365  }
4366  vf.join(body._VoxelFunc);
4367  } else {
4368  if (attr._dt) {
4369  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
4370  } else {
4371  parallel_for(re, body);
4372  }
4373  }
4374 }
4375 
4376 // -----------------------------------------------------------------------------
4377 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4378 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4379 {
4380  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4381  ParallelForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4382 }
4383 
4384 // -----------------------------------------------------------------------------
4385 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4386 void ParallelForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
4387 {
4388  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4389  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
4390  else parallel_for (re, body);
4391 }
4392 
4393 // -----------------------------------------------------------------------------
4394 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4395 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4396 {
4397  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4398  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4399 }
4400 
4401 // -----------------------------------------------------------------------------
4402 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4403 void ParallelForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
4404 {
4405  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4406  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
4407  else parallel_for (re, body);
4408 }
4409 
4410 // -----------------------------------------------------------------------------
4411 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4412 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4413 {
4414  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4415  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4416 }
4417 
4418 // -----------------------------------------------------------------------------
4419 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4420 void ParallelForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
4421 {
4422  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4423  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
4424  else parallel_for (re, body);
4425 }
4426 
4427 // -----------------------------------------------------------------------------
4428 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4429 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4430 {
4431  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4432  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4433 }
4434 
4435 //
4436 // Image arguments by reference
4437 //
4438 
4439 // -----------------------------------------------------------------------------
4440 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4441 void ParallelForEachScalar(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
4442 {
4443  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
4445  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
4446  else parallel_for (re, body);
4447 }
4448 
4449 // -----------------------------------------------------------------------------
4450 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4451 void ParallelForEachScalar(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4452 {
4453  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4454  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
4455 }
4456 
4457 // -----------------------------------------------------------------------------
4458 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4459 void ParallelForEachVoxel(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
4460 {
4461  if (im7.GetTSize()) {
4462  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
4463  } else {
4464  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
4465  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
4466  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
4467  else parallel_for (re, body);
4468  }
4469 }
4470 
4471 // -----------------------------------------------------------------------------
4472 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4473 void ParallelForEachVoxel(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4474 {
4475  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4476  ParallelForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
4477 }
4478 
4479 // -----------------------------------------------------------------------------
4480 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4481 void ParallelForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
4482 {
4483  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
4484  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
4485  if (VoxelFunc::IsReduction()) {
4486  if (attr._dt) {
4487  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
4488  } else {
4489  parallel_reduce(re, body);
4490  }
4491  vf.join(body._VoxelFunc);
4492  } else {
4493  if (attr._dt) {
4494  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
4495  } else {
4496  parallel_for(re, body);
4497  }
4498  }
4499 }
4500 
4501 // -----------------------------------------------------------------------------
4502 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4503 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4504 {
4505  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4506  ParallelForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
4507 }
4508 
4509 // -----------------------------------------------------------------------------
4510 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4511 void ParallelForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
4512 {
4513  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
4514  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
4515  else parallel_for (re, body);
4516 }
4517 
4518 // -----------------------------------------------------------------------------
4519 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4520 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4521 {
4522  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4523  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
4524 }
4525 
4526 // -----------------------------------------------------------------------------
4527 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4528 void ParallelForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
4529 {
4530  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
4531  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
4532  else parallel_for (re, body);
4533 }
4534 
4535 // -----------------------------------------------------------------------------
4536 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4537 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4538 {
4539  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4540  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
4541 }
4542 
4543 // -----------------------------------------------------------------------------
4544 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4545 void ParallelForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
4546 {
4547  SeptenaryForEachVoxelBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
4548  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
4549  else parallel_for (re, body);
4550 }
4551 
4552 // -----------------------------------------------------------------------------
4553 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4554 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4555 {
4556  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4557  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
4558 }
4559 
4560 // -----------------------------------------------------------------------------
4561 // ParallelForEachVoxelIf
4562 // -----------------------------------------------------------------------------
4563 
4564 //
4565 // Image arguments by pointer
4566 //
4567 
4568 // -----------------------------------------------------------------------------
4569 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4570 void ParallelForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
4571 {
4572  SeptenaryForEachVoxelIfBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4573  blocked_range<int> re(0, im7->GetNumberOfVoxels());
4574  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
4575  parallel_reduce(re, body);
4576  vf.join(body._VoxelFunc);
4577  of.join(body._OutsideFunc);
4578  } else {
4579  parallel_for(re, body);
4580  }
4581 }
4582 
4583 // -----------------------------------------------------------------------------
4584 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4585 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4586 {
4587  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4588  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4589 }
4590 
4591 // -----------------------------------------------------------------------------
4592 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4593 void ParallelForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
4594 {
4596  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4597 }
4598 
4599 // -----------------------------------------------------------------------------
4600 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4601 void ParallelForEachScalarIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4602 {
4603  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4604  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4605 }
4606 
4607 // -----------------------------------------------------------------------------
4608 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4609 void ParallelForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
4610 {
4611  if (im7->GetTSize()) {
4612  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4613  } else {
4614  SeptenaryForEachVoxelIfBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4615  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
4616  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
4617  parallel_reduce(re, body);
4618  vf.join(body._VoxelFunc);
4619  of.join(body._OutsideFunc);
4620  } else {
4621  parallel_for(re, body);
4622  }
4623  }
4624 }
4625 
4626 // -----------------------------------------------------------------------------
4627 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4628 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4629 {
4630  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4631  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4632 }
4633 
4634 // -----------------------------------------------------------------------------
4635 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4636 void ParallelForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
4637 {
4639  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4640 }
4641 
4642 // -----------------------------------------------------------------------------
4643 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4644 void ParallelForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4645 {
4646  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4647  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4648 }
4649 
4650 // -----------------------------------------------------------------------------
4651 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4652 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
4653 {
4654  SeptenaryForEachVoxelIfBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4655  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
4656  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
4657  if (attr._dt) {
4658  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
4659  } else {
4660  parallel_reduce(re, body);
4661  }
4662  vf.join(body._VoxelFunc);
4663  of.join(body._OutsideFunc);
4664  } else {
4665  if (attr._dt) {
4666  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
4667  } else {
4668  parallel_for(re, body);
4669  }
4670  }
4671 }
4672 
4673 // -----------------------------------------------------------------------------
4674 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4675 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4676 {
4677  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4678  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4679 }
4680 
4681 // -----------------------------------------------------------------------------
4682 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4683 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
4684 {
4686  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4687 }
4688 
4689 // -----------------------------------------------------------------------------
4690 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4691 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4692 {
4693  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4694  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4695 }
4696 
4697 // -----------------------------------------------------------------------------
4698 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4699 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
4700 {
4701  SeptenaryForEachVoxelIfBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4702  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
4703  parallel_reduce(re, body);
4704  vf.join(body._VoxelFunc);
4705  of.join(body._OutsideFunc);
4706  } else {
4707  parallel_for(re, body);
4708  }
4709 }
4710 
4711 // -----------------------------------------------------------------------------
4712 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4713 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4714 {
4715  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4716  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4717 }
4718 
4719 // -----------------------------------------------------------------------------
4720 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4721 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
4722 {
4724  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4725 }
4726 
4727 // -----------------------------------------------------------------------------
4728 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4729 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4730 {
4731  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4732  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4733 }
4734 
4735 // -----------------------------------------------------------------------------
4736 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4737 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
4738 {
4739  SeptenaryForEachVoxelIfBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4740  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
4741  parallel_reduce(re, body);
4742  vf.join(body._VoxelFunc);
4743  of.join(body._OutsideFunc);
4744  } else {
4745  parallel_for(re, body);
4746  }
4747 }
4748 
4749 // -----------------------------------------------------------------------------
4750 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4751 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4752 {
4753  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4754  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4755 }
4756 
4757 // -----------------------------------------------------------------------------
4758 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4759 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
4760 {
4762  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4763 }
4764 
4765 // -----------------------------------------------------------------------------
4766 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4767 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4768 {
4769  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4770  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4771 }
4772 
4773 // -----------------------------------------------------------------------------
4774 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4775 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
4776 {
4777  SeptenaryForEachVoxelIfBody_5Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4778  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
4779  parallel_reduce(re, body);
4780  vf.join(body._VoxelFunc);
4781  of.join(body._OutsideFunc);
4782  } else {
4783  parallel_for(re, body);
4784  }
4785 }
4786 
4787 // -----------------------------------------------------------------------------
4788 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4789 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4790 {
4791  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4792  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4793 }
4794 
4795 // -----------------------------------------------------------------------------
4796 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4797 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
4798 {
4800  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
4801 }
4802 
4803 // -----------------------------------------------------------------------------
4804 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4805 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, const GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
4806 {
4807  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4808  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
4809 }
4810 
4811 //
4812 // Image arguments by reference
4813 //
4814 
4815 // -----------------------------------------------------------------------------
4816 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4817 void ParallelForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
4818 {
4821  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
4822  parallel_reduce(re, body);
4823  vf.join(body._VoxelFunc);
4824  of.join(body._OutsideFunc);
4825  } else {
4826  parallel_for(re, body);
4827  }
4828 }
4829 
4830 // -----------------------------------------------------------------------------
4831 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4832 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4833 {
4834  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4835  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
4836 }
4837 
4838 // -----------------------------------------------------------------------------
4839 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4840 void ParallelForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
4841 {
4843  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
4844 }
4845 
4846 // -----------------------------------------------------------------------------
4847 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4848 void ParallelForEachScalarIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4849 {
4850  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4851  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
4852 }
4853 
4854 // -----------------------------------------------------------------------------
4855 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4856 void ParallelForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
4857 {
4858  if (im7.GetTSize()) {
4859  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
4860  } else {
4862  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
4863  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
4864  parallel_reduce(re, body);
4865  vf.join(body._VoxelFunc);
4866  of.join(body._OutsideFunc);
4867  } else {
4868  parallel_for(re, body);
4869  }
4870  }
4871 }
4872 
4873 // -----------------------------------------------------------------------------
4874 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4875 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4876 {
4877  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4878  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
4879 }
4880 
4881 // -----------------------------------------------------------------------------
4882 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4883 void ParallelForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
4884 {
4886  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
4887 }
4888 
4889 // -----------------------------------------------------------------------------
4890 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4891 void ParallelForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4892 {
4893  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4894  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
4895 }
4896 
4897 // -----------------------------------------------------------------------------
4898 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4899 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
4900 {
4902  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
4903  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
4904  if (attr._dt) {
4905  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
4906  } else {
4907  parallel_reduce(re, body);
4908  }
4909  vf.join(body._VoxelFunc);
4910  of.join(body._OutsideFunc);
4911  } else {
4912  if (attr._dt) {
4913  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
4914  } else {
4915  parallel_for(re, body);
4916  }
4917  }
4918 }
4919 
4920 // -----------------------------------------------------------------------------
4921 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4922 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4923 {
4924  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4925  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
4926 }
4927 
4928 // -----------------------------------------------------------------------------
4929 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4930 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
4931 {
4933  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
4934 }
4935 
4936 // -----------------------------------------------------------------------------
4937 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4938 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4939 {
4940  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4941  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
4942 }
4943 
4944 // -----------------------------------------------------------------------------
4945 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4946 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
4947 {
4949  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
4950  parallel_reduce(re, body);
4951  vf.join(body._VoxelFunc);
4952  of.join(body._OutsideFunc);
4953  } else {
4954  parallel_for(re, body);
4955  }
4956 }
4957 
4958 // -----------------------------------------------------------------------------
4959 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4960 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4961 {
4962  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4963  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
4964 }
4965 
4966 // -----------------------------------------------------------------------------
4967 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4968 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
4969 {
4971  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
4972 }
4973 
4974 // -----------------------------------------------------------------------------
4975 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
4976 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4977 {
4978  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
4979  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
4980 }
4981 
4982 // -----------------------------------------------------------------------------
4983 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4984 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
4985 {
4987  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
4988  parallel_reduce(re, body);
4989  vf.join(body._VoxelFunc);
4990  of.join(body._OutsideFunc);
4991  } else {
4992  parallel_for(re, body);
4993  }
4994 }
4995 
4996 // -----------------------------------------------------------------------------
4997 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
4998 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
4999 {
5000  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5001  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
5002 }
5003 
5004 // -----------------------------------------------------------------------------
5005 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5006 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
5007 {
5009  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
5010 }
5011 
5012 // -----------------------------------------------------------------------------
5013 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5014 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5015 {
5016  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5017  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
5018 }
5019 
5020 // -----------------------------------------------------------------------------
5021 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5022 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
5023 {
5025  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
5026  parallel_reduce(re, body);
5027  vf.join(body._VoxelFunc);
5028  of.join(body._OutsideFunc);
5029  } else {
5030  parallel_for(re, body);
5031  }
5032 }
5033 
5034 // -----------------------------------------------------------------------------
5035 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5036 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5037 {
5038  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5039  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
5040 }
5041 
5042 // -----------------------------------------------------------------------------
5043 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5044 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
5045 {
5047  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
5048 }
5049 
5050 // -----------------------------------------------------------------------------
5051 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5052 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, const GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5053 {
5054  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5055  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
5056 }
5057 
5058 // =============================================================================
5059 // 4 const, 3 non-const images
5060 // =============================================================================
5061 
5062 // -----------------------------------------------------------------------------
5063 /**
5064  * ForEachVoxel body for voxel function of 4 const, 3 non-const images
5065  */
5066 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5068 {
5069  const GenericImage<T1> &im1;
5070  const GenericImage<T2> &im2;
5071  const GenericImage<T3> &im3;
5072  const GenericImage<T4> &im4;
5073  GenericImage<T5> &im5;
5074  GenericImage<T6> &im6;
5075  GenericImage<T7> &im7;
5076 
5077  /// Constructor
5079  const GenericImage<T2> &im2,
5080  const GenericImage<T3> &im3,
5081  const GenericImage<T4> &im4,
5082  GenericImage<T5> &im5,
5083  GenericImage<T6> &im6,
5084  GenericImage<T7> &im7,
5085  VoxelFunc &vf)
5086  :
5087  ForEachVoxelBody<VoxelFunc>(vf, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
5088  {}
5089 
5090  /// Copy constructor
5092  :
5093  ForEachVoxelBody<VoxelFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
5094  {}
5095 
5096  /// Split constructor
5098  :
5099  ForEachVoxelBody<VoxelFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
5100  {}
5101 
5102  /// Process entire image
5103  void operator ()(const ImageAttributes &attr) const
5104  {
5105  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
5106  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
5107  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
5108  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
5109  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
5110  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
5111  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
5112 
5113  const int T = (attr._dt ? attr._t : 1);
5114 
5115  for (int l = 0; l < T; ++l)
5116  for (int k = 0; k < attr._z; ++k)
5117  for (int j = 0; j < attr._y; ++j)
5118  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
5119  // const_cast such that voxel functions need only implement
5120  // non-const operator() which is required for parallel_reduce
5121  const_cast<SeptenaryForEachVoxelBody_4Const *>(this)->_VoxelFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
5122  }
5123  }
5124 
5125  /// Process image region using linear index
5126  void operator ()(const blocked_range<int> &re) const
5127  {
5128  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
5129  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
5130  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
5131  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
5132  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
5133  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
5134  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
5135 
5136  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
5137  // const_cast such that voxel functions need only implement
5138  // non-const operator() which is required for parallel_reduce
5139  const_cast<SeptenaryForEachVoxelBody_4Const *>(this)->_VoxelFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
5140  }
5141  }
5142 
5143  /// Process 2D image region
5144  void operator ()(const blocked_range2d<int> &re) const
5145  {
5146  const int bi = re.cols().begin();
5147  const int bj = re.rows().begin();
5148  const int ei = re.cols().end();
5149  const int ej = re.rows().end();
5150 
5151  const int s1 = im7.GetX() - (ei - bi);
5152 
5153  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
5154  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
5155  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
5156  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
5157  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
5158  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
5159  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
5160 
5161  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
5162  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
5163  // const_cast such that voxel functions need only implement
5164  // non-const operator() which is required for parallel_reduce
5165  const_cast<SeptenaryForEachVoxelBody_4Const *>(this)->_VoxelFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
5166  }
5167  }
5168 
5169  /// Process 3D image region
5170  void operator ()(const blocked_range3d<int> &re) const
5171  {
5172  const int bi = re.cols ().begin();
5173  const int bj = re.rows ().begin();
5174  const int bk = re.pages().begin();
5175  const int ei = re.cols ().end();
5176  const int ej = re.rows ().end();
5177  const int ek = re.pages().end();
5178 
5179  const int s1 = im7.GetX() - (ei - bi);
5180  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
5181 
5182  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
5183  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
5184  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
5185  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
5186  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
5187  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
5188  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
5189 
5190  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
5191  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
5192  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
5193  // const_cast such that voxel functions need only implement
5194  // non-const operator() which is required for parallel_reduce
5195  const_cast<SeptenaryForEachVoxelBody_4Const *>(this)->_VoxelFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
5196  }
5197  }
5198 };
5199 
5200 // -----------------------------------------------------------------------------
5201 /**
5202  * ForEachVoxel body for inside and outside unary voxel function of 4 const, 3 non-const images
5203  */
5204 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7,
5205  class VoxelFunc, class OutsideFunc = NaryVoxelFunction::NOP,
5206  class Domain = ForEachVoxelDomain::Foreground>
5207 struct SeptenaryForEachVoxelIfBody_4Const : public ForEachVoxelIfBody<VoxelFunc, OutsideFunc>
5208 {
5209  const GenericImage<T1> &im1;
5210  const GenericImage<T2> &im2;
5211  const GenericImage<T3> &im3;
5212  const GenericImage<T4> &im4;
5213  GenericImage<T5> &im5;
5214  GenericImage<T6> &im6;
5215  GenericImage<T7> &im7;
5216 
5217  /// Constructor
5219  const GenericImage<T2> &im2,
5220  const GenericImage<T3> &im3,
5221  const GenericImage<T4> &im4,
5222  GenericImage<T5> &im5,
5223  GenericImage<T6> &im6,
5224  GenericImage<T7> &im7,
5225  VoxelFunc &vf, OutsideFunc &of)
5226  :
5227  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(vf, of, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
5228  {}
5229 
5230  /// Copy constructor
5232  :
5233  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
5234  {}
5235 
5236  /// Split constructor
5238  :
5239  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
5240  {}
5241 
5242  /// Process entire image
5243  void operator ()(const ImageAttributes &attr) const
5244  {
5245  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
5246  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
5247  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
5248  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
5249  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
5250  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
5251  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
5252 
5253  const int T = (attr._dt ? attr._t : 1);
5254 
5255  for (int l = 0; l < T; ++l)
5256  for (int k = 0; k < attr._z; ++k)
5257  for (int j = 0; j < attr._y; ++j)
5258  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
5259  if (Domain::IsInside(im7, i, j, k, l, p7)) {
5260  // const_cast such that voxel functions need only implement
5261  // non-const operator() which is required for parallel_reduce
5262  const_cast<SeptenaryForEachVoxelIfBody_4Const *>(this)->_VoxelFunc (i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
5263  } else const_cast<SeptenaryForEachVoxelIfBody_4Const *>(this)->_OutsideFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
5264  }
5265  }
5266 
5267  /// Process image region using linear index
5268  void operator ()(const blocked_range<int> &re) const
5269  {
5270  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
5271  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
5272  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
5273  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
5274  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
5275  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
5276  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
5277 
5278  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
5279  if (Domain::IsInside(im7, idx, p7)) {
5280  // const_cast such that voxel functions need only implement
5281  // non-const operator() which is required for parallel_reduce
5282  const_cast<SeptenaryForEachVoxelIfBody_4Const *>(this)->_VoxelFunc (im7, idx, p1, p2, p3, p4, p5, p6, p7);
5283  } else const_cast<SeptenaryForEachVoxelIfBody_4Const *>(this)->_OutsideFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
5284  }
5285  }
5286 
5287  /// Process 2D image region
5288  void operator ()(const blocked_range2d<int> &re) const
5289  {
5290  const int bi = re.cols().begin();
5291  const int bj = re.rows().begin();
5292  const int ei = re.cols().end();
5293  const int ej = re.rows().end();
5294 
5295  const int s1 = im7.GetX() - (ei - bi);
5296 
5297  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
5298  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
5299  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
5300  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
5301  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
5302  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
5303  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
5304 
5305  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
5306  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
5307  if (Domain::IsInside(im7, i, j, this->_k, this->_l, p7)) {
5308  // const_cast such that voxel functions need only implement
5309  // non-const operator() which is required for parallel_reduce
5310  const_cast<SeptenaryForEachVoxelIfBody_4Const *>(this)->_VoxelFunc (i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
5311  } else const_cast<SeptenaryForEachVoxelIfBody_4Const *>(this)->_OutsideFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
5312  }
5313  }
5314 
5315  /// Process 3D image region
5316  void operator ()(const blocked_range3d<int> &re) const
5317  {
5318  const int bi = re.cols ().begin();
5319  const int bj = re.rows ().begin();
5320  const int bk = re.pages().begin();
5321  const int ei = re.cols ().end();
5322  const int ej = re.rows ().end();
5323  const int ek = re.pages().end();
5324 
5325  const int s1 = im7.GetX() - (ei - bi);
5326  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
5327 
5328  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
5329  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
5330  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
5331  const T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
5332  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
5333  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
5334  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
5335 
5336  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
5337  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
5338  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
5339  if (Domain::IsInside(im7, i, j, k, this->_l, p7)) {
5340  // const_cast such that voxel functions need only implement
5341  // non-const operator() which is required for parallel_reduce
5342  const_cast<SeptenaryForEachVoxelIfBody_4Const *>(this)->_VoxelFunc (i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
5343  } else const_cast<SeptenaryForEachVoxelIfBody_4Const *>(this)->_OutsideFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
5344  }
5345  }
5346 };
5347 
5348 // -----------------------------------------------------------------------------
5349 // ForEachVoxel
5350 // -----------------------------------------------------------------------------
5351 
5352 //
5353 // Image arguments by pointer
5354 //
5355 
5356 // -----------------------------------------------------------------------------
5357 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5358 void ForEachScalar(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
5359 {
5360  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5361  blocked_range<int> re(0, im7->GetNumberOfVoxels());
5362  body(re);
5363  vf.join(body._VoxelFunc);
5364 }
5365 
5366 // -----------------------------------------------------------------------------
5367 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5368 void ForEachScalar(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5369 {
5370  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5371  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5372 }
5373 
5374 // -----------------------------------------------------------------------------
5375 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5376 void ForEachVoxel(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
5377 {
5378  if (im7->GetTSize()) {
5379  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5380  } else {
5381  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5382  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
5383  body(re);
5384  vf.join(body._VoxelFunc);
5385  }
5386 }
5387 
5388 // -----------------------------------------------------------------------------
5389 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5390 void ForEachVoxel(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5391 {
5392  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5393  ForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5394 }
5395 
5396 // -----------------------------------------------------------------------------
5397 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5398 void ForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
5399 {
5400  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5401  body(attr);
5402  vf.join(body._VoxelFunc);
5403 }
5404 
5405 // -----------------------------------------------------------------------------
5406 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5407 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5408 {
5409  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5410  ForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5411 }
5412 
5413 // -----------------------------------------------------------------------------
5414 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5415 void ForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
5416 {
5417  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5418  body(re);
5419  vf.join(body._VoxelFunc);
5420 }
5421 
5422 // -----------------------------------------------------------------------------
5423 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5424 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5425 {
5426  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5427  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5428 }
5429 
5430 // -----------------------------------------------------------------------------
5431 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5432 void ForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
5433 {
5434  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5435  body(re);
5436  vf.join(body._VoxelFunc);
5437 }
5438 
5439 // -----------------------------------------------------------------------------
5440 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5441 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5442 {
5443  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5444  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5445 }
5446 
5447 // -----------------------------------------------------------------------------
5448 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5449 void ForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
5450 {
5451  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5452  body(re);
5453  vf.join(body._VoxelFunc);
5454 }
5455 
5456 // -----------------------------------------------------------------------------
5457 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5458 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5459 {
5460  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5461  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5462 }
5463 
5464 //
5465 // Image arguments by reference
5466 //
5467 
5468 // -----------------------------------------------------------------------------
5469 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5470 void ForEachScalar(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
5471 {
5472  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
5474  body(re);
5475  vf.join(body._VoxelFunc);
5476 }
5477 
5478 // -----------------------------------------------------------------------------
5479 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5480 void ForEachScalar(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5481 {
5482  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5483  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
5484 }
5485 
5486 // -----------------------------------------------------------------------------
5487 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5488 void ForEachVoxel(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
5489 {
5490  if (im7.GetTSize()) {
5491  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
5492  } else {
5493  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
5494  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
5495  body(re);
5496  vf.join(body._VoxelFunc);
5497  }
5498 }
5499 
5500 // -----------------------------------------------------------------------------
5501 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5502 void ForEachVoxel(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5503 {
5504  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5505  ForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
5506 }
5507 
5508 // -----------------------------------------------------------------------------
5509 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5510 void ForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
5511 {
5512  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
5513  body(attr);
5514  vf.join(body._VoxelFunc);
5515 }
5516 
5517 // -----------------------------------------------------------------------------
5518 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5519 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5520 {
5521  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5522  ForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
5523 }
5524 
5525 // -----------------------------------------------------------------------------
5526 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5527 void ForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
5528 {
5529  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
5530  body(re);
5531  vf.join(body._VoxelFunc);
5532 }
5533 
5534 // -----------------------------------------------------------------------------
5535 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5536 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5537 {
5538  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5539  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
5540 }
5541 
5542 // -----------------------------------------------------------------------------
5543 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5544 void ForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
5545 {
5546  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
5547  body(re);
5548  vf.join(body._VoxelFunc);
5549 }
5550 
5551 // -----------------------------------------------------------------------------
5552 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5553 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5554 {
5555  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5556  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
5557 }
5558 
5559 // -----------------------------------------------------------------------------
5560 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5561 void ForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
5562 {
5563  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
5564  body(re);
5565  vf.join(body._VoxelFunc);
5566 }
5567 
5568 // -----------------------------------------------------------------------------
5569 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5570 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5571 {
5572  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5573  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
5574 }
5575 
5576 // -----------------------------------------------------------------------------
5577 // ForEachVoxelIf
5578 // -----------------------------------------------------------------------------
5579 
5580 //
5581 // Image arguments by pointer
5582 //
5583 
5584 // -----------------------------------------------------------------------------
5585 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5586 void ForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
5587 {
5588  SeptenaryForEachVoxelIfBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5589  blocked_range<int> re(0, im7->GetNumberOfVoxels());
5590  body(re);
5591  vf.join(body._VoxelFunc);
5592  of.join(body._OutsideFunc);
5593 }
5594 
5595 // -----------------------------------------------------------------------------
5596 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5597 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5598 {
5599  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5600  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5601 }
5602 
5603 // -----------------------------------------------------------------------------
5604 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5605 void ForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
5606 {
5608  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5609 }
5610 
5611 // -----------------------------------------------------------------------------
5612 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5613 void ForEachScalarIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5614 {
5615  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5616  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5617 }
5618 
5619 // -----------------------------------------------------------------------------
5620 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5621 void ForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
5622 {
5623  if (im7->GetTSize()) {
5624  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5625  } else {
5626  SeptenaryForEachVoxelIfBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5627  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
5628  body(re);
5629  vf.join(body._VoxelFunc);
5630  of.join(body._OutsideFunc);
5631  }
5632 }
5633 
5634 // -----------------------------------------------------------------------------
5635 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5636 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5637 {
5638  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5639  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5640 }
5641 
5642 // -----------------------------------------------------------------------------
5643 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5644 void ForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
5645 {
5647  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5648 }
5649 
5650 // -----------------------------------------------------------------------------
5651 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5652 void ForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5653 {
5654  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5655  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5656 }
5657 
5658 // -----------------------------------------------------------------------------
5659 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5660 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
5661 {
5662  SeptenaryForEachVoxelIfBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5663  body(attr);
5664  vf.join(body._VoxelFunc);
5665  of.join(body._OutsideFunc);
5666 }
5667 
5668 // -----------------------------------------------------------------------------
5669 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5670 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5671 {
5672  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5673  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5674 }
5675 
5676 // -----------------------------------------------------------------------------
5677 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5678 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
5679 {
5681  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5682 }
5683 
5684 // -----------------------------------------------------------------------------
5685 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5686 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5687 {
5688  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5689  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5690 }
5691 
5692 // -----------------------------------------------------------------------------
5693 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5694 void ForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
5695 {
5696  SeptenaryForEachVoxelIfBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5697  body(re);
5698  vf.join(body._VoxelFunc);
5699  of.join(body._OutsideFunc);
5700 }
5701 
5702 // -----------------------------------------------------------------------------
5703 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5704 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5705 {
5706  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5707  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5708 }
5709 
5710 // -----------------------------------------------------------------------------
5711 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5712 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
5713 {
5714  SeptenaryForEachVoxelIfBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5715  body(re);
5716  vf.join(body._VoxelFunc);
5717  of.join(body._OutsideFunc);
5718 }
5719 
5720 // -----------------------------------------------------------------------------
5721 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5722 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5723 {
5724  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5725  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5726 }
5727 
5728 // -----------------------------------------------------------------------------
5729 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5730 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
5731 {
5733  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5734 }
5735 
5736 // -----------------------------------------------------------------------------
5737 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5738 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5739 {
5740  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5741  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5742 }
5743 
5744 // -----------------------------------------------------------------------------
5745 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5746 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
5747 {
5748  SeptenaryForEachVoxelIfBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5749  body(re);
5750  vf.join(body._VoxelFunc);
5751  of.join(body._OutsideFunc);
5752 }
5753 
5754 // -----------------------------------------------------------------------------
5755 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5756 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5757 {
5758  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5759  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5760 }
5761 
5762 // -----------------------------------------------------------------------------
5763 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5764 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
5765 {
5767  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
5768 }
5769 
5770 // -----------------------------------------------------------------------------
5771 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5772 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5773 {
5774  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5775  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5776 }
5777 
5778 //
5779 // Image arguments by reference
5780 //
5781 
5782 // -----------------------------------------------------------------------------
5783 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5784 void ForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
5785 {
5788  body(re);
5789  vf.join(body._VoxelFunc);
5790  of.join(body._OutsideFunc);
5791 }
5792 
5793 // -----------------------------------------------------------------------------
5794 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5795 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5796 {
5797  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5798  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
5799 }
5800 
5801 // -----------------------------------------------------------------------------
5802 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5803 void ForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
5804 {
5806  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
5807 }
5808 
5809 // -----------------------------------------------------------------------------
5810 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5811 void ForEachScalarIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5812 {
5813  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5814  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
5815 }
5816 
5817 // -----------------------------------------------------------------------------
5818 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5819 void ForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
5820 {
5821  if (im7.GetTSize()) {
5822  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
5823  } else {
5825  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
5826  body(re);
5827  vf.join(body._VoxelFunc);
5828  of.join(body._OutsideFunc);
5829  }
5830 }
5831 
5832 // -----------------------------------------------------------------------------
5833 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5834 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5835 {
5836  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5837  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
5838 }
5839 
5840 // -----------------------------------------------------------------------------
5841 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5842 void ForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
5843 {
5845  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
5846 }
5847 
5848 // -----------------------------------------------------------------------------
5849 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5850 void ForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5851 {
5852  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5853  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
5854 }
5855 
5856 // -----------------------------------------------------------------------------
5857 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5858 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
5859 {
5861  body(attr);
5862  vf.join(body._VoxelFunc);
5863  of.join(body._OutsideFunc);
5864 }
5865 
5866 // -----------------------------------------------------------------------------
5867 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5868 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5869 {
5870  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5871  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
5872 }
5873 
5874 // -----------------------------------------------------------------------------
5875 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5876 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
5877 {
5879  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
5880 }
5881 
5882 // -----------------------------------------------------------------------------
5883 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5884 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5885 {
5886  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5887  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
5888 }
5889 
5890 // -----------------------------------------------------------------------------
5891 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5892 void ForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
5893 {
5895  body(re);
5896  vf.join(body._VoxelFunc);
5897  of.join(body._OutsideFunc);
5898 }
5899 
5900 // -----------------------------------------------------------------------------
5901 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5902 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5903 {
5904  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5905  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
5906 }
5907 
5908 // -----------------------------------------------------------------------------
5909 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5910 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
5911 {
5913  body(re);
5914  vf.join(body._VoxelFunc);
5915  of.join(body._OutsideFunc);
5916 }
5917 
5918 // -----------------------------------------------------------------------------
5919 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5920 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5921 {
5922  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5923  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
5924 }
5925 
5926 // -----------------------------------------------------------------------------
5927 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5928 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
5929 {
5931  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
5932 }
5933 
5934 // -----------------------------------------------------------------------------
5935 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5936 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5937 {
5938  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5939  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
5940 }
5941 
5942 // -----------------------------------------------------------------------------
5943 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5944 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
5945 {
5947  body(re);
5948  vf.join(body._VoxelFunc);
5949  of.join(body._OutsideFunc);
5950 }
5951 
5952 // -----------------------------------------------------------------------------
5953 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
5954 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5955 {
5956  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5957  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
5958 }
5959 
5960 // -----------------------------------------------------------------------------
5961 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5962 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
5963 {
5965  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
5966 }
5967 
5968 // -----------------------------------------------------------------------------
5969 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5970 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
5971 {
5972  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5973  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
5974 }
5975 
5976 // -----------------------------------------------------------------------------
5977 // ParallelForEachVoxel
5978 // -----------------------------------------------------------------------------
5979 
5980 //
5981 // Image arguments by pointer
5982 //
5983 
5984 // -----------------------------------------------------------------------------
5985 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5986 void ParallelForEachScalar(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
5987 {
5988  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
5989  blocked_range<int> re(0, im7->GetNumberOfVoxels());
5990  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
5991  else parallel_for (re, body);
5992 }
5993 
5994 // -----------------------------------------------------------------------------
5995 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
5996 void ParallelForEachScalar(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
5997 {
5998  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
5999  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6000 }
6001 
6002 // -----------------------------------------------------------------------------
6003 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6004 void ParallelForEachVoxel(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
6005 {
6006  if (im7->GetTSize()) {
6007  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6008  } else {
6009  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6010  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
6011  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
6012  else parallel_for (re, body);
6013  }
6014 }
6015 
6016 // -----------------------------------------------------------------------------
6017 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6018 void ParallelForEachVoxel(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6019 {
6020  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6021  ParallelForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6022 }
6023 
6024 // -----------------------------------------------------------------------------
6025 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6026 void ParallelForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
6027 {
6028  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6029  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
6030  if (VoxelFunc::IsReduction()) {
6031  if (attr._dt) {
6032  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
6033  } else {
6034  parallel_reduce(re, body);
6035  }
6036  vf.join(body._VoxelFunc);
6037  } else {
6038  if (attr._dt) {
6039  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
6040  } else {
6041  parallel_for(re, body);
6042  }
6043  }
6044 }
6045 
6046 // -----------------------------------------------------------------------------
6047 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6048 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6049 {
6050  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6051  ParallelForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6052 }
6053 
6054 // -----------------------------------------------------------------------------
6055 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6056 void ParallelForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
6057 {
6058  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6059  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
6060  else parallel_for (re, body);
6061 }
6062 
6063 // -----------------------------------------------------------------------------
6064 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6065 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6066 {
6067  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6068  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6069 }
6070 
6071 // -----------------------------------------------------------------------------
6072 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6073 void ParallelForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
6074 {
6075  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6076  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
6077  else parallel_for (re, body);
6078 }
6079 
6080 // -----------------------------------------------------------------------------
6081 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6082 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6083 {
6084  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6085  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6086 }
6087 
6088 // -----------------------------------------------------------------------------
6089 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6090 void ParallelForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
6091 {
6092  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6093  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
6094  else parallel_for (re, body);
6095 }
6096 
6097 // -----------------------------------------------------------------------------
6098 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6099 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6100 {
6101  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6102  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6103 }
6104 
6105 //
6106 // Image arguments by reference
6107 //
6108 
6109 // -----------------------------------------------------------------------------
6110 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6111 void ParallelForEachScalar(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
6112 {
6113  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
6115  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
6116  else parallel_for (re, body);
6117 }
6118 
6119 // -----------------------------------------------------------------------------
6120 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6121 void ParallelForEachScalar(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6122 {
6123  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6124  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
6125 }
6126 
6127 // -----------------------------------------------------------------------------
6128 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6129 void ParallelForEachVoxel(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
6130 {
6131  if (im7.GetTSize()) {
6132  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
6133  } else {
6134  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
6135  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
6136  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
6137  else parallel_for (re, body);
6138  }
6139 }
6140 
6141 // -----------------------------------------------------------------------------
6142 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6143 void ParallelForEachVoxel(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6144 {
6145  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6146  ParallelForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
6147 }
6148 
6149 // -----------------------------------------------------------------------------
6150 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6151 void ParallelForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
6152 {
6153  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
6154  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
6155  if (VoxelFunc::IsReduction()) {
6156  if (attr._dt) {
6157  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
6158  } else {
6159  parallel_reduce(re, body);
6160  }
6161  vf.join(body._VoxelFunc);
6162  } else {
6163  if (attr._dt) {
6164  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
6165  } else {
6166  parallel_for(re, body);
6167  }
6168  }
6169 }
6170 
6171 // -----------------------------------------------------------------------------
6172 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6173 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6174 {
6175  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6176  ParallelForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
6177 }
6178 
6179 // -----------------------------------------------------------------------------
6180 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6181 void ParallelForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
6182 {
6183  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
6184  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
6185  else parallel_for (re, body);
6186 }
6187 
6188 // -----------------------------------------------------------------------------
6189 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6190 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6191 {
6192  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6193  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
6194 }
6195 
6196 // -----------------------------------------------------------------------------
6197 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6198 void ParallelForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
6199 {
6200  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
6201  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
6202  else parallel_for (re, body);
6203 }
6204 
6205 // -----------------------------------------------------------------------------
6206 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6207 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6208 {
6209  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6210  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
6211 }
6212 
6213 // -----------------------------------------------------------------------------
6214 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6215 void ParallelForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
6216 {
6217  SeptenaryForEachVoxelBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
6218  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
6219  else parallel_for (re, body);
6220 }
6221 
6222 // -----------------------------------------------------------------------------
6223 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6224 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6225 {
6226  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6227  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
6228 }
6229 
6230 // -----------------------------------------------------------------------------
6231 // ParallelForEachVoxelIf
6232 // -----------------------------------------------------------------------------
6233 
6234 //
6235 // Image arguments by pointer
6236 //
6237 
6238 // -----------------------------------------------------------------------------
6239 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6240 void ParallelForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
6241 {
6242  SeptenaryForEachVoxelIfBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6243  blocked_range<int> re(0, im7->GetNumberOfVoxels());
6244  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
6245  parallel_reduce(re, body);
6246  vf.join(body._VoxelFunc);
6247  of.join(body._OutsideFunc);
6248  } else {
6249  parallel_for(re, body);
6250  }
6251 }
6252 
6253 // -----------------------------------------------------------------------------
6254 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6255 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6256 {
6257  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6258  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6259 }
6260 
6261 // -----------------------------------------------------------------------------
6262 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6263 void ParallelForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
6264 {
6266  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6267 }
6268 
6269 // -----------------------------------------------------------------------------
6270 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6271 void ParallelForEachScalarIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6272 {
6273  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6274  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6275 }
6276 
6277 // -----------------------------------------------------------------------------
6278 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6279 void ParallelForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
6280 {
6281  if (im7->GetTSize()) {
6282  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6283  } else {
6284  SeptenaryForEachVoxelIfBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6285  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
6286  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
6287  parallel_reduce(re, body);
6288  vf.join(body._VoxelFunc);
6289  of.join(body._OutsideFunc);
6290  } else {
6291  parallel_for(re, body);
6292  }
6293  }
6294 }
6295 
6296 // -----------------------------------------------------------------------------
6297 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6298 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6299 {
6300  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6301  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6302 }
6303 
6304 // -----------------------------------------------------------------------------
6305 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6306 void ParallelForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
6307 {
6309  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6310 }
6311 
6312 // -----------------------------------------------------------------------------
6313 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6314 void ParallelForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6315 {
6316  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6317  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6318 }
6319 
6320 // -----------------------------------------------------------------------------
6321 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6322 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
6323 {
6324  SeptenaryForEachVoxelIfBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6325  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
6326  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
6327  if (attr._dt) {
6328  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
6329  } else {
6330  parallel_reduce(re, body);
6331  }
6332  vf.join(body._VoxelFunc);
6333  of.join(body._OutsideFunc);
6334  } else {
6335  if (attr._dt) {
6336  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
6337  } else {
6338  parallel_for(re, body);
6339  }
6340  }
6341 }
6342 
6343 // -----------------------------------------------------------------------------
6344 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6345 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6346 {
6347  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6348  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6349 }
6350 
6351 // -----------------------------------------------------------------------------
6352 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6353 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
6354 {
6356  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6357 }
6358 
6359 // -----------------------------------------------------------------------------
6360 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6361 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6362 {
6363  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6364  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6365 }
6366 
6367 // -----------------------------------------------------------------------------
6368 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6369 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
6370 {
6371  SeptenaryForEachVoxelIfBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6372  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
6373  parallel_reduce(re, body);
6374  vf.join(body._VoxelFunc);
6375  of.join(body._OutsideFunc);
6376  } else {
6377  parallel_for(re, body);
6378  }
6379 }
6380 
6381 // -----------------------------------------------------------------------------
6382 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6383 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6384 {
6385  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6386  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6387 }
6388 
6389 // -----------------------------------------------------------------------------
6390 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6391 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
6392 {
6394  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6395 }
6396 
6397 // -----------------------------------------------------------------------------
6398 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6399 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6400 {
6401  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6402  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6403 }
6404 
6405 // -----------------------------------------------------------------------------
6406 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6407 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
6408 {
6409  SeptenaryForEachVoxelIfBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6410  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
6411  parallel_reduce(re, body);
6412  vf.join(body._VoxelFunc);
6413  of.join(body._OutsideFunc);
6414  } else {
6415  parallel_for(re, body);
6416  }
6417 }
6418 
6419 // -----------------------------------------------------------------------------
6420 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6421 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6422 {
6423  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6424  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6425 }
6426 
6427 // -----------------------------------------------------------------------------
6428 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6429 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
6430 {
6432  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6433 }
6434 
6435 // -----------------------------------------------------------------------------
6436 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6437 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6438 {
6439  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6440  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6441 }
6442 
6443 // -----------------------------------------------------------------------------
6444 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6445 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
6446 {
6447  SeptenaryForEachVoxelIfBody_4Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6448  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
6449  parallel_reduce(re, body);
6450  vf.join(body._VoxelFunc);
6451  of.join(body._OutsideFunc);
6452  } else {
6453  parallel_for(re, body);
6454  }
6455 }
6456 
6457 // -----------------------------------------------------------------------------
6458 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6459 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6460 {
6461  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6462  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6463 }
6464 
6465 // -----------------------------------------------------------------------------
6466 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6467 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
6468 {
6470  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
6471 }
6472 
6473 // -----------------------------------------------------------------------------
6474 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6475 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, const GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
6476 {
6477  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6478  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
6479 }
6480 
6481 //
6482 // Image arguments by reference
6483 //
6484 
6485 // -----------------------------------------------------------------------------
6486 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6487 void ParallelForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
6488 {
6491  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
6492  parallel_reduce(re, body);
6493  vf.join(body._VoxelFunc);
6494  of.join(body._OutsideFunc);
6495  } else {
6496  parallel_for(re, body);
6497  }
6498 }
6499 
6500 // -----------------------------------------------------------------------------
6501 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6502 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6503 {
6504  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6505  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
6506 }
6507 
6508 // -----------------------------------------------------------------------------
6509 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6510 void ParallelForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
6511 {
6513  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
6514 }
6515 
6516 // -----------------------------------------------------------------------------
6517 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6518 void ParallelForEachScalarIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6519 {
6520  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6521  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
6522 }
6523 
6524 // -----------------------------------------------------------------------------
6525 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6526 void ParallelForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
6527 {
6528  if (im7.GetTSize()) {
6529  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
6530  } else {
6532  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
6533  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
6534  parallel_reduce(re, body);
6535  vf.join(body._VoxelFunc);
6536  of.join(body._OutsideFunc);
6537  } else {
6538  parallel_for(re, body);
6539  }
6540  }
6541 }
6542 
6543 // -----------------------------------------------------------------------------
6544 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6545 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6546 {
6547  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6548  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
6549 }
6550 
6551 // -----------------------------------------------------------------------------
6552 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6553 void ParallelForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
6554 {
6556  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
6557 }
6558 
6559 // -----------------------------------------------------------------------------
6560 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6561 void ParallelForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6562 {
6563  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6564  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
6565 }
6566 
6567 // -----------------------------------------------------------------------------
6568 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6569 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
6570 {
6572  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
6573  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
6574  if (attr._dt) {
6575  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
6576  } else {
6577  parallel_reduce(re, body);
6578  }
6579  vf.join(body._VoxelFunc);
6580  of.join(body._OutsideFunc);
6581  } else {
6582  if (attr._dt) {
6583  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
6584  } else {
6585  parallel_for(re, body);
6586  }
6587  }
6588 }
6589 
6590 // -----------------------------------------------------------------------------
6591 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6592 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6593 {
6594  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6595  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
6596 }
6597 
6598 // -----------------------------------------------------------------------------
6599 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6600 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
6601 {
6603  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
6604 }
6605 
6606 // -----------------------------------------------------------------------------
6607 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6608 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6609 {
6610  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6611  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
6612 }
6613 
6614 // -----------------------------------------------------------------------------
6615 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6616 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
6617 {
6619  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
6620  parallel_reduce(re, body);
6621  vf.join(body._VoxelFunc);
6622  of.join(body._OutsideFunc);
6623  } else {
6624  parallel_for(re, body);
6625  }
6626 }
6627 
6628 // -----------------------------------------------------------------------------
6629 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6630 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6631 {
6632  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6633  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
6634 }
6635 
6636 // -----------------------------------------------------------------------------
6637 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6638 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
6639 {
6641  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
6642 }
6643 
6644 // -----------------------------------------------------------------------------
6645 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6646 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6647 {
6648  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6649  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
6650 }
6651 
6652 // -----------------------------------------------------------------------------
6653 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6654 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
6655 {
6657  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
6658  parallel_reduce(re, body);
6659  vf.join(body._VoxelFunc);
6660  of.join(body._OutsideFunc);
6661  } else {
6662  parallel_for(re, body);
6663  }
6664 }
6665 
6666 // -----------------------------------------------------------------------------
6667 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6668 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6669 {
6670  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6671  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
6672 }
6673 
6674 // -----------------------------------------------------------------------------
6675 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6676 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
6677 {
6679  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
6680 }
6681 
6682 // -----------------------------------------------------------------------------
6683 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6684 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6685 {
6686  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6687  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
6688 }
6689 
6690 // -----------------------------------------------------------------------------
6691 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6692 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
6693 {
6695  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
6696  parallel_reduce(re, body);
6697  vf.join(body._VoxelFunc);
6698  of.join(body._OutsideFunc);
6699  } else {
6700  parallel_for(re, body);
6701  }
6702 }
6703 
6704 // -----------------------------------------------------------------------------
6705 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
6706 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6707 {
6708  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6709  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
6710 }
6711 
6712 // -----------------------------------------------------------------------------
6713 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6714 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
6715 {
6717  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
6718 }
6719 
6720 // -----------------------------------------------------------------------------
6721 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6722 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, const GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
6723 {
6724  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
6725  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
6726 }
6727 
6728 // =============================================================================
6729 // 3 const, 4 non-const images
6730 // =============================================================================
6731 
6732 // -----------------------------------------------------------------------------
6733 /**
6734  * ForEachVoxel body for voxel function of 3 const, 4 non-const images
6735  */
6736 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
6738 {
6739  const GenericImage<T1> &im1;
6740  const GenericImage<T2> &im2;
6741  const GenericImage<T3> &im3;
6742  GenericImage<T4> &im4;
6743  GenericImage<T5> &im5;
6744  GenericImage<T6> &im6;
6745  GenericImage<T7> &im7;
6746 
6747  /// Constructor
6749  const GenericImage<T2> &im2,
6750  const GenericImage<T3> &im3,
6751  GenericImage<T4> &im4,
6752  GenericImage<T5> &im5,
6753  GenericImage<T6> &im6,
6754  GenericImage<T7> &im7,
6755  VoxelFunc &vf)
6756  :
6757  ForEachVoxelBody<VoxelFunc>(vf, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
6758  {}
6759 
6760  /// Copy constructor
6762  :
6763  ForEachVoxelBody<VoxelFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
6764  {}
6765 
6766  /// Split constructor
6768  :
6769  ForEachVoxelBody<VoxelFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
6770  {}
6771 
6772  /// Process entire image
6773  void operator ()(const ImageAttributes &attr) const
6774  {
6775  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
6776  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
6777  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
6778  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
6779  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
6780  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
6781  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
6782 
6783  const int T = (attr._dt ? attr._t : 1);
6784 
6785  for (int l = 0; l < T; ++l)
6786  for (int k = 0; k < attr._z; ++k)
6787  for (int j = 0; j < attr._y; ++j)
6788  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
6789  // const_cast such that voxel functions need only implement
6790  // non-const operator() which is required for parallel_reduce
6791  const_cast<SeptenaryForEachVoxelBody_3Const *>(this)->_VoxelFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
6792  }
6793  }
6794 
6795  /// Process image region using linear index
6796  void operator ()(const blocked_range<int> &re) const
6797  {
6798  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
6799  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
6800  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
6801  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
6802  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
6803  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
6804  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
6805 
6806  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
6807  // const_cast such that voxel functions need only implement
6808  // non-const operator() which is required for parallel_reduce
6809  const_cast<SeptenaryForEachVoxelBody_3Const *>(this)->_VoxelFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
6810  }
6811  }
6812 
6813  /// Process 2D image region
6814  void operator ()(const blocked_range2d<int> &re) const
6815  {
6816  const int bi = re.cols().begin();
6817  const int bj = re.rows().begin();
6818  const int ei = re.cols().end();
6819  const int ej = re.rows().end();
6820 
6821  const int s1 = im7.GetX() - (ei - bi);
6822 
6823  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
6824  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
6825  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
6826  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
6827  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
6828  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
6829  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
6830 
6831  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
6832  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
6833  // const_cast such that voxel functions need only implement
6834  // non-const operator() which is required for parallel_reduce
6835  const_cast<SeptenaryForEachVoxelBody_3Const *>(this)->_VoxelFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
6836  }
6837  }
6838 
6839  /// Process 3D image region
6840  void operator ()(const blocked_range3d<int> &re) const
6841  {
6842  const int bi = re.cols ().begin();
6843  const int bj = re.rows ().begin();
6844  const int bk = re.pages().begin();
6845  const int ei = re.cols ().end();
6846  const int ej = re.rows ().end();
6847  const int ek = re.pages().end();
6848 
6849  const int s1 = im7.GetX() - (ei - bi);
6850  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
6851 
6852  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
6853  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
6854  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
6855  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
6856  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
6857  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
6858  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
6859 
6860  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
6861  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
6862  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
6863  // const_cast such that voxel functions need only implement
6864  // non-const operator() which is required for parallel_reduce
6865  const_cast<SeptenaryForEachVoxelBody_3Const *>(this)->_VoxelFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
6866  }
6867  }
6868 };
6869 
6870 // -----------------------------------------------------------------------------
6871 /**
6872  * ForEachVoxel body for inside and outside unary voxel function of 3 const, 4 non-const images
6873  */
6874 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7,
6875  class VoxelFunc, class OutsideFunc = NaryVoxelFunction::NOP,
6876  class Domain = ForEachVoxelDomain::Foreground>
6877 struct SeptenaryForEachVoxelIfBody_3Const : public ForEachVoxelIfBody<VoxelFunc, OutsideFunc>
6878 {
6879  const GenericImage<T1> &im1;
6880  const GenericImage<T2> &im2;
6881  const GenericImage<T3> &im3;
6882  GenericImage<T4> &im4;
6883  GenericImage<T5> &im5;
6884  GenericImage<T6> &im6;
6885  GenericImage<T7> &im7;
6886 
6887  /// Constructor
6889  const GenericImage<T2> &im2,
6890  const GenericImage<T3> &im3,
6891  GenericImage<T4> &im4,
6892  GenericImage<T5> &im5,
6893  GenericImage<T6> &im6,
6894  GenericImage<T7> &im7,
6895  VoxelFunc &vf, OutsideFunc &of)
6896  :
6897  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(vf, of, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
6898  {}
6899 
6900  /// Copy constructor
6902  :
6903  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
6904  {}
6905 
6906  /// Split constructor
6908  :
6909  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
6910  {}
6911 
6912  /// Process entire image
6913  void operator ()(const ImageAttributes &attr) const
6914  {
6915  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
6916  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
6917  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
6918  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
6919  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
6920  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
6921  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
6922 
6923  const int T = (attr._dt ? attr._t : 1);
6924 
6925  for (int l = 0; l < T; ++l)
6926  for (int k = 0; k < attr._z; ++k)
6927  for (int j = 0; j < attr._y; ++j)
6928  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
6929  if (Domain::IsInside(im7, i, j, k, l, p7)) {
6930  // const_cast such that voxel functions need only implement
6931  // non-const operator() which is required for parallel_reduce
6932  const_cast<SeptenaryForEachVoxelIfBody_3Const *>(this)->_VoxelFunc (i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
6933  } else const_cast<SeptenaryForEachVoxelIfBody_3Const *>(this)->_OutsideFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
6934  }
6935  }
6936 
6937  /// Process image region using linear index
6938  void operator ()(const blocked_range<int> &re) const
6939  {
6940  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
6941  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
6942  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
6943  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
6944  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
6945  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
6946  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
6947 
6948  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
6949  if (Domain::IsInside(im7, idx, p7)) {
6950  // const_cast such that voxel functions need only implement
6951  // non-const operator() which is required for parallel_reduce
6952  const_cast<SeptenaryForEachVoxelIfBody_3Const *>(this)->_VoxelFunc (im7, idx, p1, p2, p3, p4, p5, p6, p7);
6953  } else const_cast<SeptenaryForEachVoxelIfBody_3Const *>(this)->_OutsideFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
6954  }
6955  }
6956 
6957  /// Process 2D image region
6958  void operator ()(const blocked_range2d<int> &re) const
6959  {
6960  const int bi = re.cols().begin();
6961  const int bj = re.rows().begin();
6962  const int ei = re.cols().end();
6963  const int ej = re.rows().end();
6964 
6965  const int s1 = im7.GetX() - (ei - bi);
6966 
6967  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
6968  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
6969  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
6970  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
6971  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
6972  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
6973  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
6974 
6975  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
6976  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
6977  if (Domain::IsInside(im7, i, j, this->_k, this->_l, p7)) {
6978  // const_cast such that voxel functions need only implement
6979  // non-const operator() which is required for parallel_reduce
6980  const_cast<SeptenaryForEachVoxelIfBody_3Const *>(this)->_VoxelFunc (i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
6981  } else const_cast<SeptenaryForEachVoxelIfBody_3Const *>(this)->_OutsideFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
6982  }
6983  }
6984 
6985  /// Process 3D image region
6986  void operator ()(const blocked_range3d<int> &re) const
6987  {
6988  const int bi = re.cols ().begin();
6989  const int bj = re.rows ().begin();
6990  const int bk = re.pages().begin();
6991  const int ei = re.cols ().end();
6992  const int ej = re.rows ().end();
6993  const int ek = re.pages().end();
6994 
6995  const int s1 = im7.GetX() - (ei - bi);
6996  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
6997 
6998  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
6999  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
7000  const T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
7001  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
7002  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
7003  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
7004  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
7005 
7006  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
7007  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
7008  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
7009  if (Domain::IsInside(im7, i, j, k, this->_l, p7)) {
7010  // const_cast such that voxel functions need only implement
7011  // non-const operator() which is required for parallel_reduce
7012  const_cast<SeptenaryForEachVoxelIfBody_3Const *>(this)->_VoxelFunc (i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
7013  } else const_cast<SeptenaryForEachVoxelIfBody_3Const *>(this)->_OutsideFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
7014  }
7015  }
7016 };
7017 
7018 // -----------------------------------------------------------------------------
7019 // ForEachVoxel
7020 // -----------------------------------------------------------------------------
7021 
7022 //
7023 // Image arguments by pointer
7024 //
7025 
7026 // -----------------------------------------------------------------------------
7027 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7028 void ForEachScalar(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7029 {
7030  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7031  blocked_range<int> re(0, im7->GetNumberOfVoxels());
7032  body(re);
7033  vf.join(body._VoxelFunc);
7034 }
7035 
7036 // -----------------------------------------------------------------------------
7037 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7038 void ForEachScalar(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7039 {
7040  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7041  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7042 }
7043 
7044 // -----------------------------------------------------------------------------
7045 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7046 void ForEachVoxel(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7047 {
7048  if (im7->GetTSize()) {
7049  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7050  } else {
7051  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7052  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
7053  body(re);
7054  vf.join(body._VoxelFunc);
7055  }
7056 }
7057 
7058 // -----------------------------------------------------------------------------
7059 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7060 void ForEachVoxel(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7061 {
7062  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7063  ForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7064 }
7065 
7066 // -----------------------------------------------------------------------------
7067 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7068 void ForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7069 {
7070  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7071  body(attr);
7072  vf.join(body._VoxelFunc);
7073 }
7074 
7075 // -----------------------------------------------------------------------------
7076 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7077 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7078 {
7079  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7080  ForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7081 }
7082 
7083 // -----------------------------------------------------------------------------
7084 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7085 void ForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7086 {
7087  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7088  body(re);
7089  vf.join(body._VoxelFunc);
7090 }
7091 
7092 // -----------------------------------------------------------------------------
7093 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7094 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7095 {
7096  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7097  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7098 }
7099 
7100 // -----------------------------------------------------------------------------
7101 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7102 void ForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7103 {
7104  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7105  body(re);
7106  vf.join(body._VoxelFunc);
7107 }
7108 
7109 // -----------------------------------------------------------------------------
7110 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7111 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7112 {
7113  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7114  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7115 }
7116 
7117 // -----------------------------------------------------------------------------
7118 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7119 void ForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7120 {
7121  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7122  body(re);
7123  vf.join(body._VoxelFunc);
7124 }
7125 
7126 // -----------------------------------------------------------------------------
7127 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7128 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7129 {
7130  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7131  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7132 }
7133 
7134 //
7135 // Image arguments by reference
7136 //
7137 
7138 // -----------------------------------------------------------------------------
7139 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7140 void ForEachScalar(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7141 {
7142  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
7144  body(re);
7145  vf.join(body._VoxelFunc);
7146 }
7147 
7148 // -----------------------------------------------------------------------------
7149 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7150 void ForEachScalar(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7151 {
7152  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7153  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
7154 }
7155 
7156 // -----------------------------------------------------------------------------
7157 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7158 void ForEachVoxel(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7159 {
7160  if (im7.GetTSize()) {
7161  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
7162  } else {
7163  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
7164  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
7165  body(re);
7166  vf.join(body._VoxelFunc);
7167  }
7168 }
7169 
7170 // -----------------------------------------------------------------------------
7171 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7172 void ForEachVoxel(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7173 {
7174  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7175  ForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
7176 }
7177 
7178 // -----------------------------------------------------------------------------
7179 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7180 void ForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7181 {
7182  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
7183  body(attr);
7184  vf.join(body._VoxelFunc);
7185 }
7186 
7187 // -----------------------------------------------------------------------------
7188 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7189 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7190 {
7191  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7192  ForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
7193 }
7194 
7195 // -----------------------------------------------------------------------------
7196 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7197 void ForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7198 {
7199  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
7200  body(re);
7201  vf.join(body._VoxelFunc);
7202 }
7203 
7204 // -----------------------------------------------------------------------------
7205 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7206 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7207 {
7208  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7209  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
7210 }
7211 
7212 // -----------------------------------------------------------------------------
7213 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7214 void ForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7215 {
7216  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
7217  body(re);
7218  vf.join(body._VoxelFunc);
7219 }
7220 
7221 // -----------------------------------------------------------------------------
7222 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7223 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7224 {
7225  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7226  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
7227 }
7228 
7229 // -----------------------------------------------------------------------------
7230 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7231 void ForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7232 {
7233  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
7234  body(re);
7235  vf.join(body._VoxelFunc);
7236 }
7237 
7238 // -----------------------------------------------------------------------------
7239 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7240 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7241 {
7242  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7243  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
7244 }
7245 
7246 // -----------------------------------------------------------------------------
7247 // ForEachVoxelIf
7248 // -----------------------------------------------------------------------------
7249 
7250 //
7251 // Image arguments by pointer
7252 //
7253 
7254 // -----------------------------------------------------------------------------
7255 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7256 void ForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
7257 {
7258  SeptenaryForEachVoxelIfBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7259  blocked_range<int> re(0, im7->GetNumberOfVoxels());
7260  body(re);
7261  vf.join(body._VoxelFunc);
7262  of.join(body._OutsideFunc);
7263 }
7264 
7265 // -----------------------------------------------------------------------------
7266 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7267 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7268 {
7269  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7270  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7271 }
7272 
7273 // -----------------------------------------------------------------------------
7274 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7275 void ForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7276 {
7278  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7279 }
7280 
7281 // -----------------------------------------------------------------------------
7282 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7283 void ForEachScalarIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7284 {
7285  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7286  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7287 }
7288 
7289 // -----------------------------------------------------------------------------
7290 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7291 void ForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
7292 {
7293  if (im7->GetTSize()) {
7294  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7295  } else {
7296  SeptenaryForEachVoxelIfBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7297  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
7298  body(re);
7299  vf.join(body._VoxelFunc);
7300  of.join(body._OutsideFunc);
7301  }
7302 }
7303 
7304 // -----------------------------------------------------------------------------
7305 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7306 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7307 {
7308  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7309  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7310 }
7311 
7312 // -----------------------------------------------------------------------------
7313 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7314 void ForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7315 {
7317  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7318 }
7319 
7320 // -----------------------------------------------------------------------------
7321 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7322 void ForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7323 {
7324  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7325  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7326 }
7327 
7328 // -----------------------------------------------------------------------------
7329 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7330 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
7331 {
7332  SeptenaryForEachVoxelIfBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7333  body(attr);
7334  vf.join(body._VoxelFunc);
7335  of.join(body._OutsideFunc);
7336 }
7337 
7338 // -----------------------------------------------------------------------------
7339 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7340 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7341 {
7342  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7343  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7344 }
7345 
7346 // -----------------------------------------------------------------------------
7347 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7348 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7349 {
7351  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7352 }
7353 
7354 // -----------------------------------------------------------------------------
7355 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7356 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7357 {
7358  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7359  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7360 }
7361 
7362 // -----------------------------------------------------------------------------
7363 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7364 void ForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
7365 {
7366  SeptenaryForEachVoxelIfBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7367  body(re);
7368  vf.join(body._VoxelFunc);
7369  of.join(body._OutsideFunc);
7370 }
7371 
7372 // -----------------------------------------------------------------------------
7373 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7374 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7375 {
7376  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7377  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7378 }
7379 
7380 // -----------------------------------------------------------------------------
7381 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7382 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
7383 {
7384  SeptenaryForEachVoxelIfBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7385  body(re);
7386  vf.join(body._VoxelFunc);
7387  of.join(body._OutsideFunc);
7388 }
7389 
7390 // -----------------------------------------------------------------------------
7391 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7392 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7393 {
7394  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7395  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7396 }
7397 
7398 // -----------------------------------------------------------------------------
7399 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7400 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7401 {
7403  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7404 }
7405 
7406 // -----------------------------------------------------------------------------
7407 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7408 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7409 {
7410  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7411  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7412 }
7413 
7414 // -----------------------------------------------------------------------------
7415 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7416 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
7417 {
7418  SeptenaryForEachVoxelIfBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7419  body(re);
7420  vf.join(body._VoxelFunc);
7421  of.join(body._OutsideFunc);
7422 }
7423 
7424 // -----------------------------------------------------------------------------
7425 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7426 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7427 {
7428  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7429  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7430 }
7431 
7432 // -----------------------------------------------------------------------------
7433 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7434 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7435 {
7437  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7438 }
7439 
7440 // -----------------------------------------------------------------------------
7441 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7442 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7443 {
7444  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7445  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7446 }
7447 
7448 //
7449 // Image arguments by reference
7450 //
7451 
7452 // -----------------------------------------------------------------------------
7453 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7454 void ForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
7455 {
7458  body(re);
7459  vf.join(body._VoxelFunc);
7460  of.join(body._OutsideFunc);
7461 }
7462 
7463 // -----------------------------------------------------------------------------
7464 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7465 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7466 {
7467  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7468  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
7469 }
7470 
7471 // -----------------------------------------------------------------------------
7472 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7473 void ForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7474 {
7476  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
7477 }
7478 
7479 // -----------------------------------------------------------------------------
7480 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7481 void ForEachScalarIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7482 {
7483  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7484  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
7485 }
7486 
7487 // -----------------------------------------------------------------------------
7488 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7489 void ForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
7490 {
7491  if (im7.GetTSize()) {
7492  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
7493  } else {
7495  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
7496  body(re);
7497  vf.join(body._VoxelFunc);
7498  of.join(body._OutsideFunc);
7499  }
7500 }
7501 
7502 // -----------------------------------------------------------------------------
7503 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7504 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7505 {
7506  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7507  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
7508 }
7509 
7510 // -----------------------------------------------------------------------------
7511 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7512 void ForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7513 {
7515  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
7516 }
7517 
7518 // -----------------------------------------------------------------------------
7519 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7520 void ForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7521 {
7522  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7523  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
7524 }
7525 
7526 // -----------------------------------------------------------------------------
7527 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7528 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
7529 {
7531  body(attr);
7532  vf.join(body._VoxelFunc);
7533  of.join(body._OutsideFunc);
7534 }
7535 
7536 // -----------------------------------------------------------------------------
7537 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7538 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7539 {
7540  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7541  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
7542 }
7543 
7544 // -----------------------------------------------------------------------------
7545 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7546 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7547 {
7549  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
7550 }
7551 
7552 // -----------------------------------------------------------------------------
7553 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7554 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7555 {
7556  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7557  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
7558 }
7559 
7560 // -----------------------------------------------------------------------------
7561 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7562 void ForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
7563 {
7565  body(re);
7566  vf.join(body._VoxelFunc);
7567  of.join(body._OutsideFunc);
7568 }
7569 
7570 // -----------------------------------------------------------------------------
7571 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7572 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7573 {
7574  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7575  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
7576 }
7577 
7578 // -----------------------------------------------------------------------------
7579 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7580 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
7581 {
7583  body(re);
7584  vf.join(body._VoxelFunc);
7585  of.join(body._OutsideFunc);
7586 }
7587 
7588 // -----------------------------------------------------------------------------
7589 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7590 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7591 {
7592  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7593  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
7594 }
7595 
7596 // -----------------------------------------------------------------------------
7597 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7598 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7599 {
7601  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
7602 }
7603 
7604 // -----------------------------------------------------------------------------
7605 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7606 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7607 {
7608  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7609  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
7610 }
7611 
7612 // -----------------------------------------------------------------------------
7613 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7614 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
7615 {
7617  body(re);
7618  vf.join(body._VoxelFunc);
7619  of.join(body._OutsideFunc);
7620 }
7621 
7622 // -----------------------------------------------------------------------------
7623 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7624 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7625 {
7626  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7627  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
7628 }
7629 
7630 // -----------------------------------------------------------------------------
7631 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7632 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7633 {
7635  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
7636 }
7637 
7638 // -----------------------------------------------------------------------------
7639 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7640 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7641 {
7642  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7643  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
7644 }
7645 
7646 // -----------------------------------------------------------------------------
7647 // ParallelForEachVoxel
7648 // -----------------------------------------------------------------------------
7649 
7650 //
7651 // Image arguments by pointer
7652 //
7653 
7654 // -----------------------------------------------------------------------------
7655 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7656 void ParallelForEachScalar(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7657 {
7658  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7659  blocked_range<int> re(0, im7->GetNumberOfVoxels());
7660  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
7661  else parallel_for (re, body);
7662 }
7663 
7664 // -----------------------------------------------------------------------------
7665 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7666 void ParallelForEachScalar(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7667 {
7668  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7669  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7670 }
7671 
7672 // -----------------------------------------------------------------------------
7673 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7674 void ParallelForEachVoxel(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7675 {
7676  if (im7->GetTSize()) {
7677  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7678  } else {
7679  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7680  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
7681  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
7682  else parallel_for (re, body);
7683  }
7684 }
7685 
7686 // -----------------------------------------------------------------------------
7687 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7688 void ParallelForEachVoxel(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7689 {
7690  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7691  ParallelForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7692 }
7693 
7694 // -----------------------------------------------------------------------------
7695 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7696 void ParallelForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7697 {
7698  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7699  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
7700  if (VoxelFunc::IsReduction()) {
7701  if (attr._dt) {
7702  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
7703  } else {
7704  parallel_reduce(re, body);
7705  }
7706  vf.join(body._VoxelFunc);
7707  } else {
7708  if (attr._dt) {
7709  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
7710  } else {
7711  parallel_for(re, body);
7712  }
7713  }
7714 }
7715 
7716 // -----------------------------------------------------------------------------
7717 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7718 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7719 {
7720  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7721  ParallelForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7722 }
7723 
7724 // -----------------------------------------------------------------------------
7725 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7726 void ParallelForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7727 {
7728  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7729  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
7730  else parallel_for (re, body);
7731 }
7732 
7733 // -----------------------------------------------------------------------------
7734 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7735 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7736 {
7737  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7738  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7739 }
7740 
7741 // -----------------------------------------------------------------------------
7742 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7743 void ParallelForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7744 {
7745  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7746  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
7747  else parallel_for (re, body);
7748 }
7749 
7750 // -----------------------------------------------------------------------------
7751 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7752 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7753 {
7754  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7755  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7756 }
7757 
7758 // -----------------------------------------------------------------------------
7759 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7760 void ParallelForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7761 {
7762  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7763  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
7764  else parallel_for (re, body);
7765 }
7766 
7767 // -----------------------------------------------------------------------------
7768 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7769 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7770 {
7771  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7772  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7773 }
7774 
7775 //
7776 // Image arguments by reference
7777 //
7778 
7779 // -----------------------------------------------------------------------------
7780 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7781 void ParallelForEachScalar(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7782 {
7783  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
7785  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
7786  else parallel_for (re, body);
7787 }
7788 
7789 // -----------------------------------------------------------------------------
7790 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7791 void ParallelForEachScalar(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7792 {
7793  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7794  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
7795 }
7796 
7797 // -----------------------------------------------------------------------------
7798 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7799 void ParallelForEachVoxel(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7800 {
7801  if (im7.GetTSize()) {
7802  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
7803  } else {
7804  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
7805  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
7806  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
7807  else parallel_for (re, body);
7808  }
7809 }
7810 
7811 // -----------------------------------------------------------------------------
7812 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7813 void ParallelForEachVoxel(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7814 {
7815  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7816  ParallelForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
7817 }
7818 
7819 // -----------------------------------------------------------------------------
7820 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7821 void ParallelForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7822 {
7823  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
7824  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
7825  if (VoxelFunc::IsReduction()) {
7826  if (attr._dt) {
7827  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
7828  } else {
7829  parallel_reduce(re, body);
7830  }
7831  vf.join(body._VoxelFunc);
7832  } else {
7833  if (attr._dt) {
7834  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
7835  } else {
7836  parallel_for(re, body);
7837  }
7838  }
7839 }
7840 
7841 // -----------------------------------------------------------------------------
7842 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7843 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7844 {
7845  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7846  ParallelForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
7847 }
7848 
7849 // -----------------------------------------------------------------------------
7850 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7851 void ParallelForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7852 {
7853  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
7854  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
7855  else parallel_for (re, body);
7856 }
7857 
7858 // -----------------------------------------------------------------------------
7859 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7860 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7861 {
7862  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7863  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
7864 }
7865 
7866 // -----------------------------------------------------------------------------
7867 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7868 void ParallelForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7869 {
7870  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
7871  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
7872  else parallel_for (re, body);
7873 }
7874 
7875 // -----------------------------------------------------------------------------
7876 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7877 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7878 {
7879  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7880  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
7881 }
7882 
7883 // -----------------------------------------------------------------------------
7884 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7885 void ParallelForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
7886 {
7887  SeptenaryForEachVoxelBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
7888  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
7889  else parallel_for (re, body);
7890 }
7891 
7892 // -----------------------------------------------------------------------------
7893 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7894 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
7895 {
7896  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7897  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
7898 }
7899 
7900 // -----------------------------------------------------------------------------
7901 // ParallelForEachVoxelIf
7902 // -----------------------------------------------------------------------------
7903 
7904 //
7905 // Image arguments by pointer
7906 //
7907 
7908 // -----------------------------------------------------------------------------
7909 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7910 void ParallelForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
7911 {
7912  SeptenaryForEachVoxelIfBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7913  blocked_range<int> re(0, im7->GetNumberOfVoxels());
7914  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
7915  parallel_reduce(re, body);
7916  vf.join(body._VoxelFunc);
7917  of.join(body._OutsideFunc);
7918  } else {
7919  parallel_for(re, body);
7920  }
7921 }
7922 
7923 // -----------------------------------------------------------------------------
7924 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7925 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7926 {
7927  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7928  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7929 }
7930 
7931 // -----------------------------------------------------------------------------
7932 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7933 void ParallelForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7934 {
7936  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7937 }
7938 
7939 // -----------------------------------------------------------------------------
7940 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7941 void ParallelForEachScalarIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7942 {
7943  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7944  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7945 }
7946 
7947 // -----------------------------------------------------------------------------
7948 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7949 void ParallelForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
7950 {
7951  if (im7->GetTSize()) {
7952  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7953  } else {
7954  SeptenaryForEachVoxelIfBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7955  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
7956  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
7957  parallel_reduce(re, body);
7958  vf.join(body._VoxelFunc);
7959  of.join(body._OutsideFunc);
7960  } else {
7961  parallel_for(re, body);
7962  }
7963  }
7964 }
7965 
7966 // -----------------------------------------------------------------------------
7967 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7968 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7969 {
7970  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7971  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7972 }
7973 
7974 // -----------------------------------------------------------------------------
7975 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7976 void ParallelForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
7977 {
7979  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7980 }
7981 
7982 // -----------------------------------------------------------------------------
7983 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
7984 void ParallelForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
7985 {
7986  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
7987  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
7988 }
7989 
7990 // -----------------------------------------------------------------------------
7991 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
7992 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
7993 {
7994  SeptenaryForEachVoxelIfBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
7995  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
7996  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
7997  if (attr._dt) {
7998  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
7999  } else {
8000  parallel_reduce(re, body);
8001  }
8002  vf.join(body._VoxelFunc);
8003  of.join(body._OutsideFunc);
8004  } else {
8005  if (attr._dt) {
8006  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
8007  } else {
8008  parallel_for(re, body);
8009  }
8010  }
8011 }
8012 
8013 // -----------------------------------------------------------------------------
8014 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8015 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8016 {
8017  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8018  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8019 }
8020 
8021 // -----------------------------------------------------------------------------
8022 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8023 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
8024 {
8026  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8027 }
8028 
8029 // -----------------------------------------------------------------------------
8030 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8031 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8032 {
8033  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8034  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8035 }
8036 
8037 // -----------------------------------------------------------------------------
8038 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8039 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
8040 {
8041  SeptenaryForEachVoxelIfBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8042  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
8043  parallel_reduce(re, body);
8044  vf.join(body._VoxelFunc);
8045  of.join(body._OutsideFunc);
8046  } else {
8047  parallel_for(re, body);
8048  }
8049 }
8050 
8051 // -----------------------------------------------------------------------------
8052 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8053 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8054 {
8055  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8056  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8057 }
8058 
8059 // -----------------------------------------------------------------------------
8060 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8061 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
8062 {
8064  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8065 }
8066 
8067 // -----------------------------------------------------------------------------
8068 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8069 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8070 {
8071  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8072  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8073 }
8074 
8075 // -----------------------------------------------------------------------------
8076 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8077 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
8078 {
8079  SeptenaryForEachVoxelIfBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8080  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
8081  parallel_reduce(re, body);
8082  vf.join(body._VoxelFunc);
8083  of.join(body._OutsideFunc);
8084  } else {
8085  parallel_for(re, body);
8086  }
8087 }
8088 
8089 // -----------------------------------------------------------------------------
8090 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8091 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8092 {
8093  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8094  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8095 }
8096 
8097 // -----------------------------------------------------------------------------
8098 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8099 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
8100 {
8102  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8103 }
8104 
8105 // -----------------------------------------------------------------------------
8106 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8107 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8108 {
8109  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8110  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8111 }
8112 
8113 // -----------------------------------------------------------------------------
8114 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8115 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
8116 {
8117  SeptenaryForEachVoxelIfBody_3Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8118  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
8119  parallel_reduce(re, body);
8120  vf.join(body._VoxelFunc);
8121  of.join(body._OutsideFunc);
8122  } else {
8123  parallel_for(re, body);
8124  }
8125 }
8126 
8127 // -----------------------------------------------------------------------------
8128 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8129 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8130 {
8131  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8132  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8133 }
8134 
8135 // -----------------------------------------------------------------------------
8136 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8137 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
8138 {
8140  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8141 }
8142 
8143 // -----------------------------------------------------------------------------
8144 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8145 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, const GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8146 {
8147  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8148  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8149 }
8150 
8151 //
8152 // Image arguments by reference
8153 //
8154 
8155 // -----------------------------------------------------------------------------
8156 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8157 void ParallelForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
8158 {
8161  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
8162  parallel_reduce(re, body);
8163  vf.join(body._VoxelFunc);
8164  of.join(body._OutsideFunc);
8165  } else {
8166  parallel_for(re, body);
8167  }
8168 }
8169 
8170 // -----------------------------------------------------------------------------
8171 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8172 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8173 {
8174  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8175  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
8176 }
8177 
8178 // -----------------------------------------------------------------------------
8179 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8180 void ParallelForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
8181 {
8183  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
8184 }
8185 
8186 // -----------------------------------------------------------------------------
8187 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8188 void ParallelForEachScalarIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8189 {
8190  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8191  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
8192 }
8193 
8194 // -----------------------------------------------------------------------------
8195 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8196 void ParallelForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
8197 {
8198  if (im7.GetTSize()) {
8199  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
8200  } else {
8202  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
8203  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
8204  parallel_reduce(re, body);
8205  vf.join(body._VoxelFunc);
8206  of.join(body._OutsideFunc);
8207  } else {
8208  parallel_for(re, body);
8209  }
8210  }
8211 }
8212 
8213 // -----------------------------------------------------------------------------
8214 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8215 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8216 {
8217  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8218  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
8219 }
8220 
8221 // -----------------------------------------------------------------------------
8222 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8223 void ParallelForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
8224 {
8226  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
8227 }
8228 
8229 // -----------------------------------------------------------------------------
8230 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8231 void ParallelForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8232 {
8233  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8234  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
8235 }
8236 
8237 // -----------------------------------------------------------------------------
8238 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8239 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
8240 {
8242  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
8243  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
8244  if (attr._dt) {
8245  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
8246  } else {
8247  parallel_reduce(re, body);
8248  }
8249  vf.join(body._VoxelFunc);
8250  of.join(body._OutsideFunc);
8251  } else {
8252  if (attr._dt) {
8253  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
8254  } else {
8255  parallel_for(re, body);
8256  }
8257  }
8258 }
8259 
8260 // -----------------------------------------------------------------------------
8261 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8262 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8263 {
8264  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8265  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
8266 }
8267 
8268 // -----------------------------------------------------------------------------
8269 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8270 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
8271 {
8273  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
8274 }
8275 
8276 // -----------------------------------------------------------------------------
8277 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8278 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8279 {
8280  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8281  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
8282 }
8283 
8284 // -----------------------------------------------------------------------------
8285 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8286 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
8287 {
8289  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
8290  parallel_reduce(re, body);
8291  vf.join(body._VoxelFunc);
8292  of.join(body._OutsideFunc);
8293  } else {
8294  parallel_for(re, body);
8295  }
8296 }
8297 
8298 // -----------------------------------------------------------------------------
8299 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8300 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8301 {
8302  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8303  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
8304 }
8305 
8306 // -----------------------------------------------------------------------------
8307 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8308 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
8309 {
8311  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
8312 }
8313 
8314 // -----------------------------------------------------------------------------
8315 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8316 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8317 {
8318  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8319  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
8320 }
8321 
8322 // -----------------------------------------------------------------------------
8323 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8324 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
8325 {
8327  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
8328  parallel_reduce(re, body);
8329  vf.join(body._VoxelFunc);
8330  of.join(body._OutsideFunc);
8331  } else {
8332  parallel_for(re, body);
8333  }
8334 }
8335 
8336 // -----------------------------------------------------------------------------
8337 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8338 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8339 {
8340  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8341  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
8342 }
8343 
8344 // -----------------------------------------------------------------------------
8345 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8346 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
8347 {
8349  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
8350 }
8351 
8352 // -----------------------------------------------------------------------------
8353 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8354 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8355 {
8356  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8357  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
8358 }
8359 
8360 // -----------------------------------------------------------------------------
8361 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8362 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
8363 {
8365  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
8366  parallel_reduce(re, body);
8367  vf.join(body._VoxelFunc);
8368  of.join(body._OutsideFunc);
8369  } else {
8370  parallel_for(re, body);
8371  }
8372 }
8373 
8374 // -----------------------------------------------------------------------------
8375 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8376 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8377 {
8378  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8379  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
8380 }
8381 
8382 // -----------------------------------------------------------------------------
8383 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8384 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
8385 {
8387  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
8388 }
8389 
8390 // -----------------------------------------------------------------------------
8391 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8392 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, const GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8393 {
8394  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8395  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
8396 }
8397 
8398 // =============================================================================
8399 // 2 const, 5 non-const images
8400 // =============================================================================
8401 
8402 // -----------------------------------------------------------------------------
8403 /**
8404  * ForEachVoxel body for voxel function of 2 const, 5 non-const images
8405  */
8406 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8408 {
8409  const GenericImage<T1> &im1;
8410  const GenericImage<T2> &im2;
8411  GenericImage<T3> &im3;
8412  GenericImage<T4> &im4;
8413  GenericImage<T5> &im5;
8414  GenericImage<T6> &im6;
8415  GenericImage<T7> &im7;
8416 
8417  /// Constructor
8419  const GenericImage<T2> &im2,
8420  GenericImage<T3> &im3,
8421  GenericImage<T4> &im4,
8422  GenericImage<T5> &im5,
8423  GenericImage<T6> &im6,
8424  GenericImage<T7> &im7,
8425  VoxelFunc &vf)
8426  :
8427  ForEachVoxelBody<VoxelFunc>(vf, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
8428  {}
8429 
8430  /// Copy constructor
8432  :
8433  ForEachVoxelBody<VoxelFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
8434  {}
8435 
8436  /// Split constructor
8438  :
8439  ForEachVoxelBody<VoxelFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
8440  {}
8441 
8442  /// Process entire image
8443  void operator ()(const ImageAttributes &attr) const
8444  {
8445  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
8446  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
8447  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
8448  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
8449  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
8450  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
8451  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
8452 
8453  const int T = (attr._dt ? attr._t : 1);
8454 
8455  for (int l = 0; l < T; ++l)
8456  for (int k = 0; k < attr._z; ++k)
8457  for (int j = 0; j < attr._y; ++j)
8458  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
8459  // const_cast such that voxel functions need only implement
8460  // non-const operator() which is required for parallel_reduce
8461  const_cast<SeptenaryForEachVoxelBody_2Const *>(this)->_VoxelFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
8462  }
8463  }
8464 
8465  /// Process image region using linear index
8466  void operator ()(const blocked_range<int> &re) const
8467  {
8468  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
8469  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
8470  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
8471  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
8472  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
8473  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
8474  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
8475 
8476  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
8477  // const_cast such that voxel functions need only implement
8478  // non-const operator() which is required for parallel_reduce
8479  const_cast<SeptenaryForEachVoxelBody_2Const *>(this)->_VoxelFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
8480  }
8481  }
8482 
8483  /// Process 2D image region
8484  void operator ()(const blocked_range2d<int> &re) const
8485  {
8486  const int bi = re.cols().begin();
8487  const int bj = re.rows().begin();
8488  const int ei = re.cols().end();
8489  const int ej = re.rows().end();
8490 
8491  const int s1 = im7.GetX() - (ei - bi);
8492 
8493  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
8494  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
8495  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
8496  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
8497  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
8498  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
8499  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
8500 
8501  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
8502  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
8503  // const_cast such that voxel functions need only implement
8504  // non-const operator() which is required for parallel_reduce
8505  const_cast<SeptenaryForEachVoxelBody_2Const *>(this)->_VoxelFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
8506  }
8507  }
8508 
8509  /// Process 3D image region
8510  void operator ()(const blocked_range3d<int> &re) const
8511  {
8512  const int bi = re.cols ().begin();
8513  const int bj = re.rows ().begin();
8514  const int bk = re.pages().begin();
8515  const int ei = re.cols ().end();
8516  const int ej = re.rows ().end();
8517  const int ek = re.pages().end();
8518 
8519  const int s1 = im7.GetX() - (ei - bi);
8520  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
8521 
8522  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
8523  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
8524  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
8525  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
8526  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
8527  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
8528  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
8529 
8530  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
8531  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
8532  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
8533  // const_cast such that voxel functions need only implement
8534  // non-const operator() which is required for parallel_reduce
8535  const_cast<SeptenaryForEachVoxelBody_2Const *>(this)->_VoxelFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
8536  }
8537  }
8538 };
8539 
8540 // -----------------------------------------------------------------------------
8541 /**
8542  * ForEachVoxel body for inside and outside unary voxel function of 2 const, 5 non-const images
8543  */
8544 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7,
8545  class VoxelFunc, class OutsideFunc = NaryVoxelFunction::NOP,
8546  class Domain = ForEachVoxelDomain::Foreground>
8547 struct SeptenaryForEachVoxelIfBody_2Const : public ForEachVoxelIfBody<VoxelFunc, OutsideFunc>
8548 {
8549  const GenericImage<T1> &im1;
8550  const GenericImage<T2> &im2;
8551  GenericImage<T3> &im3;
8552  GenericImage<T4> &im4;
8553  GenericImage<T5> &im5;
8554  GenericImage<T6> &im6;
8555  GenericImage<T7> &im7;
8556 
8557  /// Constructor
8559  const GenericImage<T2> &im2,
8560  GenericImage<T3> &im3,
8561  GenericImage<T4> &im4,
8562  GenericImage<T5> &im5,
8563  GenericImage<T6> &im6,
8564  GenericImage<T7> &im7,
8565  VoxelFunc &vf, OutsideFunc &of)
8566  :
8567  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(vf, of, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
8568  {}
8569 
8570  /// Copy constructor
8572  :
8573  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
8574  {}
8575 
8576  /// Split constructor
8578  :
8579  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
8580  {}
8581 
8582  /// Process entire image
8583  void operator ()(const ImageAttributes &attr) const
8584  {
8585  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
8586  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
8587  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
8588  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
8589  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
8590  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
8591  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
8592 
8593  const int T = (attr._dt ? attr._t : 1);
8594 
8595  for (int l = 0; l < T; ++l)
8596  for (int k = 0; k < attr._z; ++k)
8597  for (int j = 0; j < attr._y; ++j)
8598  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
8599  if (Domain::IsInside(im7, i, j, k, l, p7)) {
8600  // const_cast such that voxel functions need only implement
8601  // non-const operator() which is required for parallel_reduce
8602  const_cast<SeptenaryForEachVoxelIfBody_2Const *>(this)->_VoxelFunc (i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
8603  } else const_cast<SeptenaryForEachVoxelIfBody_2Const *>(this)->_OutsideFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
8604  }
8605  }
8606 
8607  /// Process image region using linear index
8608  void operator ()(const blocked_range<int> &re) const
8609  {
8610  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
8611  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
8612  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
8613  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
8614  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
8615  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
8616  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
8617 
8618  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
8619  if (Domain::IsInside(im7, idx, p7)) {
8620  // const_cast such that voxel functions need only implement
8621  // non-const operator() which is required for parallel_reduce
8622  const_cast<SeptenaryForEachVoxelIfBody_2Const *>(this)->_VoxelFunc (im7, idx, p1, p2, p3, p4, p5, p6, p7);
8623  } else const_cast<SeptenaryForEachVoxelIfBody_2Const *>(this)->_OutsideFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
8624  }
8625  }
8626 
8627  /// Process 2D image region
8628  void operator ()(const blocked_range2d<int> &re) const
8629  {
8630  const int bi = re.cols().begin();
8631  const int bj = re.rows().begin();
8632  const int ei = re.cols().end();
8633  const int ej = re.rows().end();
8634 
8635  const int s1 = im7.GetX() - (ei - bi);
8636 
8637  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
8638  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
8639  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
8640  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
8641  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
8642  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
8643  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
8644 
8645  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
8646  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
8647  if (Domain::IsInside(im7, i, j, this->_k, this->_l, p7)) {
8648  // const_cast such that voxel functions need only implement
8649  // non-const operator() which is required for parallel_reduce
8650  const_cast<SeptenaryForEachVoxelIfBody_2Const *>(this)->_VoxelFunc (i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
8651  } else const_cast<SeptenaryForEachVoxelIfBody_2Const *>(this)->_OutsideFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
8652  }
8653  }
8654 
8655  /// Process 3D image region
8656  void operator ()(const blocked_range3d<int> &re) const
8657  {
8658  const int bi = re.cols ().begin();
8659  const int bj = re.rows ().begin();
8660  const int bk = re.pages().begin();
8661  const int ei = re.cols ().end();
8662  const int ej = re.rows ().end();
8663  const int ek = re.pages().end();
8664 
8665  const int s1 = im7.GetX() - (ei - bi);
8666  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
8667 
8668  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
8669  const T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
8670  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
8671  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
8672  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
8673  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
8674  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
8675 
8676  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
8677  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
8678  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
8679  if (Domain::IsInside(im7, i, j, k, this->_l, p7)) {
8680  // const_cast such that voxel functions need only implement
8681  // non-const operator() which is required for parallel_reduce
8682  const_cast<SeptenaryForEachVoxelIfBody_2Const *>(this)->_VoxelFunc (i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
8683  } else const_cast<SeptenaryForEachVoxelIfBody_2Const *>(this)->_OutsideFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
8684  }
8685  }
8686 };
8687 
8688 // -----------------------------------------------------------------------------
8689 // ForEachVoxel
8690 // -----------------------------------------------------------------------------
8691 
8692 //
8693 // Image arguments by pointer
8694 //
8695 
8696 // -----------------------------------------------------------------------------
8697 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8698 void ForEachScalar(const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
8699 {
8700  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8701  blocked_range<int> re(0, im7->GetNumberOfVoxels());
8702  body(re);
8703  vf.join(body._VoxelFunc);
8704 }
8705 
8706 // -----------------------------------------------------------------------------
8707 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8708 void ForEachScalar(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8709 {
8710  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8711  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8712 }
8713 
8714 // -----------------------------------------------------------------------------
8715 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8716 void ForEachVoxel(const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
8717 {
8718  if (im7->GetTSize()) {
8719  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8720  } else {
8721  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8722  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
8723  body(re);
8724  vf.join(body._VoxelFunc);
8725  }
8726 }
8727 
8728 // -----------------------------------------------------------------------------
8729 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8730 void ForEachVoxel(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8731 {
8732  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8733  ForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8734 }
8735 
8736 // -----------------------------------------------------------------------------
8737 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8738 void ForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
8739 {
8740  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8741  body(attr);
8742  vf.join(body._VoxelFunc);
8743 }
8744 
8745 // -----------------------------------------------------------------------------
8746 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8747 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8748 {
8749  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8750  ForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8751 }
8752 
8753 // -----------------------------------------------------------------------------
8754 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8755 void ForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
8756 {
8757  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8758  body(re);
8759  vf.join(body._VoxelFunc);
8760 }
8761 
8762 // -----------------------------------------------------------------------------
8763 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8764 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8765 {
8766  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8767  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8768 }
8769 
8770 // -----------------------------------------------------------------------------
8771 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8772 void ForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
8773 {
8774  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8775  body(re);
8776  vf.join(body._VoxelFunc);
8777 }
8778 
8779 // -----------------------------------------------------------------------------
8780 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8781 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8782 {
8783  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8784  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8785 }
8786 
8787 // -----------------------------------------------------------------------------
8788 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8789 void ForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
8790 {
8791  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8792  body(re);
8793  vf.join(body._VoxelFunc);
8794 }
8795 
8796 // -----------------------------------------------------------------------------
8797 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8798 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8799 {
8800  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8801  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8802 }
8803 
8804 //
8805 // Image arguments by reference
8806 //
8807 
8808 // -----------------------------------------------------------------------------
8809 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8810 void ForEachScalar(const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
8811 {
8812  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
8814  body(re);
8815  vf.join(body._VoxelFunc);
8816 }
8817 
8818 // -----------------------------------------------------------------------------
8819 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8820 void ForEachScalar(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8821 {
8822  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8823  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
8824 }
8825 
8826 // -----------------------------------------------------------------------------
8827 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8828 void ForEachVoxel(const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
8829 {
8830  if (im7.GetTSize()) {
8831  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
8832  } else {
8833  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
8834  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
8835  body(re);
8836  vf.join(body._VoxelFunc);
8837  }
8838 }
8839 
8840 // -----------------------------------------------------------------------------
8841 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8842 void ForEachVoxel(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8843 {
8844  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8845  ForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
8846 }
8847 
8848 // -----------------------------------------------------------------------------
8849 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8850 void ForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
8851 {
8852  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
8853  body(attr);
8854  vf.join(body._VoxelFunc);
8855 }
8856 
8857 // -----------------------------------------------------------------------------
8858 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8859 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8860 {
8861  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8862  ForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
8863 }
8864 
8865 // -----------------------------------------------------------------------------
8866 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8867 void ForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
8868 {
8869  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
8870  body(re);
8871  vf.join(body._VoxelFunc);
8872 }
8873 
8874 // -----------------------------------------------------------------------------
8875 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8876 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8877 {
8878  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8879  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
8880 }
8881 
8882 // -----------------------------------------------------------------------------
8883 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8884 void ForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
8885 {
8886  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
8887  body(re);
8888  vf.join(body._VoxelFunc);
8889 }
8890 
8891 // -----------------------------------------------------------------------------
8892 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8893 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8894 {
8895  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8896  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
8897 }
8898 
8899 // -----------------------------------------------------------------------------
8900 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8901 void ForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
8902 {
8903  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
8904  body(re);
8905  vf.join(body._VoxelFunc);
8906 }
8907 
8908 // -----------------------------------------------------------------------------
8909 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8910 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
8911 {
8912  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8913  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
8914 }
8915 
8916 // -----------------------------------------------------------------------------
8917 // ForEachVoxelIf
8918 // -----------------------------------------------------------------------------
8919 
8920 //
8921 // Image arguments by pointer
8922 //
8923 
8924 // -----------------------------------------------------------------------------
8925 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8926 void ForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
8927 {
8928  SeptenaryForEachVoxelIfBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8929  blocked_range<int> re(0, im7->GetNumberOfVoxels());
8930  body(re);
8931  vf.join(body._VoxelFunc);
8932  of.join(body._OutsideFunc);
8933 }
8934 
8935 // -----------------------------------------------------------------------------
8936 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8937 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8938 {
8939  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8940  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8941 }
8942 
8943 // -----------------------------------------------------------------------------
8944 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8945 void ForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
8946 {
8948  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8949 }
8950 
8951 // -----------------------------------------------------------------------------
8952 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8953 void ForEachScalarIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8954 {
8955  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8956  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8957 }
8958 
8959 // -----------------------------------------------------------------------------
8960 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8961 void ForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
8962 {
8963  if (im7->GetTSize()) {
8964  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8965  } else {
8966  SeptenaryForEachVoxelIfBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8967  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
8968  body(re);
8969  vf.join(body._VoxelFunc);
8970  of.join(body._OutsideFunc);
8971  }
8972 }
8973 
8974 // -----------------------------------------------------------------------------
8975 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
8976 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8977 {
8978  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8979  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8980 }
8981 
8982 // -----------------------------------------------------------------------------
8983 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8984 void ForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
8985 {
8987  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
8988 }
8989 
8990 // -----------------------------------------------------------------------------
8991 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
8992 void ForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
8993 {
8994  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
8995  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
8996 }
8997 
8998 // -----------------------------------------------------------------------------
8999 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9000 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
9001 {
9002  SeptenaryForEachVoxelIfBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9003  body(attr);
9004  vf.join(body._VoxelFunc);
9005  of.join(body._OutsideFunc);
9006 }
9007 
9008 // -----------------------------------------------------------------------------
9009 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9010 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9011 {
9012  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9013  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9014 }
9015 
9016 // -----------------------------------------------------------------------------
9017 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9018 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
9019 {
9021  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9022 }
9023 
9024 // -----------------------------------------------------------------------------
9025 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9026 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9027 {
9028  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9029  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9030 }
9031 
9032 // -----------------------------------------------------------------------------
9033 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9034 void ForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
9035 {
9036  SeptenaryForEachVoxelIfBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9037  body(re);
9038  vf.join(body._VoxelFunc);
9039  of.join(body._OutsideFunc);
9040 }
9041 
9042 // -----------------------------------------------------------------------------
9043 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9044 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9045 {
9046  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9047  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9048 }
9049 
9050 // -----------------------------------------------------------------------------
9051 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9052 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
9053 {
9054  SeptenaryForEachVoxelIfBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9055  body(re);
9056  vf.join(body._VoxelFunc);
9057  of.join(body._OutsideFunc);
9058 }
9059 
9060 // -----------------------------------------------------------------------------
9061 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9062 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9063 {
9064  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9065  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9066 }
9067 
9068 // -----------------------------------------------------------------------------
9069 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9070 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
9071 {
9073  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9074 }
9075 
9076 // -----------------------------------------------------------------------------
9077 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9078 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9079 {
9080  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9081  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9082 }
9083 
9084 // -----------------------------------------------------------------------------
9085 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9086 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
9087 {
9088  SeptenaryForEachVoxelIfBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9089  body(re);
9090  vf.join(body._VoxelFunc);
9091  of.join(body._OutsideFunc);
9092 }
9093 
9094 // -----------------------------------------------------------------------------
9095 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9096 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9097 {
9098  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9099  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9100 }
9101 
9102 // -----------------------------------------------------------------------------
9103 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9104 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
9105 {
9107  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9108 }
9109 
9110 // -----------------------------------------------------------------------------
9111 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9112 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9113 {
9114  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9115  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9116 }
9117 
9118 //
9119 // Image arguments by reference
9120 //
9121 
9122 // -----------------------------------------------------------------------------
9123 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9124 void ForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
9125 {
9128  body(re);
9129  vf.join(body._VoxelFunc);
9130  of.join(body._OutsideFunc);
9131 }
9132 
9133 // -----------------------------------------------------------------------------
9134 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9135 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9136 {
9137  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9138  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
9139 }
9140 
9141 // -----------------------------------------------------------------------------
9142 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9143 void ForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
9144 {
9146  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
9147 }
9148 
9149 // -----------------------------------------------------------------------------
9150 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9151 void ForEachScalarIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9152 {
9153  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9154  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
9155 }
9156 
9157 // -----------------------------------------------------------------------------
9158 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9159 void ForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
9160 {
9161  if (im7.GetTSize()) {
9162  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
9163  } else {
9165  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
9166  body(re);
9167  vf.join(body._VoxelFunc);
9168  of.join(body._OutsideFunc);
9169  }
9170 }
9171 
9172 // -----------------------------------------------------------------------------
9173 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9174 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9175 {
9176  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9177  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
9178 }
9179 
9180 // -----------------------------------------------------------------------------
9181 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9182 void ForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
9183 {
9185  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
9186 }
9187 
9188 // -----------------------------------------------------------------------------
9189 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9190 void ForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9191 {
9192  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9193  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
9194 }
9195 
9196 // -----------------------------------------------------------------------------
9197 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9198 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
9199 {
9201  body(attr);
9202  vf.join(body._VoxelFunc);
9203  of.join(body._OutsideFunc);
9204 }
9205 
9206 // -----------------------------------------------------------------------------
9207 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9208 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9209 {
9210  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9211  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
9212 }
9213 
9214 // -----------------------------------------------------------------------------
9215 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9216 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
9217 {
9219  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
9220 }
9221 
9222 // -----------------------------------------------------------------------------
9223 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9224 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9225 {
9226  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9227  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
9228 }
9229 
9230 // -----------------------------------------------------------------------------
9231 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9232 void ForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
9233 {
9235  body(re);
9236  vf.join(body._VoxelFunc);
9237  of.join(body._OutsideFunc);
9238 }
9239 
9240 // -----------------------------------------------------------------------------
9241 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9242 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9243 {
9244  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9245  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
9246 }
9247 
9248 // -----------------------------------------------------------------------------
9249 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9250 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
9251 {
9253  body(re);
9254  vf.join(body._VoxelFunc);
9255  of.join(body._OutsideFunc);
9256 }
9257 
9258 // -----------------------------------------------------------------------------
9259 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9260 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9261 {
9262  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9263  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
9264 }
9265 
9266 // -----------------------------------------------------------------------------
9267 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9268 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
9269 {
9271  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
9272 }
9273 
9274 // -----------------------------------------------------------------------------
9275 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9276 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9277 {
9278  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9279  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
9280 }
9281 
9282 // -----------------------------------------------------------------------------
9283 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9284 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
9285 {
9287  body(re);
9288  vf.join(body._VoxelFunc);
9289  of.join(body._OutsideFunc);
9290 }
9291 
9292 // -----------------------------------------------------------------------------
9293 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9294 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9295 {
9296  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9297  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
9298 }
9299 
9300 // -----------------------------------------------------------------------------
9301 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9302 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
9303 {
9305  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
9306 }
9307 
9308 // -----------------------------------------------------------------------------
9309 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9310 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9311 {
9312  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9313  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
9314 }
9315 
9316 // -----------------------------------------------------------------------------
9317 // ParallelForEachVoxel
9318 // -----------------------------------------------------------------------------
9319 
9320 //
9321 // Image arguments by pointer
9322 //
9323 
9324 // -----------------------------------------------------------------------------
9325 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9326 void ParallelForEachScalar(const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
9327 {
9328  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9329  blocked_range<int> re(0, im7->GetNumberOfVoxels());
9330  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
9331  else parallel_for (re, body);
9332 }
9333 
9334 // -----------------------------------------------------------------------------
9335 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9336 void ParallelForEachScalar(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9337 {
9338  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9339  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9340 }
9341 
9342 // -----------------------------------------------------------------------------
9343 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9344 void ParallelForEachVoxel(const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
9345 {
9346  if (im7->GetTSize()) {
9347  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9348  } else {
9349  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9350  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
9351  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
9352  else parallel_for (re, body);
9353  }
9354 }
9355 
9356 // -----------------------------------------------------------------------------
9357 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9358 void ParallelForEachVoxel(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9359 {
9360  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9361  ParallelForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9362 }
9363 
9364 // -----------------------------------------------------------------------------
9365 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9366 void ParallelForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
9367 {
9368  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9369  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
9370  if (VoxelFunc::IsReduction()) {
9371  if (attr._dt) {
9372  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
9373  } else {
9374  parallel_reduce(re, body);
9375  }
9376  vf.join(body._VoxelFunc);
9377  } else {
9378  if (attr._dt) {
9379  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
9380  } else {
9381  parallel_for(re, body);
9382  }
9383  }
9384 }
9385 
9386 // -----------------------------------------------------------------------------
9387 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9388 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9389 {
9390  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9391  ParallelForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9392 }
9393 
9394 // -----------------------------------------------------------------------------
9395 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9396 void ParallelForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
9397 {
9398  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9399  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
9400  else parallel_for (re, body);
9401 }
9402 
9403 // -----------------------------------------------------------------------------
9404 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9405 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9406 {
9407  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9408  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9409 }
9410 
9411 // -----------------------------------------------------------------------------
9412 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9413 void ParallelForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
9414 {
9415  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9416  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
9417  else parallel_for (re, body);
9418 }
9419 
9420 // -----------------------------------------------------------------------------
9421 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9422 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9423 {
9424  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9425  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9426 }
9427 
9428 // -----------------------------------------------------------------------------
9429 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9430 void ParallelForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
9431 {
9432  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9433  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
9434  else parallel_for (re, body);
9435 }
9436 
9437 // -----------------------------------------------------------------------------
9438 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9439 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9440 {
9441  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9442  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9443 }
9444 
9445 //
9446 // Image arguments by reference
9447 //
9448 
9449 // -----------------------------------------------------------------------------
9450 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9451 void ParallelForEachScalar(const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
9452 {
9453  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
9455  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
9456  else parallel_for (re, body);
9457 }
9458 
9459 // -----------------------------------------------------------------------------
9460 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9461 void ParallelForEachScalar(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9462 {
9463  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9464  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
9465 }
9466 
9467 // -----------------------------------------------------------------------------
9468 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9469 void ParallelForEachVoxel(const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
9470 {
9471  if (im7.GetTSize()) {
9472  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
9473  } else {
9474  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
9475  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
9476  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
9477  else parallel_for (re, body);
9478  }
9479 }
9480 
9481 // -----------------------------------------------------------------------------
9482 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9483 void ParallelForEachVoxel(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9484 {
9485  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9486  ParallelForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
9487 }
9488 
9489 // -----------------------------------------------------------------------------
9490 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9491 void ParallelForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
9492 {
9493  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
9494  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
9495  if (VoxelFunc::IsReduction()) {
9496  if (attr._dt) {
9497  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
9498  } else {
9499  parallel_reduce(re, body);
9500  }
9501  vf.join(body._VoxelFunc);
9502  } else {
9503  if (attr._dt) {
9504  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
9505  } else {
9506  parallel_for(re, body);
9507  }
9508  }
9509 }
9510 
9511 // -----------------------------------------------------------------------------
9512 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9513 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9514 {
9515  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9516  ParallelForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
9517 }
9518 
9519 // -----------------------------------------------------------------------------
9520 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9521 void ParallelForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
9522 {
9523  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
9524  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
9525  else parallel_for (re, body);
9526 }
9527 
9528 // -----------------------------------------------------------------------------
9529 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9530 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9531 {
9532  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9533  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
9534 }
9535 
9536 // -----------------------------------------------------------------------------
9537 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9538 void ParallelForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
9539 {
9540  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
9541  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
9542  else parallel_for (re, body);
9543 }
9544 
9545 // -----------------------------------------------------------------------------
9546 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9547 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9548 {
9549  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9550  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
9551 }
9552 
9553 // -----------------------------------------------------------------------------
9554 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9555 void ParallelForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
9556 {
9557  SeptenaryForEachVoxelBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
9558  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
9559  else parallel_for (re, body);
9560 }
9561 
9562 // -----------------------------------------------------------------------------
9563 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9564 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9565 {
9566  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9567  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
9568 }
9569 
9570 // -----------------------------------------------------------------------------
9571 // ParallelForEachVoxelIf
9572 // -----------------------------------------------------------------------------
9573 
9574 //
9575 // Image arguments by pointer
9576 //
9577 
9578 // -----------------------------------------------------------------------------
9579 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9580 void ParallelForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
9581 {
9582  SeptenaryForEachVoxelIfBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9583  blocked_range<int> re(0, im7->GetNumberOfVoxels());
9584  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
9585  parallel_reduce(re, body);
9586  vf.join(body._VoxelFunc);
9587  of.join(body._OutsideFunc);
9588  } else {
9589  parallel_for(re, body);
9590  }
9591 }
9592 
9593 // -----------------------------------------------------------------------------
9594 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9595 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9596 {
9597  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9598  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9599 }
9600 
9601 // -----------------------------------------------------------------------------
9602 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9603 void ParallelForEachScalarIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
9604 {
9606  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9607 }
9608 
9609 // -----------------------------------------------------------------------------
9610 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9611 void ParallelForEachScalarIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9612 {
9613  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9614  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9615 }
9616 
9617 // -----------------------------------------------------------------------------
9618 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9619 void ParallelForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
9620 {
9621  if (im7->GetTSize()) {
9622  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9623  } else {
9624  SeptenaryForEachVoxelIfBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9625  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
9626  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
9627  parallel_reduce(re, body);
9628  vf.join(body._VoxelFunc);
9629  of.join(body._OutsideFunc);
9630  } else {
9631  parallel_for(re, body);
9632  }
9633  }
9634 }
9635 
9636 // -----------------------------------------------------------------------------
9637 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9638 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9639 {
9640  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9641  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9642 }
9643 
9644 // -----------------------------------------------------------------------------
9645 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9646 void ParallelForEachVoxelIf(const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
9647 {
9649  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9650 }
9651 
9652 // -----------------------------------------------------------------------------
9653 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9654 void ParallelForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9655 {
9656  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9657  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9658 }
9659 
9660 // -----------------------------------------------------------------------------
9661 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9662 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
9663 {
9664  SeptenaryForEachVoxelIfBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9665  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
9666  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
9667  if (attr._dt) {
9668  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
9669  } else {
9670  parallel_reduce(re, body);
9671  }
9672  vf.join(body._VoxelFunc);
9673  of.join(body._OutsideFunc);
9674  } else {
9675  if (attr._dt) {
9676  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
9677  } else {
9678  parallel_for(re, body);
9679  }
9680  }
9681 }
9682 
9683 // -----------------------------------------------------------------------------
9684 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9685 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9686 {
9687  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9688  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9689 }
9690 
9691 // -----------------------------------------------------------------------------
9692 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9693 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
9694 {
9696  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9697 }
9698 
9699 // -----------------------------------------------------------------------------
9700 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9701 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9702 {
9703  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9704  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9705 }
9706 
9707 // -----------------------------------------------------------------------------
9708 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9709 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
9710 {
9711  SeptenaryForEachVoxelIfBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9712  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
9713  parallel_reduce(re, body);
9714  vf.join(body._VoxelFunc);
9715  of.join(body._OutsideFunc);
9716  } else {
9717  parallel_for(re, body);
9718  }
9719 }
9720 
9721 // -----------------------------------------------------------------------------
9722 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9723 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9724 {
9725  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9726  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9727 }
9728 
9729 // -----------------------------------------------------------------------------
9730 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9731 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
9732 {
9734  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9735 }
9736 
9737 // -----------------------------------------------------------------------------
9738 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9739 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9740 {
9741  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9742  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9743 }
9744 
9745 // -----------------------------------------------------------------------------
9746 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9747 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
9748 {
9749  SeptenaryForEachVoxelIfBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9750  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
9751  parallel_reduce(re, body);
9752  vf.join(body._VoxelFunc);
9753  of.join(body._OutsideFunc);
9754  } else {
9755  parallel_for(re, body);
9756  }
9757 }
9758 
9759 // -----------------------------------------------------------------------------
9760 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9761 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9762 {
9763  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9764  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9765 }
9766 
9767 // -----------------------------------------------------------------------------
9768 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9769 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
9770 {
9772  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9773 }
9774 
9775 // -----------------------------------------------------------------------------
9776 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9777 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9778 {
9779  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9780  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9781 }
9782 
9783 // -----------------------------------------------------------------------------
9784 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9785 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
9786 {
9787  SeptenaryForEachVoxelIfBody_2Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9788  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
9789  parallel_reduce(re, body);
9790  vf.join(body._VoxelFunc);
9791  of.join(body._OutsideFunc);
9792  } else {
9793  parallel_for(re, body);
9794  }
9795 }
9796 
9797 // -----------------------------------------------------------------------------
9798 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9799 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9800 {
9801  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9802  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9803 }
9804 
9805 // -----------------------------------------------------------------------------
9806 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9807 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
9808 {
9810  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
9811 }
9812 
9813 // -----------------------------------------------------------------------------
9814 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9815 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, const GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
9816 {
9817  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9818  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
9819 }
9820 
9821 //
9822 // Image arguments by reference
9823 //
9824 
9825 // -----------------------------------------------------------------------------
9826 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9827 void ParallelForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
9828 {
9831  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
9832  parallel_reduce(re, body);
9833  vf.join(body._VoxelFunc);
9834  of.join(body._OutsideFunc);
9835  } else {
9836  parallel_for(re, body);
9837  }
9838 }
9839 
9840 // -----------------------------------------------------------------------------
9841 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9842 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9843 {
9844  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9845  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
9846 }
9847 
9848 // -----------------------------------------------------------------------------
9849 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9850 void ParallelForEachScalarIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
9851 {
9853  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
9854 }
9855 
9856 // -----------------------------------------------------------------------------
9857 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9858 void ParallelForEachScalarIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9859 {
9860  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9861  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
9862 }
9863 
9864 // -----------------------------------------------------------------------------
9865 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9866 void ParallelForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
9867 {
9868  if (im7.GetTSize()) {
9869  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
9870  } else {
9872  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
9873  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
9874  parallel_reduce(re, body);
9875  vf.join(body._VoxelFunc);
9876  of.join(body._OutsideFunc);
9877  } else {
9878  parallel_for(re, body);
9879  }
9880  }
9881 }
9882 
9883 // -----------------------------------------------------------------------------
9884 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9885 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9886 {
9887  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9888  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
9889 }
9890 
9891 // -----------------------------------------------------------------------------
9892 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9893 void ParallelForEachVoxelIf(const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
9894 {
9896  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
9897 }
9898 
9899 // -----------------------------------------------------------------------------
9900 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9901 void ParallelForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9902 {
9903  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9904  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
9905 }
9906 
9907 // -----------------------------------------------------------------------------
9908 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9909 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
9910 {
9912  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
9913  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
9914  if (attr._dt) {
9915  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
9916  } else {
9917  parallel_reduce(re, body);
9918  }
9919  vf.join(body._VoxelFunc);
9920  of.join(body._OutsideFunc);
9921  } else {
9922  if (attr._dt) {
9923  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
9924  } else {
9925  parallel_for(re, body);
9926  }
9927  }
9928 }
9929 
9930 // -----------------------------------------------------------------------------
9931 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9932 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9933 {
9934  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9935  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
9936 }
9937 
9938 // -----------------------------------------------------------------------------
9939 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9940 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
9941 {
9943  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
9944 }
9945 
9946 // -----------------------------------------------------------------------------
9947 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9948 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9949 {
9950  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9951  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
9952 }
9953 
9954 // -----------------------------------------------------------------------------
9955 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9956 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
9957 {
9959  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
9960  parallel_reduce(re, body);
9961  vf.join(body._VoxelFunc);
9962  of.join(body._OutsideFunc);
9963  } else {
9964  parallel_for(re, body);
9965  }
9966 }
9967 
9968 // -----------------------------------------------------------------------------
9969 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9970 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9971 {
9972  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9973  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
9974 }
9975 
9976 // -----------------------------------------------------------------------------
9977 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9978 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
9979 {
9981  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
9982 }
9983 
9984 // -----------------------------------------------------------------------------
9985 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
9986 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
9987 {
9988  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
9989  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
9990 }
9991 
9992 // -----------------------------------------------------------------------------
9993 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
9994 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
9995 {
9997  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
9998  parallel_reduce(re, body);
9999  vf.join(body._VoxelFunc);
10000  of.join(body._OutsideFunc);
10001  } else {
10002  parallel_for(re, body);
10003  }
10004 }
10005 
10006 // -----------------------------------------------------------------------------
10007 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10008 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10009 {
10010  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10011  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
10012 }
10013 
10014 // -----------------------------------------------------------------------------
10015 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10016 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
10017 {
10019  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
10020 }
10021 
10022 // -----------------------------------------------------------------------------
10023 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10024 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10025 {
10026  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10027  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
10028 }
10029 
10030 // -----------------------------------------------------------------------------
10031 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10032 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
10033 {
10035  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
10036  parallel_reduce(re, body);
10037  vf.join(body._VoxelFunc);
10038  of.join(body._OutsideFunc);
10039  } else {
10040  parallel_for(re, body);
10041  }
10042 }
10043 
10044 // -----------------------------------------------------------------------------
10045 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10046 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10047 {
10048  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10049  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
10050 }
10051 
10052 // -----------------------------------------------------------------------------
10053 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10054 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
10055 {
10057  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
10058 }
10059 
10060 // -----------------------------------------------------------------------------
10061 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10062 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, const GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10063 {
10064  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10065  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
10066 }
10067 
10068 // =============================================================================
10069 // 1 const, 6 non-const images
10070 // =============================================================================
10071 
10072 // -----------------------------------------------------------------------------
10073 /**
10074  * ForEachVoxel body for voxel function of 1 const, 6 non-const images
10075  */
10076 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10078 {
10079  const GenericImage<T1> &im1;
10080  GenericImage<T2> &im2;
10081  GenericImage<T3> &im3;
10082  GenericImage<T4> &im4;
10083  GenericImage<T5> &im5;
10084  GenericImage<T6> &im6;
10085  GenericImage<T7> &im7;
10086 
10087  /// Constructor
10089  GenericImage<T2> &im2,
10090  GenericImage<T3> &im3,
10091  GenericImage<T4> &im4,
10092  GenericImage<T5> &im5,
10093  GenericImage<T6> &im6,
10094  GenericImage<T7> &im7,
10095  VoxelFunc &vf)
10096  :
10097  ForEachVoxelBody<VoxelFunc>(vf, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
10098  {}
10099 
10100  /// Copy constructor
10102  :
10103  ForEachVoxelBody<VoxelFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
10104  {}
10105 
10106  /// Split constructor
10108  :
10109  ForEachVoxelBody<VoxelFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
10110  {}
10111 
10112  /// Process entire image
10113  void operator ()(const ImageAttributes &attr) const
10114  {
10115  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
10116  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
10117  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
10118  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
10119  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
10120  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
10121  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
10122 
10123  const int T = (attr._dt ? attr._t : 1);
10124 
10125  for (int l = 0; l < T; ++l)
10126  for (int k = 0; k < attr._z; ++k)
10127  for (int j = 0; j < attr._y; ++j)
10128  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
10129  // const_cast such that voxel functions need only implement
10130  // non-const operator() which is required for parallel_reduce
10131  const_cast<SeptenaryForEachVoxelBody_1Const *>(this)->_VoxelFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
10132  }
10133  }
10134 
10135  /// Process image region using linear index
10136  void operator ()(const blocked_range<int> &re) const
10137  {
10138  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
10139  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
10140  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
10141  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
10142  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
10143  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
10144  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
10145 
10146  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
10147  // const_cast such that voxel functions need only implement
10148  // non-const operator() which is required for parallel_reduce
10149  const_cast<SeptenaryForEachVoxelBody_1Const *>(this)->_VoxelFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
10150  }
10151  }
10152 
10153  /// Process 2D image region
10154  void operator ()(const blocked_range2d<int> &re) const
10155  {
10156  const int bi = re.cols().begin();
10157  const int bj = re.rows().begin();
10158  const int ei = re.cols().end();
10159  const int ej = re.rows().end();
10160 
10161  const int s1 = im7.GetX() - (ei - bi);
10162 
10163  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
10164  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
10165  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
10166  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
10167  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
10168  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
10169  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
10170 
10171  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
10172  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
10173  // const_cast such that voxel functions need only implement
10174  // non-const operator() which is required for parallel_reduce
10175  const_cast<SeptenaryForEachVoxelBody_1Const *>(this)->_VoxelFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
10176  }
10177  }
10178 
10179  /// Process 3D image region
10180  void operator ()(const blocked_range3d<int> &re) const
10181  {
10182  const int bi = re.cols ().begin();
10183  const int bj = re.rows ().begin();
10184  const int bk = re.pages().begin();
10185  const int ei = re.cols ().end();
10186  const int ej = re.rows ().end();
10187  const int ek = re.pages().end();
10188 
10189  const int s1 = im7.GetX() - (ei - bi);
10190  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
10191 
10192  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
10193  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
10194  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
10195  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
10196  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
10197  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
10198  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
10199 
10200  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
10201  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
10202  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
10203  // const_cast such that voxel functions need only implement
10204  // non-const operator() which is required for parallel_reduce
10205  const_cast<SeptenaryForEachVoxelBody_1Const *>(this)->_VoxelFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
10206  }
10207  }
10208 };
10209 
10210 // -----------------------------------------------------------------------------
10211 /**
10212  * ForEachVoxel body for inside and outside unary voxel function of 1 const, 6 non-const images
10213  */
10214 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7,
10215  class VoxelFunc, class OutsideFunc = NaryVoxelFunction::NOP,
10216  class Domain = ForEachVoxelDomain::Foreground>
10217 struct SeptenaryForEachVoxelIfBody_1Const : public ForEachVoxelIfBody<VoxelFunc, OutsideFunc>
10218 {
10219  const GenericImage<T1> &im1;
10220  GenericImage<T2> &im2;
10221  GenericImage<T3> &im3;
10222  GenericImage<T4> &im4;
10223  GenericImage<T5> &im5;
10224  GenericImage<T6> &im6;
10225  GenericImage<T7> &im7;
10226 
10227  /// Constructor
10229  GenericImage<T2> &im2,
10230  GenericImage<T3> &im3,
10231  GenericImage<T4> &im4,
10232  GenericImage<T5> &im5,
10233  GenericImage<T6> &im6,
10234  GenericImage<T7> &im7,
10235  VoxelFunc &vf, OutsideFunc &of)
10236  :
10237  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(vf, of, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
10238  {}
10239 
10240  /// Copy constructor
10242  :
10243  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
10244  {}
10245 
10246  /// Split constructor
10248  :
10249  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
10250  {}
10251 
10252  /// Process entire image
10253  void operator ()(const ImageAttributes &attr) const
10254  {
10255  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
10256  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
10257  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
10258  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
10259  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
10260  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
10261  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
10262 
10263  const int T = (attr._dt ? attr._t : 1);
10264 
10265  for (int l = 0; l < T; ++l)
10266  for (int k = 0; k < attr._z; ++k)
10267  for (int j = 0; j < attr._y; ++j)
10268  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
10269  if (Domain::IsInside(im7, i, j, k, l, p7)) {
10270  // const_cast such that voxel functions need only implement
10271  // non-const operator() which is required for parallel_reduce
10272  const_cast<SeptenaryForEachVoxelIfBody_1Const *>(this)->_VoxelFunc (i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
10273  } else const_cast<SeptenaryForEachVoxelIfBody_1Const *>(this)->_OutsideFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
10274  }
10275  }
10276 
10277  /// Process image region using linear index
10278  void operator ()(const blocked_range<int> &re) const
10279  {
10280  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
10281  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
10282  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
10283  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
10284  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
10285  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
10286  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
10287 
10288  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
10289  if (Domain::IsInside(im7, idx, p7)) {
10290  // const_cast such that voxel functions need only implement
10291  // non-const operator() which is required for parallel_reduce
10292  const_cast<SeptenaryForEachVoxelIfBody_1Const *>(this)->_VoxelFunc (im7, idx, p1, p2, p3, p4, p5, p6, p7);
10293  } else const_cast<SeptenaryForEachVoxelIfBody_1Const *>(this)->_OutsideFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
10294  }
10295  }
10296 
10297  /// Process 2D image region
10298  void operator ()(const blocked_range2d<int> &re) const
10299  {
10300  const int bi = re.cols().begin();
10301  const int bj = re.rows().begin();
10302  const int ei = re.cols().end();
10303  const int ej = re.rows().end();
10304 
10305  const int s1 = im7.GetX() - (ei - bi);
10306 
10307  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
10308  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
10309  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
10310  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
10311  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
10312  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
10313  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
10314 
10315  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
10316  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
10317  if (Domain::IsInside(im7, i, j, this->_k, this->_l, p7)) {
10318  // const_cast such that voxel functions need only implement
10319  // non-const operator() which is required for parallel_reduce
10320  const_cast<SeptenaryForEachVoxelIfBody_1Const *>(this)->_VoxelFunc (i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
10321  } else const_cast<SeptenaryForEachVoxelIfBody_1Const *>(this)->_OutsideFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
10322  }
10323  }
10324 
10325  /// Process 3D image region
10326  void operator ()(const blocked_range3d<int> &re) const
10327  {
10328  const int bi = re.cols ().begin();
10329  const int bj = re.rows ().begin();
10330  const int bk = re.pages().begin();
10331  const int ei = re.cols ().end();
10332  const int ej = re.rows ().end();
10333  const int ek = re.pages().end();
10334 
10335  const int s1 = im7.GetX() - (ei - bi);
10336  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
10337 
10338  const T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
10339  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
10340  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
10341  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
10342  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
10343  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
10344  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
10345 
10346  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
10347  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
10348  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
10349  if (Domain::IsInside(im7, i, j, k, this->_l, p7)) {
10350  // const_cast such that voxel functions need only implement
10351  // non-const operator() which is required for parallel_reduce
10352  const_cast<SeptenaryForEachVoxelIfBody_1Const *>(this)->_VoxelFunc (i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
10353  } else const_cast<SeptenaryForEachVoxelIfBody_1Const *>(this)->_OutsideFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
10354  }
10355  }
10356 };
10357 
10358 // -----------------------------------------------------------------------------
10359 // ForEachVoxel
10360 // -----------------------------------------------------------------------------
10361 
10362 //
10363 // Image arguments by pointer
10364 //
10365 
10366 // -----------------------------------------------------------------------------
10367 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10368 void ForEachScalar(const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
10369 {
10370  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10371  blocked_range<int> re(0, im7->GetNumberOfVoxels());
10372  body(re);
10373  vf.join(body._VoxelFunc);
10374 }
10375 
10376 // -----------------------------------------------------------------------------
10377 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10378 void ForEachScalar(VoxelFunc vf, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10379 {
10380  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10381  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10382 }
10383 
10384 // -----------------------------------------------------------------------------
10385 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10386 void ForEachVoxel(const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
10387 {
10388  if (im7->GetTSize()) {
10389  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10390  } else {
10391  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10392  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
10393  body(re);
10394  vf.join(body._VoxelFunc);
10395  }
10396 }
10397 
10398 // -----------------------------------------------------------------------------
10399 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10400 void ForEachVoxel(VoxelFunc vf, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10401 {
10402  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10403  ForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10404 }
10405 
10406 // -----------------------------------------------------------------------------
10407 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10408 void ForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
10409 {
10410  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10411  body(attr);
10412  vf.join(body._VoxelFunc);
10413 }
10414 
10415 // -----------------------------------------------------------------------------
10416 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10417 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10418 {
10419  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10420  ForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10421 }
10422 
10423 // -----------------------------------------------------------------------------
10424 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10425 void ForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
10426 {
10427  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10428  body(re);
10429  vf.join(body._VoxelFunc);
10430 }
10431 
10432 // -----------------------------------------------------------------------------
10433 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10434 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10435 {
10436  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10437  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10438 }
10439 
10440 // -----------------------------------------------------------------------------
10441 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10442 void ForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
10443 {
10444  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10445  body(re);
10446  vf.join(body._VoxelFunc);
10447 }
10448 
10449 // -----------------------------------------------------------------------------
10450 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10451 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10452 {
10453  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10454  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10455 }
10456 
10457 // -----------------------------------------------------------------------------
10458 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10459 void ForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
10460 {
10461  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10462  body(re);
10463  vf.join(body._VoxelFunc);
10464 }
10465 
10466 // -----------------------------------------------------------------------------
10467 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10468 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10469 {
10470  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10471  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10472 }
10473 
10474 //
10475 // Image arguments by reference
10476 //
10477 
10478 // -----------------------------------------------------------------------------
10479 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10480 void ForEachScalar(const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
10481 {
10482  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
10484  body(re);
10485  vf.join(body._VoxelFunc);
10486 }
10487 
10488 // -----------------------------------------------------------------------------
10489 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10490 void ForEachScalar(VoxelFunc vf, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10491 {
10492  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10493  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
10494 }
10495 
10496 // -----------------------------------------------------------------------------
10497 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10498 void ForEachVoxel(const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
10499 {
10500  if (im7.GetTSize()) {
10501  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
10502  } else {
10503  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
10504  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
10505  body(re);
10506  vf.join(body._VoxelFunc);
10507  }
10508 }
10509 
10510 // -----------------------------------------------------------------------------
10511 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10512 void ForEachVoxel(VoxelFunc vf, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10513 {
10514  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10515  ForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
10516 }
10517 
10518 // -----------------------------------------------------------------------------
10519 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10520 void ForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
10521 {
10522  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
10523  body(attr);
10524  vf.join(body._VoxelFunc);
10525 }
10526 
10527 // -----------------------------------------------------------------------------
10528 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10529 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10530 {
10531  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10532  ForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
10533 }
10534 
10535 // -----------------------------------------------------------------------------
10536 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10537 void ForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
10538 {
10539  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
10540  body(re);
10541  vf.join(body._VoxelFunc);
10542 }
10543 
10544 // -----------------------------------------------------------------------------
10545 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10546 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10547 {
10548  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10549  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
10550 }
10551 
10552 // -----------------------------------------------------------------------------
10553 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10554 void ForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
10555 {
10556  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
10557  body(re);
10558  vf.join(body._VoxelFunc);
10559 }
10560 
10561 // -----------------------------------------------------------------------------
10562 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10563 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10564 {
10565  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10566  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
10567 }
10568 
10569 // -----------------------------------------------------------------------------
10570 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10571 void ForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
10572 {
10573  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
10574  body(re);
10575  vf.join(body._VoxelFunc);
10576 }
10577 
10578 // -----------------------------------------------------------------------------
10579 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10580 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10581 {
10582  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10583  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
10584 }
10585 
10586 // -----------------------------------------------------------------------------
10587 // ForEachVoxelIf
10588 // -----------------------------------------------------------------------------
10589 
10590 //
10591 // Image arguments by pointer
10592 //
10593 
10594 // -----------------------------------------------------------------------------
10595 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10596 void ForEachScalarIf(const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
10597 {
10598  SeptenaryForEachVoxelIfBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10599  blocked_range<int> re(0, im7->GetNumberOfVoxels());
10600  body(re);
10601  vf.join(body._VoxelFunc);
10602  of.join(body._OutsideFunc);
10603 }
10604 
10605 // -----------------------------------------------------------------------------
10606 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10607 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10608 {
10609  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10610  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10611 }
10612 
10613 // -----------------------------------------------------------------------------
10614 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10615 void ForEachScalarIf(const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
10616 {
10618  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10619 }
10620 
10621 // -----------------------------------------------------------------------------
10622 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10623 void ForEachScalarIf(VoxelFunc vf, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10624 {
10625  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10626  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10627 }
10628 
10629 // -----------------------------------------------------------------------------
10630 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10631 void ForEachVoxelIf(const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
10632 {
10633  if (im7->GetTSize()) {
10634  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10635  } else {
10636  SeptenaryForEachVoxelIfBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10637  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
10638  body(re);
10639  vf.join(body._VoxelFunc);
10640  of.join(body._OutsideFunc);
10641  }
10642 }
10643 
10644 // -----------------------------------------------------------------------------
10645 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10646 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10647 {
10648  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10649  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10650 }
10651 
10652 // -----------------------------------------------------------------------------
10653 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10654 void ForEachVoxelIf(const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
10655 {
10657  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10658 }
10659 
10660 // -----------------------------------------------------------------------------
10661 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10662 void ForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10663 {
10664  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10665  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10666 }
10667 
10668 // -----------------------------------------------------------------------------
10669 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10670 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
10671 {
10672  SeptenaryForEachVoxelIfBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10673  body(attr);
10674  vf.join(body._VoxelFunc);
10675  of.join(body._OutsideFunc);
10676 }
10677 
10678 // -----------------------------------------------------------------------------
10679 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10680 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10681 {
10682  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10683  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10684 }
10685 
10686 // -----------------------------------------------------------------------------
10687 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10688 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
10689 {
10691  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10692 }
10693 
10694 // -----------------------------------------------------------------------------
10695 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10696 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10697 {
10698  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10699  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10700 }
10701 
10702 // -----------------------------------------------------------------------------
10703 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10704 void ForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
10705 {
10706  SeptenaryForEachVoxelIfBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10707  body(re);
10708  vf.join(body._VoxelFunc);
10709  of.join(body._OutsideFunc);
10710 }
10711 
10712 // -----------------------------------------------------------------------------
10713 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10714 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10715 {
10716  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10717  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10718 }
10719 
10720 // -----------------------------------------------------------------------------
10721 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10722 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
10723 {
10724  SeptenaryForEachVoxelIfBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10725  body(re);
10726  vf.join(body._VoxelFunc);
10727  of.join(body._OutsideFunc);
10728 }
10729 
10730 // -----------------------------------------------------------------------------
10731 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10732 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10733 {
10734  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10735  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10736 }
10737 
10738 // -----------------------------------------------------------------------------
10739 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10740 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
10741 {
10743  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10744 }
10745 
10746 // -----------------------------------------------------------------------------
10747 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10748 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10749 {
10750  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10751  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10752 }
10753 
10754 // -----------------------------------------------------------------------------
10755 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10756 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
10757 {
10758  SeptenaryForEachVoxelIfBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10759  body(re);
10760  vf.join(body._VoxelFunc);
10761  of.join(body._OutsideFunc);
10762 }
10763 
10764 // -----------------------------------------------------------------------------
10765 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10766 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10767 {
10768  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10769  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10770 }
10771 
10772 // -----------------------------------------------------------------------------
10773 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10774 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
10775 {
10777  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
10778 }
10779 
10780 // -----------------------------------------------------------------------------
10781 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10782 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
10783 {
10784  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10785  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10786 }
10787 
10788 //
10789 // Image arguments by reference
10790 //
10791 
10792 // -----------------------------------------------------------------------------
10793 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10794 void ForEachScalarIf(const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
10795 {
10798  body(re);
10799  vf.join(body._VoxelFunc);
10800  of.join(body._OutsideFunc);
10801 }
10802 
10803 // -----------------------------------------------------------------------------
10804 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10805 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10806 {
10807  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10808  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
10809 }
10810 
10811 // -----------------------------------------------------------------------------
10812 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10813 void ForEachScalarIf(const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
10814 {
10816  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
10817 }
10818 
10819 // -----------------------------------------------------------------------------
10820 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10821 void ForEachScalarIf(VoxelFunc vf, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10822 {
10823  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10824  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
10825 }
10826 
10827 // -----------------------------------------------------------------------------
10828 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10829 void ForEachVoxelIf(const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
10830 {
10831  if (im7.GetTSize()) {
10832  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
10833  } else {
10835  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
10836  body(re);
10837  vf.join(body._VoxelFunc);
10838  of.join(body._OutsideFunc);
10839  }
10840 }
10841 
10842 // -----------------------------------------------------------------------------
10843 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10844 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10845 {
10846  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10847  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
10848 }
10849 
10850 // -----------------------------------------------------------------------------
10851 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10852 void ForEachVoxelIf(const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
10853 {
10855  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
10856 }
10857 
10858 // -----------------------------------------------------------------------------
10859 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10860 void ForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10861 {
10862  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10863  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
10864 }
10865 
10866 // -----------------------------------------------------------------------------
10867 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10868 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
10869 {
10871  body(attr);
10872  vf.join(body._VoxelFunc);
10873  of.join(body._OutsideFunc);
10874 }
10875 
10876 // -----------------------------------------------------------------------------
10877 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10878 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10879 {
10880  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10881  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
10882 }
10883 
10884 // -----------------------------------------------------------------------------
10885 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10886 void ForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
10887 {
10889  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
10890 }
10891 
10892 // -----------------------------------------------------------------------------
10893 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10894 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10895 {
10896  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10897  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
10898 }
10899 
10900 // -----------------------------------------------------------------------------
10901 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10902 void ForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
10903 {
10905  body(re);
10906  vf.join(body._VoxelFunc);
10907  of.join(body._OutsideFunc);
10908 }
10909 
10910 // -----------------------------------------------------------------------------
10911 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10912 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10913 {
10914  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10915  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
10916 }
10917 
10918 // -----------------------------------------------------------------------------
10919 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10920 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
10921 {
10923  body(re);
10924  vf.join(body._VoxelFunc);
10925  of.join(body._OutsideFunc);
10926 }
10927 
10928 // -----------------------------------------------------------------------------
10929 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10930 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10931 {
10932  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10933  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
10934 }
10935 
10936 // -----------------------------------------------------------------------------
10937 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10938 void ForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
10939 {
10941  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
10942 }
10943 
10944 // -----------------------------------------------------------------------------
10945 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10946 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10947 {
10948  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10949  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
10950 }
10951 
10952 // -----------------------------------------------------------------------------
10953 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10954 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
10955 {
10957  body(re);
10958  vf.join(body._VoxelFunc);
10959  of.join(body._OutsideFunc);
10960 }
10961 
10962 // -----------------------------------------------------------------------------
10963 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
10964 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10965 {
10966  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10967  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
10968 }
10969 
10970 // -----------------------------------------------------------------------------
10971 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10972 void ForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
10973 {
10975  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
10976 }
10977 
10978 // -----------------------------------------------------------------------------
10979 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10980 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
10981 {
10982  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
10983  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
10984 }
10985 
10986 // -----------------------------------------------------------------------------
10987 // ParallelForEachVoxel
10988 // -----------------------------------------------------------------------------
10989 
10990 //
10991 // Image arguments by pointer
10992 //
10993 
10994 // -----------------------------------------------------------------------------
10995 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
10996 void ParallelForEachScalar(const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
10997 {
10998  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
10999  blocked_range<int> re(0, im7->GetNumberOfVoxels());
11000  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
11001  else parallel_for (re, body);
11002 }
11003 
11004 // -----------------------------------------------------------------------------
11005 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11006 void ParallelForEachScalar(VoxelFunc vf, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11007 {
11008  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11009  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11010 }
11011 
11012 // -----------------------------------------------------------------------------
11013 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11014 void ParallelForEachVoxel(const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
11015 {
11016  if (im7->GetTSize()) {
11017  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11018  } else {
11019  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11020  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
11021  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
11022  else parallel_for (re, body);
11023  }
11024 }
11025 
11026 // -----------------------------------------------------------------------------
11027 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11028 void ParallelForEachVoxel(VoxelFunc vf, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11029 {
11030  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11031  ParallelForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11032 }
11033 
11034 // -----------------------------------------------------------------------------
11035 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11036 void ParallelForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
11037 {
11038  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11039  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
11040  if (VoxelFunc::IsReduction()) {
11041  if (attr._dt) {
11042  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
11043  } else {
11044  parallel_reduce(re, body);
11045  }
11046  vf.join(body._VoxelFunc);
11047  } else {
11048  if (attr._dt) {
11049  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
11050  } else {
11051  parallel_for(re, body);
11052  }
11053  }
11054 }
11055 
11056 // -----------------------------------------------------------------------------
11057 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11058 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11059 {
11060  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11061  ParallelForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11062 }
11063 
11064 // -----------------------------------------------------------------------------
11065 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11066 void ParallelForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
11067 {
11068  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11069  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
11070  else parallel_for (re, body);
11071 }
11072 
11073 // -----------------------------------------------------------------------------
11074 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11075 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11076 {
11077  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11078  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11079 }
11080 
11081 // -----------------------------------------------------------------------------
11082 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11083 void ParallelForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
11084 {
11085  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11086  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
11087  else parallel_for (re, body);
11088 }
11089 
11090 // -----------------------------------------------------------------------------
11091 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11092 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11093 {
11094  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11095  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11096 }
11097 
11098 // -----------------------------------------------------------------------------
11099 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11100 void ParallelForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
11101 {
11102  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11103  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
11104  else parallel_for (re, body);
11105 }
11106 
11107 // -----------------------------------------------------------------------------
11108 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11109 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11110 {
11111  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11112  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11113 }
11114 
11115 //
11116 // Image arguments by reference
11117 //
11118 
11119 // -----------------------------------------------------------------------------
11120 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11121 void ParallelForEachScalar(const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
11122 {
11123  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
11125  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
11126  else parallel_for (re, body);
11127 }
11128 
11129 // -----------------------------------------------------------------------------
11130 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11131 void ParallelForEachScalar(VoxelFunc vf, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11132 {
11133  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11134  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
11135 }
11136 
11137 // -----------------------------------------------------------------------------
11138 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11139 void ParallelForEachVoxel(const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
11140 {
11141  if (im7.GetTSize()) {
11142  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
11143  } else {
11144  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
11145  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
11146  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
11147  else parallel_for (re, body);
11148  }
11149 }
11150 
11151 // -----------------------------------------------------------------------------
11152 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11153 void ParallelForEachVoxel(VoxelFunc vf, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11154 {
11155  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11156  ParallelForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
11157 }
11158 
11159 // -----------------------------------------------------------------------------
11160 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11161 void ParallelForEachVoxel(const ImageAttributes &attr, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
11162 {
11163  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
11164  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
11165  if (VoxelFunc::IsReduction()) {
11166  if (attr._dt) {
11167  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
11168  } else {
11169  parallel_reduce(re, body);
11170  }
11171  vf.join(body._VoxelFunc);
11172  } else {
11173  if (attr._dt) {
11174  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
11175  } else {
11176  parallel_for(re, body);
11177  }
11178  }
11179 }
11180 
11181 // -----------------------------------------------------------------------------
11182 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11183 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11184 {
11185  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11186  ParallelForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
11187 }
11188 
11189 // -----------------------------------------------------------------------------
11190 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11191 void ParallelForEachVoxel(const blocked_range<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
11192 {
11193  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
11194  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
11195  else parallel_for (re, body);
11196 }
11197 
11198 // -----------------------------------------------------------------------------
11199 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11200 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11201 {
11202  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11203  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
11204 }
11205 
11206 // -----------------------------------------------------------------------------
11207 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11208 void ParallelForEachVoxel(const blocked_range2d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
11209 {
11210  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
11211  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
11212  else parallel_for (re, body);
11213 }
11214 
11215 // -----------------------------------------------------------------------------
11216 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11217 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11218 {
11219  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11220  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
11221 }
11222 
11223 // -----------------------------------------------------------------------------
11224 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11225 void ParallelForEachVoxel(const blocked_range3d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
11226 {
11227  SeptenaryForEachVoxelBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
11228  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
11229  else parallel_for (re, body);
11230 }
11231 
11232 // -----------------------------------------------------------------------------
11233 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11234 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11235 {
11236  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11237  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
11238 }
11239 
11240 // -----------------------------------------------------------------------------
11241 // ParallelForEachVoxelIf
11242 // -----------------------------------------------------------------------------
11243 
11244 //
11245 // Image arguments by pointer
11246 //
11247 
11248 // -----------------------------------------------------------------------------
11249 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11250 void ParallelForEachScalarIf(const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
11251 {
11252  SeptenaryForEachVoxelIfBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11253  blocked_range<int> re(0, im7->GetNumberOfVoxels());
11254  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
11255  parallel_reduce(re, body);
11256  vf.join(body._VoxelFunc);
11257  of.join(body._OutsideFunc);
11258  } else {
11259  parallel_for(re, body);
11260  }
11261 }
11262 
11263 // -----------------------------------------------------------------------------
11264 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11265 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11266 {
11267  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11268  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11269 }
11270 
11271 // -----------------------------------------------------------------------------
11272 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11273 void ParallelForEachScalarIf(const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
11274 {
11276  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11277 }
11278 
11279 // -----------------------------------------------------------------------------
11280 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11281 void ParallelForEachScalarIf(VoxelFunc vf, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11282 {
11283  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11284  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11285 }
11286 
11287 // -----------------------------------------------------------------------------
11288 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11289 void ParallelForEachVoxelIf(const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
11290 {
11291  if (im7->GetTSize()) {
11292  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11293  } else {
11294  SeptenaryForEachVoxelIfBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11295  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
11296  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
11297  parallel_reduce(re, body);
11298  vf.join(body._VoxelFunc);
11299  of.join(body._OutsideFunc);
11300  } else {
11301  parallel_for(re, body);
11302  }
11303  }
11304 }
11305 
11306 // -----------------------------------------------------------------------------
11307 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11308 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11309 {
11310  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11311  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11312 }
11313 
11314 // -----------------------------------------------------------------------------
11315 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11316 void ParallelForEachVoxelIf(const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
11317 {
11319  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11320 }
11321 
11322 // -----------------------------------------------------------------------------
11323 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11324 void ParallelForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11325 {
11326  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11327  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11328 }
11329 
11330 // -----------------------------------------------------------------------------
11331 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11332 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
11333 {
11334  SeptenaryForEachVoxelIfBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11335  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
11336  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
11337  if (attr._dt) {
11338  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
11339  } else {
11340  parallel_reduce(re, body);
11341  }
11342  vf.join(body._VoxelFunc);
11343  of.join(body._OutsideFunc);
11344  } else {
11345  if (attr._dt) {
11346  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
11347  } else {
11348  parallel_for(re, body);
11349  }
11350  }
11351 }
11352 
11353 // -----------------------------------------------------------------------------
11354 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11355 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11356 {
11357  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11358  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11359 }
11360 
11361 // -----------------------------------------------------------------------------
11362 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11363 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
11364 {
11366  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11367 }
11368 
11369 // -----------------------------------------------------------------------------
11370 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11371 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11372 {
11373  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11374  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11375 }
11376 
11377 // -----------------------------------------------------------------------------
11378 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11379 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
11380 {
11381  SeptenaryForEachVoxelIfBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11382  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
11383  parallel_reduce(re, body);
11384  vf.join(body._VoxelFunc);
11385  of.join(body._OutsideFunc);
11386  } else {
11387  parallel_for(re, body);
11388  }
11389 }
11390 
11391 // -----------------------------------------------------------------------------
11392 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11393 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11394 {
11395  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11396  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11397 }
11398 
11399 // -----------------------------------------------------------------------------
11400 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11401 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
11402 {
11404  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11405 }
11406 
11407 // -----------------------------------------------------------------------------
11408 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11409 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11410 {
11411  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11412  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11413 }
11414 
11415 // -----------------------------------------------------------------------------
11416 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11417 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
11418 {
11419  SeptenaryForEachVoxelIfBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11420  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
11421  parallel_reduce(re, body);
11422  vf.join(body._VoxelFunc);
11423  of.join(body._OutsideFunc);
11424  } else {
11425  parallel_for(re, body);
11426  }
11427 }
11428 
11429 // -----------------------------------------------------------------------------
11430 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11431 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11432 {
11433  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11434  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11435 }
11436 
11437 // -----------------------------------------------------------------------------
11438 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11439 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
11440 {
11442  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11443 }
11444 
11445 // -----------------------------------------------------------------------------
11446 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11447 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11448 {
11449  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11450  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11451 }
11452 
11453 // -----------------------------------------------------------------------------
11454 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11455 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
11456 {
11457  SeptenaryForEachVoxelIfBody_1Const<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11458  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
11459  parallel_reduce(re, body);
11460  vf.join(body._VoxelFunc);
11461  of.join(body._OutsideFunc);
11462  } else {
11463  parallel_for(re, body);
11464  }
11465 }
11466 
11467 // -----------------------------------------------------------------------------
11468 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11469 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11470 {
11471  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11472  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11473 }
11474 
11475 // -----------------------------------------------------------------------------
11476 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11477 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
11478 {
11480  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
11481 }
11482 
11483 // -----------------------------------------------------------------------------
11484 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11485 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
11486 {
11487  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11488  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
11489 }
11490 
11491 //
11492 // Image arguments by reference
11493 //
11494 
11495 // -----------------------------------------------------------------------------
11496 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11497 void ParallelForEachScalarIf(const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
11498 {
11501  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
11502  parallel_reduce(re, body);
11503  vf.join(body._VoxelFunc);
11504  of.join(body._OutsideFunc);
11505  } else {
11506  parallel_for(re, body);
11507  }
11508 }
11509 
11510 // -----------------------------------------------------------------------------
11511 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11512 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11513 {
11514  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11515  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
11516 }
11517 
11518 // -----------------------------------------------------------------------------
11519 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11520 void ParallelForEachScalarIf(const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
11521 {
11523  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
11524 }
11525 
11526 // -----------------------------------------------------------------------------
11527 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11528 void ParallelForEachScalarIf(VoxelFunc vf, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11529 {
11530  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11531  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
11532 }
11533 
11534 // -----------------------------------------------------------------------------
11535 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11536 void ParallelForEachVoxelIf(const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
11537 {
11538  if (im7.GetTSize()) {
11539  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
11540  } else {
11542  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
11543  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
11544  parallel_reduce(re, body);
11545  vf.join(body._VoxelFunc);
11546  of.join(body._OutsideFunc);
11547  } else {
11548  parallel_for(re, body);
11549  }
11550  }
11551 }
11552 
11553 // -----------------------------------------------------------------------------
11554 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11555 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11556 {
11557  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11558  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
11559 }
11560 
11561 // -----------------------------------------------------------------------------
11562 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11563 void ParallelForEachVoxelIf(const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
11564 {
11566  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
11567 }
11568 
11569 // -----------------------------------------------------------------------------
11570 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11571 void ParallelForEachVoxelIf(VoxelFunc vf, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11572 {
11573  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11574  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
11575 }
11576 
11577 // -----------------------------------------------------------------------------
11578 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11579 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
11580 {
11582  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
11583  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
11584  if (attr._dt) {
11585  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
11586  } else {
11587  parallel_reduce(re, body);
11588  }
11589  vf.join(body._VoxelFunc);
11590  of.join(body._OutsideFunc);
11591  } else {
11592  if (attr._dt) {
11593  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
11594  } else {
11595  parallel_for(re, body);
11596  }
11597  }
11598 }
11599 
11600 // -----------------------------------------------------------------------------
11601 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11602 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11603 {
11604  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11605  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
11606 }
11607 
11608 // -----------------------------------------------------------------------------
11609 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11610 void ParallelForEachVoxelIf(const ImageAttributes &attr, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
11611 {
11613  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
11614 }
11615 
11616 // -----------------------------------------------------------------------------
11617 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11618 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11619 {
11620  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11621  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
11622 }
11623 
11624 // -----------------------------------------------------------------------------
11625 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11626 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
11627 {
11629  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
11630  parallel_reduce(re, body);
11631  vf.join(body._VoxelFunc);
11632  of.join(body._OutsideFunc);
11633  } else {
11634  parallel_for(re, body);
11635  }
11636 }
11637 
11638 // -----------------------------------------------------------------------------
11639 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11640 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11641 {
11642  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11643  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
11644 }
11645 
11646 // -----------------------------------------------------------------------------
11647 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11648 void ParallelForEachVoxelIf(const blocked_range<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
11649 {
11651  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
11652 }
11653 
11654 // -----------------------------------------------------------------------------
11655 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11656 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11657 {
11658  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11659  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
11660 }
11661 
11662 // -----------------------------------------------------------------------------
11663 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11664 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
11665 {
11667  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
11668  parallel_reduce(re, body);
11669  vf.join(body._VoxelFunc);
11670  of.join(body._OutsideFunc);
11671  } else {
11672  parallel_for(re, body);
11673  }
11674 }
11675 
11676 // -----------------------------------------------------------------------------
11677 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11678 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11679 {
11680  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11681  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
11682 }
11683 
11684 // -----------------------------------------------------------------------------
11685 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11686 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
11687 {
11689  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
11690 }
11691 
11692 // -----------------------------------------------------------------------------
11693 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11694 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11695 {
11696  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11697  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
11698 }
11699 
11700 // -----------------------------------------------------------------------------
11701 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11702 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
11703 {
11705  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
11706  parallel_reduce(re, body);
11707  vf.join(body._VoxelFunc);
11708  of.join(body._OutsideFunc);
11709  } else {
11710  parallel_for(re, body);
11711  }
11712 }
11713 
11714 // -----------------------------------------------------------------------------
11715 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
11716 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11717 {
11718  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11719  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
11720 }
11721 
11722 // -----------------------------------------------------------------------------
11723 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11724 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
11725 {
11727  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
11728 }
11729 
11730 // -----------------------------------------------------------------------------
11731 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11732 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, const GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
11733 {
11734  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
11735  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
11736 }
11737 
11738 // =============================================================================
11739 // 7 non-const images
11740 // =============================================================================
11741 
11742 // -----------------------------------------------------------------------------
11743 /**
11744  * ForEachVoxel body for voxel function of 7 non-const images
11745  */
11746 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
11748 {
11749  GenericImage<T1> &im1;
11750  GenericImage<T2> &im2;
11751  GenericImage<T3> &im3;
11752  GenericImage<T4> &im4;
11753  GenericImage<T5> &im5;
11754  GenericImage<T6> &im6;
11755  GenericImage<T7> &im7;
11756 
11757  /// Constructor
11759  GenericImage<T2> &im2,
11760  GenericImage<T3> &im3,
11761  GenericImage<T4> &im4,
11762  GenericImage<T5> &im5,
11763  GenericImage<T6> &im6,
11764  GenericImage<T7> &im7,
11765  VoxelFunc &vf)
11766  :
11767  ForEachVoxelBody<VoxelFunc>(vf, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
11768  {}
11769 
11770  /// Copy constructor
11772  :
11773  ForEachVoxelBody<VoxelFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
11774  {}
11775 
11776  /// Split constructor
11778  :
11779  ForEachVoxelBody<VoxelFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
11780  {}
11781 
11782  /// Process entire image
11783  void operator ()(const ImageAttributes &attr) const
11784  {
11785  T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
11786  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
11787  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
11788  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
11789  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
11790  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
11791  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
11792 
11793  const int T = (attr._dt ? attr._t : 1);
11794 
11795  for (int l = 0; l < T; ++l)
11796  for (int k = 0; k < attr._z; ++k)
11797  for (int j = 0; j < attr._y; ++j)
11798  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
11799  // const_cast such that voxel functions need only implement
11800  // non-const operator() which is required for parallel_reduce
11801  const_cast<SeptenaryForEachVoxelBody *>(this)->_VoxelFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
11802  }
11803  }
11804 
11805  /// Process image region using linear index
11806  void operator ()(const blocked_range<int> &re) const
11807  {
11808  T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
11809  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
11810  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
11811  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
11812  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
11813  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
11814  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
11815 
11816  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
11817  // const_cast such that voxel functions need only implement
11818  // non-const operator() which is required for parallel_reduce
11819  const_cast<SeptenaryForEachVoxelBody *>(this)->_VoxelFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
11820  }
11821  }
11822 
11823  /// Process 2D image region
11824  void operator ()(const blocked_range2d<int> &re) const
11825  {
11826  const int bi = re.cols().begin();
11827  const int bj = re.rows().begin();
11828  const int ei = re.cols().end();
11829  const int ej = re.rows().end();
11830 
11831  const int s1 = im7.GetX() - (ei - bi);
11832 
11833  T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
11834  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
11835  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
11836  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
11837  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
11838  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
11839  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
11840 
11841  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
11842  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
11843  // const_cast such that voxel functions need only implement
11844  // non-const operator() which is required for parallel_reduce
11845  const_cast<SeptenaryForEachVoxelBody *>(this)->_VoxelFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
11846  }
11847  }
11848 
11849  /// Process 3D image region
11850  void operator ()(const blocked_range3d<int> &re) const
11851  {
11852  const int bi = re.cols ().begin();
11853  const int bj = re.rows ().begin();
11854  const int bk = re.pages().begin();
11855  const int ei = re.cols ().end();
11856  const int ej = re.rows ().end();
11857  const int ek = re.pages().end();
11858 
11859  const int s1 = im7.GetX() - (ei - bi);
11860  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
11861 
11862  T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
11863  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
11864  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
11865  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
11866  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
11867  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
11868  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
11869 
11870  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
11871  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
11872  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
11873  // const_cast such that voxel functions need only implement
11874  // non-const operator() which is required for parallel_reduce
11875  const_cast<SeptenaryForEachVoxelBody *>(this)->_VoxelFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
11876  }
11877  }
11878 };
11879 
11880 // -----------------------------------------------------------------------------
11881 /**
11882  * ForEachVoxel body for inside and outside unary voxel function of 7 non-const images
11883  */
11884 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7,
11885  class VoxelFunc, class OutsideFunc = NaryVoxelFunction::NOP,
11886  class Domain = ForEachVoxelDomain::Foreground>
11887 struct SeptenaryForEachVoxelIfBody : public ForEachVoxelIfBody<VoxelFunc, OutsideFunc>
11888 {
11889  GenericImage<T1> &im1;
11890  GenericImage<T2> &im2;
11891  GenericImage<T3> &im3;
11892  GenericImage<T4> &im4;
11893  GenericImage<T5> &im5;
11894  GenericImage<T6> &im6;
11895  GenericImage<T7> &im7;
11896 
11897  /// Constructor
11899  GenericImage<T2> &im2,
11900  GenericImage<T3> &im3,
11901  GenericImage<T4> &im4,
11902  GenericImage<T5> &im5,
11903  GenericImage<T6> &im6,
11904  GenericImage<T7> &im7,
11905  VoxelFunc &vf, OutsideFunc &of)
11906  :
11907  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(vf, of, im1.Attributes()), im1(im1), im2(im2), im3(im3), im4(im4), im5(im5), im6(im6), im7(im7)
11908  {}
11909 
11910  /// Copy constructor
11912  :
11913  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
11914  {}
11915 
11916  /// Split constructor
11918  :
11919  ForEachVoxelIfBody<VoxelFunc, OutsideFunc>(o, s), im1(o.im1), im2(o.im2), im3(o.im3), im4(o.im4), im5(o.im5), im6(o.im6), im7(o.im7)
11920  {}
11921 
11922  /// Process entire image
11923  void operator ()(const ImageAttributes &attr) const
11924  {
11925  T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels();
11926  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels();
11927  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels();
11928  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels();
11929  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels();
11930  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels();
11931  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels();
11932 
11933  const int T = (attr._dt ? attr._t : 1);
11934 
11935  for (int l = 0; l < T; ++l)
11936  for (int k = 0; k < attr._z; ++k)
11937  for (int j = 0; j < attr._y; ++j)
11938  for (int i = 0; i < attr._x; ++i, ++p1, ++p2, ++p3, ++p4, ++p5, ++p6, ++p7) {
11939  if (Domain::IsInside(im7, i, j, k, l, p7)) {
11940  // const_cast such that voxel functions need only implement
11941  // non-const operator() which is required for parallel_reduce
11942  const_cast<SeptenaryForEachVoxelIfBody *>(this)->_VoxelFunc (i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
11943  } else const_cast<SeptenaryForEachVoxelIfBody *>(this)->_OutsideFunc(i, j, k, l, p1, p2, p3, p4, p5, p6, p7);
11944  }
11945  }
11946 
11947  /// Process image region using linear index
11948  void operator ()(const blocked_range<int> &re) const
11949  {
11950  T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels() + re.begin();
11951  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels() + re.begin();
11952  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels() + re.begin();
11953  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels() + re.begin();
11954  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels() + re.begin();
11955  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels() + re.begin();
11956  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels() + re.begin();
11957 
11958  for (int idx = re.begin(); idx < re.end(); ++idx, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
11959  if (Domain::IsInside(im7, idx, p7)) {
11960  // const_cast such that voxel functions need only implement
11961  // non-const operator() which is required for parallel_reduce
11962  const_cast<SeptenaryForEachVoxelIfBody *>(this)->_VoxelFunc (im7, idx, p1, p2, p3, p4, p5, p6, p7);
11963  } else const_cast<SeptenaryForEachVoxelIfBody *>(this)->_OutsideFunc(im7, idx, p1, p2, p3, p4, p5, p6, p7);
11964  }
11965  }
11966 
11967  /// Process 2D image region
11968  void operator ()(const blocked_range2d<int> &re) const
11969  {
11970  const int bi = re.cols().begin();
11971  const int bj = re.rows().begin();
11972  const int ei = re.cols().end();
11973  const int ej = re.rows().end();
11974 
11975  const int s1 = im7.GetX() - (ei - bi);
11976 
11977  T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, this->_k, this->_l);
11978  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, this->_k, this->_l);
11979  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, this->_k, this->_l);
11980  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, this->_k, this->_l);
11981  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, this->_k, this->_l);
11982  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, this->_k, this->_l);
11983  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, this->_k, this->_l);
11984 
11985  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
11986  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
11987  if (Domain::IsInside(im7, i, j, this->_k, this->_l, p7)) {
11988  // const_cast such that voxel functions need only implement
11989  // non-const operator() which is required for parallel_reduce
11990  const_cast<SeptenaryForEachVoxelIfBody *>(this)->_VoxelFunc (i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
11991  } else const_cast<SeptenaryForEachVoxelIfBody *>(this)->_OutsideFunc(i, j, this->_k, this->_l, p1, p2, p3, p4, p5, p6, p7);
11992  }
11993  }
11994 
11995  /// Process 3D image region
11996  void operator ()(const blocked_range3d<int> &re) const
11997  {
11998  const int bi = re.cols ().begin();
11999  const int bj = re.rows ().begin();
12000  const int bk = re.pages().begin();
12001  const int ei = re.cols ().end();
12002  const int ej = re.rows ().end();
12003  const int ek = re.pages().end();
12004 
12005  const int s1 = im7.GetX() - (ei - bi);
12006  const int s2 = (im7.GetY() - (ej - bj)) * im7.GetX();
12007 
12008  T1 *p1 = im1.IsEmpty() ? NULL : im1.GetPointerToVoxels(bi, bj, bk, this->_l);
12009  T2 *p2 = im2.IsEmpty() ? NULL : im2.GetPointerToVoxels(bi, bj, bk, this->_l);
12010  T3 *p3 = im3.IsEmpty() ? NULL : im3.GetPointerToVoxels(bi, bj, bk, this->_l);
12011  T4 *p4 = im4.IsEmpty() ? NULL : im4.GetPointerToVoxels(bi, bj, bk, this->_l);
12012  T5 *p5 = im5.IsEmpty() ? NULL : im5.GetPointerToVoxels(bi, bj, bk, this->_l);
12013  T6 *p6 = im6.IsEmpty() ? NULL : im6.GetPointerToVoxels(bi, bj, bk, this->_l);
12014  T7 *p7 = im7.IsEmpty() ? NULL : im7.GetPointerToVoxels(bi, bj, bk, this->_l);
12015 
12016  for (int k = bk; k < ek; ++k, p1 += s2, p2 += s2, p3 += s2, p4 += s2, p5 += s2, p6 += s2, p7 += s2)
12017  for (int j = bj; j < ej; ++j, p1 += s1, p2 += s1, p3 += s1, p4 += s1, p5 += s1, p6 += s1, p7 += s1)
12018  for (int i = bi; i < ei; ++i, p1 += 1, p2 += 1, p3 += 1, p4 += 1, p5 += 1, p6 += 1, p7 += 1) {
12019  if (Domain::IsInside(im7, i, j, k, this->_l, p7)) {
12020  // const_cast such that voxel functions need only implement
12021  // non-const operator() which is required for parallel_reduce
12022  const_cast<SeptenaryForEachVoxelIfBody *>(this)->_VoxelFunc (i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
12023  } else const_cast<SeptenaryForEachVoxelIfBody *>(this)->_OutsideFunc(i, j, k, this->_l, p1, p2, p3, p4, p5, p6, p7);
12024  }
12025  }
12026 };
12027 
12028 // -----------------------------------------------------------------------------
12029 // ForEachVoxel
12030 // -----------------------------------------------------------------------------
12031 
12032 //
12033 // Image arguments by pointer
12034 //
12035 
12036 // -----------------------------------------------------------------------------
12037 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12038 void ForEachScalar(GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12039 {
12040  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12041  blocked_range<int> re(0, im7->GetNumberOfVoxels());
12042  body(re);
12043  vf.join(body._VoxelFunc);
12044 }
12045 
12046 // -----------------------------------------------------------------------------
12047 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12048 void ForEachScalar(VoxelFunc vf, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12049 {
12050  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12051  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12052 }
12053 
12054 // -----------------------------------------------------------------------------
12055 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12056 void ForEachVoxel(GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12057 {
12058  if (im7->GetTSize()) {
12059  ForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12060  } else {
12061  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12062  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
12063  body(re);
12064  vf.join(body._VoxelFunc);
12065  }
12066 }
12067 
12068 // -----------------------------------------------------------------------------
12069 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12070 void ForEachVoxel(VoxelFunc vf, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12071 {
12072  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12073  ForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12074 }
12075 
12076 // -----------------------------------------------------------------------------
12077 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12078 void ForEachVoxel(const ImageAttributes &attr, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12079 {
12080  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12081  body(attr);
12082  vf.join(body._VoxelFunc);
12083 }
12084 
12085 // -----------------------------------------------------------------------------
12086 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12087 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12088 {
12089  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12090  ForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12091 }
12092 
12093 // -----------------------------------------------------------------------------
12094 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12095 void ForEachVoxel(const blocked_range<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12096 {
12097  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12098  body(re);
12099  vf.join(body._VoxelFunc);
12100 }
12101 
12102 // -----------------------------------------------------------------------------
12103 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12104 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12105 {
12106  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12107  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12108 }
12109 
12110 // -----------------------------------------------------------------------------
12111 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12112 void ForEachVoxel(const blocked_range2d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12113 {
12114  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12115  body(re);
12116  vf.join(body._VoxelFunc);
12117 }
12118 
12119 // -----------------------------------------------------------------------------
12120 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12121 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12122 {
12123  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12124  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12125 }
12126 
12127 // -----------------------------------------------------------------------------
12128 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12129 void ForEachVoxel(const blocked_range3d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12130 {
12131  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12132  body(re);
12133  vf.join(body._VoxelFunc);
12134 }
12135 
12136 // -----------------------------------------------------------------------------
12137 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12138 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12139 {
12140  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12141  ForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12142 }
12143 
12144 //
12145 // Image arguments by reference
12146 //
12147 
12148 // -----------------------------------------------------------------------------
12149 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12150 void ForEachScalar(GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12151 {
12152  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
12154  body(re);
12155  vf.join(body._VoxelFunc);
12156 }
12157 
12158 // -----------------------------------------------------------------------------
12159 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12160 void ForEachScalar(VoxelFunc vf, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12161 {
12162  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12163  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
12164 }
12165 
12166 // -----------------------------------------------------------------------------
12167 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12168 void ForEachVoxel(GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12169 {
12170  if (im7.GetTSize()) {
12171  ForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
12172  } else {
12173  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
12174  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
12175  body(re);
12176  vf.join(body._VoxelFunc);
12177  }
12178 }
12179 
12180 // -----------------------------------------------------------------------------
12181 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12182 void ForEachVoxel(VoxelFunc vf, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12183 {
12184  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12185  ForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
12186 }
12187 
12188 // -----------------------------------------------------------------------------
12189 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12190 void ForEachVoxel(const ImageAttributes &attr, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12191 {
12192  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
12193  body(attr);
12194  vf.join(body._VoxelFunc);
12195 }
12196 
12197 // -----------------------------------------------------------------------------
12198 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12199 void ForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12200 {
12201  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12202  ForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
12203 }
12204 
12205 // -----------------------------------------------------------------------------
12206 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12207 void ForEachVoxel(const blocked_range<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12208 {
12209  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
12210  body(re);
12211  vf.join(body._VoxelFunc);
12212 }
12213 
12214 // -----------------------------------------------------------------------------
12215 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12216 void ForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12217 {
12218  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12219  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
12220 }
12221 
12222 // -----------------------------------------------------------------------------
12223 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12224 void ForEachVoxel(const blocked_range2d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12225 {
12226  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
12227  body(re);
12228  vf.join(body._VoxelFunc);
12229 }
12230 
12231 // -----------------------------------------------------------------------------
12232 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12233 void ForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12234 {
12235  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12236  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
12237 }
12238 
12239 // -----------------------------------------------------------------------------
12240 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12241 void ForEachVoxel(const blocked_range3d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12242 {
12243  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
12244  body(re);
12245  vf.join(body._VoxelFunc);
12246 }
12247 
12248 // -----------------------------------------------------------------------------
12249 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12250 void ForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12251 {
12252  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12253  ForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
12254 }
12255 
12256 // -----------------------------------------------------------------------------
12257 // ForEachVoxelIf
12258 // -----------------------------------------------------------------------------
12259 
12260 //
12261 // Image arguments by pointer
12262 //
12263 
12264 // -----------------------------------------------------------------------------
12265 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12266 void ForEachScalarIf(GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
12267 {
12268  SeptenaryForEachVoxelIfBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12269  blocked_range<int> re(0, im7->GetNumberOfVoxels());
12270  body(re);
12271  vf.join(body._VoxelFunc);
12272  of.join(body._OutsideFunc);
12273 }
12274 
12275 // -----------------------------------------------------------------------------
12276 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12277 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12278 {
12279  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12280  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12281 }
12282 
12283 // -----------------------------------------------------------------------------
12284 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12285 void ForEachScalarIf(GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12286 {
12288  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12289 }
12290 
12291 // -----------------------------------------------------------------------------
12292 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12293 void ForEachScalarIf(VoxelFunc vf, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12294 {
12295  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12296  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12297 }
12298 
12299 // -----------------------------------------------------------------------------
12300 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12301 void ForEachVoxelIf(GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
12302 {
12303  if (im7->GetTSize()) {
12304  ForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12305  } else {
12306  SeptenaryForEachVoxelIfBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12307  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
12308  body(re);
12309  vf.join(body._VoxelFunc);
12310  of.join(body._OutsideFunc);
12311  }
12312 }
12313 
12314 // -----------------------------------------------------------------------------
12315 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12316 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12317 {
12318  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12319  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12320 }
12321 
12322 // -----------------------------------------------------------------------------
12323 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12324 void ForEachVoxelIf(GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12325 {
12327  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12328 }
12329 
12330 // -----------------------------------------------------------------------------
12331 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12332 void ForEachVoxelIf(VoxelFunc vf, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12333 {
12334  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12335  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12336 }
12337 
12338 // -----------------------------------------------------------------------------
12339 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12340 void ForEachVoxelIf(const ImageAttributes &attr, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
12341 {
12342  SeptenaryForEachVoxelIfBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12343  body(attr);
12344  vf.join(body._VoxelFunc);
12345  of.join(body._OutsideFunc);
12346 }
12347 
12348 // -----------------------------------------------------------------------------
12349 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12350 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12351 {
12352  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12353  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12354 }
12355 
12356 // -----------------------------------------------------------------------------
12357 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12358 void ForEachVoxelIf(const ImageAttributes &attr, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12359 {
12361  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12362 }
12363 
12364 // -----------------------------------------------------------------------------
12365 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12366 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12367 {
12368  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12369  ForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12370 }
12371 
12372 // -----------------------------------------------------------------------------
12373 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12374 void ForEachVoxelIf(const blocked_range<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
12375 {
12376  SeptenaryForEachVoxelIfBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12377  body(re);
12378  vf.join(body._VoxelFunc);
12379  of.join(body._OutsideFunc);
12380 }
12381 
12382 // -----------------------------------------------------------------------------
12383 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12384 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12385 {
12386  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12387  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12388 }
12389 
12390 // -----------------------------------------------------------------------------
12391 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12392 void ForEachVoxelIf(const blocked_range2d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
12393 {
12394  SeptenaryForEachVoxelIfBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12395  body(re);
12396  vf.join(body._VoxelFunc);
12397  of.join(body._OutsideFunc);
12398 }
12399 
12400 // -----------------------------------------------------------------------------
12401 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12402 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12403 {
12404  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12405  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12406 }
12407 
12408 // -----------------------------------------------------------------------------
12409 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12410 void ForEachVoxelIf(const blocked_range2d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12411 {
12413  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12414 }
12415 
12416 // -----------------------------------------------------------------------------
12417 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12418 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12419 {
12420  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12421  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12422 }
12423 
12424 // -----------------------------------------------------------------------------
12425 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12426 void ForEachVoxelIf(const blocked_range3d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
12427 {
12428  SeptenaryForEachVoxelIfBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12429  body(re);
12430  vf.join(body._VoxelFunc);
12431  of.join(body._OutsideFunc);
12432 }
12433 
12434 // -----------------------------------------------------------------------------
12435 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12436 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12437 {
12438  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12439  ForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12440 }
12441 
12442 // -----------------------------------------------------------------------------
12443 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12444 void ForEachVoxelIf(const blocked_range3d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12445 {
12447  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12448 }
12449 
12450 // -----------------------------------------------------------------------------
12451 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12452 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12453 {
12454  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12455  ForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12456 }
12457 
12458 //
12459 // Image arguments by reference
12460 //
12461 
12462 // -----------------------------------------------------------------------------
12463 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12464 void ForEachScalarIf(GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
12465 {
12468  body(re);
12469  vf.join(body._VoxelFunc);
12470  of.join(body._OutsideFunc);
12471 }
12472 
12473 // -----------------------------------------------------------------------------
12474 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12475 void ForEachScalarIf(VoxelFunc vf, OutsideFunc of, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12476 {
12477  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12478  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
12479 }
12480 
12481 // -----------------------------------------------------------------------------
12482 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12483 void ForEachScalarIf(GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12484 {
12486  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
12487 }
12488 
12489 // -----------------------------------------------------------------------------
12490 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12491 void ForEachScalarIf(VoxelFunc vf, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12492 {
12493  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12494  ForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
12495 }
12496 
12497 // -----------------------------------------------------------------------------
12498 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12499 void ForEachVoxelIf(GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
12500 {
12501  if (im7.GetTSize()) {
12502  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
12503  } else {
12505  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
12506  body(re);
12507  vf.join(body._VoxelFunc);
12508  of.join(body._OutsideFunc);
12509  }
12510 }
12511 
12512 // -----------------------------------------------------------------------------
12513 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12514 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12515 {
12516  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12517  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
12518 }
12519 
12520 // -----------------------------------------------------------------------------
12521 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12522 void ForEachVoxelIf(GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12523 {
12525  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
12526 }
12527 
12528 // -----------------------------------------------------------------------------
12529 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12530 void ForEachVoxelIf(VoxelFunc vf, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12531 {
12532  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12533  ForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
12534 }
12535 
12536 // -----------------------------------------------------------------------------
12537 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12538 void ForEachVoxelIf(const ImageAttributes &attr, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
12539 {
12541  body(attr);
12542  vf.join(body._VoxelFunc);
12543  of.join(body._OutsideFunc);
12544 }
12545 
12546 // -----------------------------------------------------------------------------
12547 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12548 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12549 {
12550  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12551  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
12552 }
12553 
12554 // -----------------------------------------------------------------------------
12555 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12556 void ForEachVoxelIf(const ImageAttributes &attr, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12557 {
12559  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
12560 }
12561 
12562 // -----------------------------------------------------------------------------
12563 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12564 void ForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12565 {
12566  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12567  ForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
12568 }
12569 
12570 // -----------------------------------------------------------------------------
12571 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12572 void ForEachVoxelIf(const blocked_range<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
12573 {
12575  body(re);
12576  vf.join(body._VoxelFunc);
12577  of.join(body._OutsideFunc);
12578 }
12579 
12580 // -----------------------------------------------------------------------------
12581 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12582 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12583 {
12584  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12585  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
12586 }
12587 
12588 // -----------------------------------------------------------------------------
12589 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12590 void ForEachVoxelIf(const blocked_range2d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
12591 {
12593  body(re);
12594  vf.join(body._VoxelFunc);
12595  of.join(body._OutsideFunc);
12596 }
12597 
12598 // -----------------------------------------------------------------------------
12599 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12600 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12601 {
12602  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12603  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
12604 }
12605 
12606 // -----------------------------------------------------------------------------
12607 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12608 void ForEachVoxelIf(const blocked_range2d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12609 {
12611  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
12612 }
12613 
12614 // -----------------------------------------------------------------------------
12615 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12616 void ForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12617 {
12618  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12619  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
12620 }
12621 
12622 // -----------------------------------------------------------------------------
12623 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12624 void ForEachVoxelIf(const blocked_range3d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
12625 {
12627  body(re);
12628  vf.join(body._VoxelFunc);
12629  of.join(body._OutsideFunc);
12630 }
12631 
12632 // -----------------------------------------------------------------------------
12633 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12634 void ForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12635 {
12636  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12637  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
12638 }
12639 
12640 // -----------------------------------------------------------------------------
12641 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12642 void ForEachVoxelIf(const blocked_range3d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12643 {
12645  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
12646 }
12647 
12648 // -----------------------------------------------------------------------------
12649 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12650 void ForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12651 {
12652  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12653  ForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
12654 }
12655 
12656 // -----------------------------------------------------------------------------
12657 // ParallelForEachVoxel
12658 // -----------------------------------------------------------------------------
12659 
12660 //
12661 // Image arguments by pointer
12662 //
12663 
12664 // -----------------------------------------------------------------------------
12665 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12666 void ParallelForEachScalar(GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12667 {
12668  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12669  blocked_range<int> re(0, im7->GetNumberOfVoxels());
12670  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
12671  else parallel_for (re, body);
12672 }
12673 
12674 // -----------------------------------------------------------------------------
12675 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12676 void ParallelForEachScalar(VoxelFunc vf, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12677 {
12678  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12679  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12680 }
12681 
12682 // -----------------------------------------------------------------------------
12683 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12684 void ParallelForEachVoxel(GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12685 {
12686  if (im7->GetTSize()) {
12687  ParallelForEachScalar(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12688  } else {
12689  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12690  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
12691  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
12692  else parallel_for (re, body);
12693  }
12694 }
12695 
12696 // -----------------------------------------------------------------------------
12697 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12698 void ParallelForEachVoxel(VoxelFunc vf, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12699 {
12700  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12701  ParallelForEachVoxel(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12702 }
12703 
12704 // -----------------------------------------------------------------------------
12705 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12706 void ParallelForEachVoxel(const ImageAttributes &attr, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12707 {
12708  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12709  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
12710  if (VoxelFunc::IsReduction()) {
12711  if (attr._dt) {
12712  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
12713  } else {
12714  parallel_reduce(re, body);
12715  }
12716  vf.join(body._VoxelFunc);
12717  } else {
12718  if (attr._dt) {
12719  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
12720  } else {
12721  parallel_for(re, body);
12722  }
12723  }
12724 }
12725 
12726 // -----------------------------------------------------------------------------
12727 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12728 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12729 {
12730  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12731  ParallelForEachVoxel(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12732 }
12733 
12734 // -----------------------------------------------------------------------------
12735 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12736 void ParallelForEachVoxel(const blocked_range<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12737 {
12738  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12739  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
12740  else parallel_for (re, body);
12741 }
12742 
12743 // -----------------------------------------------------------------------------
12744 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12745 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12746 {
12747  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12748  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12749 }
12750 
12751 // -----------------------------------------------------------------------------
12752 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12753 void ParallelForEachVoxel(const blocked_range2d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12754 {
12755  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12756  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
12757  else parallel_for (re, body);
12758 }
12759 
12760 // -----------------------------------------------------------------------------
12761 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12762 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12763 {
12764  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12765  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12766 }
12767 
12768 // -----------------------------------------------------------------------------
12769 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12770 void ParallelForEachVoxel(const blocked_range3d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12771 {
12772  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12773  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
12774  else parallel_for (re, body);
12775 }
12776 
12777 // -----------------------------------------------------------------------------
12778 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12779 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12780 {
12781  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12782  ParallelForEachVoxel(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12783 }
12784 
12785 //
12786 // Image arguments by reference
12787 //
12788 
12789 // -----------------------------------------------------------------------------
12790 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12791 void ParallelForEachScalar(GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12792 {
12793  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
12795  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
12796  else parallel_for (re, body);
12797 }
12798 
12799 // -----------------------------------------------------------------------------
12800 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12801 void ParallelForEachScalar(VoxelFunc vf, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12802 {
12803  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12804  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
12805 }
12806 
12807 // -----------------------------------------------------------------------------
12808 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12809 void ParallelForEachVoxel(GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12810 {
12811  if (im7.GetTSize()) {
12812  ParallelForEachScalar(im1, im2, im3, im4, im5, im6, im7, vf);
12813  } else {
12814  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
12815  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
12816  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
12817  else parallel_for (re, body);
12818  }
12819 }
12820 
12821 // -----------------------------------------------------------------------------
12822 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12823 void ParallelForEachVoxel(VoxelFunc vf, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12824 {
12825  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12826  ParallelForEachVoxel(im1, im2, im3, im4, im5, im6, im7, vf);
12827 }
12828 
12829 // -----------------------------------------------------------------------------
12830 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12831 void ParallelForEachVoxel(const ImageAttributes &attr, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12832 {
12833  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
12834  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
12835  if (VoxelFunc::IsReduction()) {
12836  if (attr._dt) {
12837  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
12838  } else {
12839  parallel_reduce(re, body);
12840  }
12841  vf.join(body._VoxelFunc);
12842  } else {
12843  if (attr._dt) {
12844  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
12845  } else {
12846  parallel_for(re, body);
12847  }
12848  }
12849 }
12850 
12851 // -----------------------------------------------------------------------------
12852 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12853 void ParallelForEachVoxel(VoxelFunc vf, const ImageAttributes &attr, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12854 {
12855  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12856  ParallelForEachVoxel(attr, im1, im2, im3, im4, im5, im6, im7, vf);
12857 }
12858 
12859 // -----------------------------------------------------------------------------
12860 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12861 void ParallelForEachVoxel(const blocked_range<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12862 {
12863  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
12864  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
12865  else parallel_for (re, body);
12866 }
12867 
12868 // -----------------------------------------------------------------------------
12869 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12870 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12871 {
12872  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12873  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
12874 }
12875 
12876 // -----------------------------------------------------------------------------
12877 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12878 void ParallelForEachVoxel(const blocked_range2d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12879 {
12880  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
12881  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
12882  else parallel_for (re, body);
12883 }
12884 
12885 // -----------------------------------------------------------------------------
12886 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12887 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range2d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12888 {
12889  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12890  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
12891 }
12892 
12893 // -----------------------------------------------------------------------------
12894 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12895 void ParallelForEachVoxel(const blocked_range3d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
12896 {
12897  SeptenaryForEachVoxelBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc> body(im1, im2, im3, im4, im5, im6, im7, vf);
12898  if (VoxelFunc::IsReduction()) { parallel_reduce(re, body); vf.join(body._VoxelFunc); }
12899  else parallel_for (re, body);
12900 }
12901 
12902 // -----------------------------------------------------------------------------
12903 template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12904 void ParallelForEachVoxel(VoxelFunc vf, const blocked_range3d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
12905 {
12906  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12907  ParallelForEachVoxel(re, im1, im2, im3, im4, im5, im6, im7, vf);
12908 }
12909 
12910 // -----------------------------------------------------------------------------
12911 // ParallelForEachVoxelIf
12912 // -----------------------------------------------------------------------------
12913 
12914 //
12915 // Image arguments by pointer
12916 //
12917 
12918 // -----------------------------------------------------------------------------
12919 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12920 void ParallelForEachScalarIf(GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
12921 {
12922  SeptenaryForEachVoxelIfBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12923  blocked_range<int> re(0, im7->GetNumberOfVoxels());
12924  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
12925  parallel_reduce(re, body);
12926  vf.join(body._VoxelFunc);
12927  of.join(body._OutsideFunc);
12928  } else {
12929  parallel_for(re, body);
12930  }
12931 }
12932 
12933 // -----------------------------------------------------------------------------
12934 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12935 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12936 {
12937  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12938  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12939 }
12940 
12941 // -----------------------------------------------------------------------------
12942 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12943 void ParallelForEachScalarIf(GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12944 {
12946  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12947 }
12948 
12949 // -----------------------------------------------------------------------------
12950 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12951 void ParallelForEachScalarIf(VoxelFunc vf, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12952 {
12953  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12954  ParallelForEachScalarIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12955 }
12956 
12957 // -----------------------------------------------------------------------------
12958 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12959 void ParallelForEachVoxelIf(GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
12960 {
12961  if (im7->GetTSize()) {
12962  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12963  } else {
12964  SeptenaryForEachVoxelIfBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12965  blocked_range<int> re(0, im7->GetNumberOfVoxels() / im7->GetT());
12966  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
12967  parallel_reduce(re, body);
12968  vf.join(body._VoxelFunc);
12969  of.join(body._OutsideFunc);
12970  } else {
12971  parallel_for(re, body);
12972  }
12973  }
12974 }
12975 
12976 // -----------------------------------------------------------------------------
12977 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
12978 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12979 {
12980  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12981  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12982 }
12983 
12984 // -----------------------------------------------------------------------------
12985 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12986 void ParallelForEachVoxelIf(GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
12987 {
12989  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
12990 }
12991 
12992 // -----------------------------------------------------------------------------
12993 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
12994 void ParallelForEachVoxelIf(VoxelFunc vf, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
12995 {
12996  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
12997  ParallelForEachVoxelIf<Domain>(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
12998 }
12999 
13000 // -----------------------------------------------------------------------------
13001 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13002 void ParallelForEachVoxelIf(const ImageAttributes &attr, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
13003 {
13004  SeptenaryForEachVoxelIfBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
13005  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
13006  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
13007  if (attr._dt) {
13008  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
13009  } else {
13010  parallel_reduce(re, body);
13011  }
13012  vf.join(body._VoxelFunc);
13013  of.join(body._OutsideFunc);
13014  } else {
13015  if (attr._dt) {
13016  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
13017  } else {
13018  parallel_for(re, body);
13019  }
13020  }
13021 }
13022 
13023 // -----------------------------------------------------------------------------
13024 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13025 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
13026 {
13027  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13028  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
13029 }
13030 
13031 // -----------------------------------------------------------------------------
13032 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13033 void ParallelForEachVoxelIf(const ImageAttributes &attr, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
13034 {
13036  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
13037 }
13038 
13039 // -----------------------------------------------------------------------------
13040 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13041 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
13042 {
13043  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13044  ParallelForEachVoxelIf<Domain>(attr, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
13045 }
13046 
13047 // -----------------------------------------------------------------------------
13048 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13049 void ParallelForEachVoxelIf(const blocked_range<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
13050 {
13051  SeptenaryForEachVoxelIfBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
13052  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
13053  parallel_reduce(re, body);
13054  vf.join(body._VoxelFunc);
13055  of.join(body._OutsideFunc);
13056  } else {
13057  parallel_for(re, body);
13058  }
13059 }
13060 
13061 // -----------------------------------------------------------------------------
13062 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13063 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
13064 {
13065  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13066  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
13067 }
13068 
13069 // -----------------------------------------------------------------------------
13070 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13071 void ParallelForEachVoxelIf(const blocked_range<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
13072 {
13074  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
13075 }
13076 
13077 // -----------------------------------------------------------------------------
13078 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13079 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
13080 {
13081  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13082  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
13083 }
13084 
13085 // -----------------------------------------------------------------------------
13086 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13087 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
13088 {
13089  SeptenaryForEachVoxelIfBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
13090  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
13091  parallel_reduce(re, body);
13092  vf.join(body._VoxelFunc);
13093  of.join(body._OutsideFunc);
13094  } else {
13095  parallel_for(re, body);
13096  }
13097 }
13098 
13099 // -----------------------------------------------------------------------------
13100 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13101 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
13102 {
13103  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13104  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
13105 }
13106 
13107 // -----------------------------------------------------------------------------
13108 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13109 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
13110 {
13112  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
13113 }
13114 
13115 // -----------------------------------------------------------------------------
13116 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13117 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
13118 {
13119  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13120  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
13121 }
13122 
13123 // -----------------------------------------------------------------------------
13124 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13125 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf, OutsideFunc &of)
13126 {
13127  SeptenaryForEachVoxelIfBody<T1, T2, T3, T4, T5, T6, T7, VoxelFunc, OutsideFunc, Domain> body(*im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
13128  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
13129  parallel_reduce(re, body);
13130  vf.join(body._VoxelFunc);
13131  of.join(body._OutsideFunc);
13132  } else {
13133  parallel_for(re, body);
13134  }
13135 }
13136 
13137 // -----------------------------------------------------------------------------
13138 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13139 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
13140 {
13141  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13142  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
13143 }
13144 
13145 // -----------------------------------------------------------------------------
13146 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13147 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7, VoxelFunc &vf)
13148 {
13150  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf, of);
13151 }
13152 
13153 // -----------------------------------------------------------------------------
13154 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13155 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, GenericImage<T1> *im1, GenericImage<T2> *im2, GenericImage<T3> *im3, GenericImage<T4> *im4, GenericImage<T5> *im5, GenericImage<T6> *im6, GenericImage<T7> *im7)
13156 {
13157  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13158  ParallelForEachVoxelIf<Domain>(re, *im1, *im2, *im3, *im4, *im5, *im6, *im7, vf);
13159 }
13160 
13161 //
13162 // Image arguments by reference
13163 //
13164 
13165 // -----------------------------------------------------------------------------
13166 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13167 void ParallelForEachScalarIf(GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
13168 {
13171  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
13172  parallel_reduce(re, body);
13173  vf.join(body._VoxelFunc);
13174  of.join(body._OutsideFunc);
13175  } else {
13176  parallel_for(re, body);
13177  }
13178 }
13179 
13180 // -----------------------------------------------------------------------------
13181 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13182 void ParallelForEachScalarIf(VoxelFunc vf, OutsideFunc of, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
13183 {
13184  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13185  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
13186 }
13187 
13188 // -----------------------------------------------------------------------------
13189 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13190 void ParallelForEachScalarIf(GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
13191 {
13193  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
13194 }
13195 
13196 // -----------------------------------------------------------------------------
13197 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13198 void ParallelForEachScalarIf(VoxelFunc vf, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
13199 {
13200  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13201  ParallelForEachScalarIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
13202 }
13203 
13204 // -----------------------------------------------------------------------------
13205 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13206 void ParallelForEachVoxelIf(GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
13207 {
13208  if (im7.GetTSize()) {
13209  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
13210  } else {
13212  blocked_range<int> re(0, im7.GetNumberOfVoxels() / im7.GetT());
13213  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
13214  parallel_reduce(re, body);
13215  vf.join(body._VoxelFunc);
13216  of.join(body._OutsideFunc);
13217  } else {
13218  parallel_for(re, body);
13219  }
13220  }
13221 }
13222 
13223 // -----------------------------------------------------------------------------
13224 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13225 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
13226 {
13227  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13228  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
13229 }
13230 
13231 // -----------------------------------------------------------------------------
13232 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13233 void ParallelForEachVoxelIf(GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
13234 {
13236  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf, of);
13237 }
13238 
13239 // -----------------------------------------------------------------------------
13240 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13241 void ParallelForEachVoxelIf(VoxelFunc vf, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
13242 {
13243  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13244  ParallelForEachVoxelIf<Domain>(im1, im2, im3, im4, im5, im6, im7, vf);
13245 }
13246 
13247 // -----------------------------------------------------------------------------
13248 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13249 void ParallelForEachVoxelIf(const ImageAttributes &attr, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
13250 {
13252  blocked_range3d<int> re(0, attr._z, 0, attr._y, 0, attr._x);
13253  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
13254  if (attr._dt) {
13255  for (body._l = 0; body._l < attr._t; ++body._l) parallel_reduce(re, body);
13256  } else {
13257  parallel_reduce(re, body);
13258  }
13259  vf.join(body._VoxelFunc);
13260  of.join(body._OutsideFunc);
13261  } else {
13262  if (attr._dt) {
13263  for (body._l = 0; body._l < attr._t; ++body._l) parallel_for(re, body);
13264  } else {
13265  parallel_for(re, body);
13266  }
13267  }
13268 }
13269 
13270 // -----------------------------------------------------------------------------
13271 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13272 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const ImageAttributes &attr, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
13273 {
13274  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13275  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
13276 }
13277 
13278 // -----------------------------------------------------------------------------
13279 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13280 void ParallelForEachVoxelIf(const ImageAttributes &attr, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
13281 {
13283  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf, of);
13284 }
13285 
13286 // -----------------------------------------------------------------------------
13287 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13288 void ParallelForEachVoxelIf(VoxelFunc vf, const ImageAttributes &attr, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
13289 {
13290  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13291  ParallelForEachVoxelIf<Domain>(attr, im1, im2, im3, im4, im5, im6, im7, vf);
13292 }
13293 
13294 // -----------------------------------------------------------------------------
13295 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13296 void ParallelForEachVoxelIf(const blocked_range<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
13297 {
13299  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
13300  parallel_reduce(re, body);
13301  vf.join(body._VoxelFunc);
13302  of.join(body._OutsideFunc);
13303  } else {
13304  parallel_for(re, body);
13305  }
13306 }
13307 
13308 // -----------------------------------------------------------------------------
13309 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13310 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
13311 {
13312  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13313  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
13314 }
13315 
13316 // -----------------------------------------------------------------------------
13317 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13318 void ParallelForEachVoxelIf(const blocked_range<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
13319 {
13321  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
13322 }
13323 
13324 // -----------------------------------------------------------------------------
13325 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13326 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
13327 {
13328  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13329  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
13330 }
13331 
13332 // -----------------------------------------------------------------------------
13333 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13334 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
13335 {
13337  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
13338  parallel_reduce(re, body);
13339  vf.join(body._VoxelFunc);
13340  of.join(body._OutsideFunc);
13341  } else {
13342  parallel_for(re, body);
13343  }
13344 }
13345 
13346 // -----------------------------------------------------------------------------
13347 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13348 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range2d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
13349 {
13350  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13351  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
13352 }
13353 
13354 // -----------------------------------------------------------------------------
13355 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13356 void ParallelForEachVoxelIf(const blocked_range2d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
13357 {
13359  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
13360 }
13361 
13362 // -----------------------------------------------------------------------------
13363 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13364 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range2d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
13365 {
13366  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13367  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
13368 }
13369 
13370 // -----------------------------------------------------------------------------
13371 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13372 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf, OutsideFunc &of)
13373 {
13375  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) {
13376  parallel_reduce(re, body);
13377  vf.join(body._VoxelFunc);
13378  of.join(body._OutsideFunc);
13379  } else {
13380  parallel_for(re, body);
13381  }
13382 }
13383 
13384 // -----------------------------------------------------------------------------
13385 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc, class OutsideFunc>
13386 void ParallelForEachVoxelIf(VoxelFunc vf, OutsideFunc of, const blocked_range3d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
13387 {
13388  if (VoxelFunc::IsReduction() || OutsideFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13389  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
13390 }
13391 
13392 // -----------------------------------------------------------------------------
13393 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13394 void ParallelForEachVoxelIf(const blocked_range3d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7, VoxelFunc &vf)
13395 {
13397  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf, of);
13398 }
13399 
13400 // -----------------------------------------------------------------------------
13401 template <class Domain, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class VoxelFunc>
13402 void ParallelForEachVoxelIf(VoxelFunc vf, const blocked_range3d<int> &re, GenericImage<T1> &im1, GenericImage<T2> &im2, GenericImage<T3> &im3, GenericImage<T4> &im4, GenericImage<T5> &im5, GenericImage<T6> &im6, GenericImage<T7> &im7)
13403 {
13404  if (VoxelFunc::IsReduction()) _foreachseptenaryvoxelfunction_must_not_be_reduction();
13405  ParallelForEachVoxelIf<Domain>(re, im1, im2, im3, im4, im5, im6, im7, vf);
13406 }
13407 
13408 
13409 } // namespace mirtk
13410 
13411 #endif
double _dt
Voxel t-dimensions (in ms)
SeptenaryForEachVoxelIfBody(GenericImage< T1 > &im1, GenericImage< T2 > &im2, GenericImage< T3 > &im3, GenericImage< T4 > &im4, GenericImage< T5 > &im5, GenericImage< T6 > &im6, GenericImage< T7 > &im7, VoxelFunc &vf, OutsideFunc &of)
Constructor.
SeptenaryForEachVoxelIfBody(const SeptenaryForEachVoxelIfBody &o)
Copy constructor.
SeptenaryForEachVoxelBody_6Const(const SeptenaryForEachVoxelBody_6Const &o)
Copy constructor.
Dummy type used to distinguish split constructor from copy constructor.
Definition: Parallel.h:143
SeptenaryForEachVoxelIfBody_6Const(const GenericImage< T1 > &im1, const GenericImage< T2 > &im2, const GenericImage< T3 > &im3, const GenericImage< T4 > &im4, const GenericImage< T5 > &im5, const GenericImage< T6 > &im6, GenericImage< T7 > &im7, VoxelFunc &vf, OutsideFunc &of)
Constructor.
SeptenaryForEachVoxelBody_4Const(const GenericImage< T1 > &im1, const GenericImage< T2 > &im2, const GenericImage< T3 > &im3, const GenericImage< T4 > &im4, GenericImage< T5 > &im5, GenericImage< T6 > &im6, GenericImage< T7 > &im7, VoxelFunc &vf)
Constructor.
SeptenaryForEachVoxelIfBody_3Const(const SeptenaryForEachVoxelIfBody_3Const &o)
Copy constructor.
SeptenaryForEachVoxelBody_6Const(SeptenaryForEachVoxelBody_6Const &o, split s)
Split constructor.
SeptenaryForEachVoxelBody_4Const(SeptenaryForEachVoxelBody_4Const &o, split s)
Split constructor.
SeptenaryForEachVoxelBody_2Const(const SeptenaryForEachVoxelBody_2Const &o)
Copy constructor.
SeptenaryForEachVoxelBody_5Const(const SeptenaryForEachVoxelBody_5Const &o)
Copy constructor.
SeptenaryForEachVoxelBody_Const(const GenericImage< T1 > &im1, const GenericImage< T2 > &im2, const GenericImage< T3 > &im3, const GenericImage< T4 > &im4, const GenericImage< T5 > &im5, const GenericImage< T6 > &im6, const GenericImage< T7 > &im7, VoxelFunc &vf)
Constructor.
SeptenaryForEachVoxelIfBody_6Const(const SeptenaryForEachVoxelIfBody_6Const &o)
Copy constructor.
Two-dimensional range.
Definition: Parallel.h:168
SeptenaryForEachVoxelIfBody_4Const(const SeptenaryForEachVoxelIfBody_4Const &o)
Copy constructor.
SeptenaryForEachVoxelBody_1Const(const SeptenaryForEachVoxelBody_1Const &o)
Copy constructor.
SeptenaryForEachVoxelIfBody_Const(SeptenaryForEachVoxelIfBody_Const &o, split s)
Split constructor.
bool IsEmpty() const
Whether image is uninitialized.
Definition: BaseImage.h:1283
SeptenaryForEachVoxelIfBody_1Const(const SeptenaryForEachVoxelIfBody_1Const &o)
Copy constructor.
SeptenaryForEachVoxelIfBody_5Const(SeptenaryForEachVoxelIfBody_5Const &o, split s)
Split constructor.
SeptenaryForEachVoxelBody_2Const(SeptenaryForEachVoxelBody_2Const &o, split s)
Split constructor.
SeptenaryForEachVoxelBody_3Const(const SeptenaryForEachVoxelBody_3Const &o)
Copy constructor.
int _y
Image y-dimension (in voxels)
SeptenaryForEachVoxelIfBody_1Const(const GenericImage< T1 > &im1, GenericImage< T2 > &im2, GenericImage< T3 > &im3, GenericImage< T4 > &im4, GenericImage< T5 > &im5, GenericImage< T6 > &im6, GenericImage< T7 > &im7, VoxelFunc &vf, OutsideFunc &of)
Constructor.
SeptenaryForEachVoxelBody_2Const(const GenericImage< T1 > &im1, const GenericImage< T2 > &im2, GenericImage< T3 > &im3, GenericImage< T4 > &im4, GenericImage< T5 > &im5, GenericImage< T6 > &im6, GenericImage< T7 > &im7, VoxelFunc &vf)
Constructor.
SeptenaryForEachVoxelIfBody_1Const(SeptenaryForEachVoxelIfBody_1Const &o, split s)
Split constructor.
One-dimensional range.
Definition: Parallel.h:155
SeptenaryForEachVoxelIfBody_2Const(SeptenaryForEachVoxelIfBody_2Const &o, split s)
Split constructor.
VoxelFunc _VoxelFunc
Functor executed for each voxel.
SeptenaryForEachVoxelIfBody_6Const(SeptenaryForEachVoxelIfBody_6Const &o, split s)
Split constructor.
SeptenaryForEachVoxelBody_6Const(const GenericImage< T1 > &im1, const GenericImage< T2 > &im2, const GenericImage< T3 > &im3, const GenericImage< T4 > &im4, const GenericImage< T5 > &im5, const GenericImage< T6 > &im6, GenericImage< T7 > &im7, VoxelFunc &vf)
Constructor.
SeptenaryForEachVoxelIfBody_3Const(const GenericImage< T1 > &im1, const GenericImage< T2 > &im2, const GenericImage< T3 > &im3, GenericImage< T4 > &im4, GenericImage< T5 > &im5, GenericImage< T6 > &im6, GenericImage< T7 > &im7, VoxelFunc &vf, OutsideFunc &of)
Constructor.
SeptenaryForEachVoxelBody(GenericImage< T1 > &im1, GenericImage< T2 > &im2, GenericImage< T3 > &im3, GenericImage< T4 > &im4, GenericImage< T5 > &im5, GenericImage< T6 > &im6, GenericImage< T7 > &im7, VoxelFunc &vf)
Constructor.
SeptenaryForEachVoxelBody_5Const(const GenericImage< T1 > &im1, const GenericImage< T2 > &im2, const GenericImage< T3 > &im3, const GenericImage< T4 > &im4, const GenericImage< T5 > &im5, GenericImage< T6 > &im6, GenericImage< T7 > &im7, VoxelFunc &vf)
Constructor.
SeptenaryForEachVoxelIfBody_Const(const GenericImage< T1 > &im1, const GenericImage< T2 > &im2, const GenericImage< T3 > &im3, const GenericImage< T4 > &im4, const GenericImage< T5 > &im5, const GenericImage< T6 > &im6, const GenericImage< T7 > &im7, VoxelFunc &vf, OutsideFunc &of)
Constructor.
SeptenaryForEachVoxelBody_4Const(const SeptenaryForEachVoxelBody_4Const &o)
Copy constructor.
void operator()(const ImageAttributes &attr) const
Process entire image.
Definition: IOConfig.h:41
VoxelType * GetPointerToVoxels(int=0, int=0, int=0, int=0)
Definition: GenericImage.h:849
int GetX() const
Returns the number of voxels in the x-direction.
Definition: BaseImage.h:904
SeptenaryForEachVoxelBody_3Const(SeptenaryForEachVoxelBody_3Const &o, split s)
Split constructor.
int _z
Image z-dimension (in voxels)
int _l
Indices for fixed dimensions.
SeptenaryForEachVoxelBody_5Const(SeptenaryForEachVoxelBody_5Const &o, split s)
Split constructor.
int _t
Image t-dimension (in voxels)
int GetT() const
Returns the number of voxels in the t-direction.
Definition: BaseImage.h:922
int GetY() const
Returns the number of voxels in the y-direction.
Definition: BaseImage.h:910
SeptenaryForEachVoxelIfBody_5Const(const SeptenaryForEachVoxelIfBody_5Const &o)
Copy constructor.
Three-dimensional range.
Definition: Parallel.h:197
int GetNumberOfVoxels() const
Definition: BaseImage.h:1741
OutsideFunc _OutsideFunc
Functor executed for each background voxel.
SeptenaryForEachVoxelBody(const SeptenaryForEachVoxelBody &o)
Copy constructor.
SeptenaryForEachVoxelIfBody_2Const(const GenericImage< T1 > &im1, const GenericImage< T2 > &im2, GenericImage< T3 > &im3, GenericImage< T4 > &im4, GenericImage< T5 > &im5, GenericImage< T6 > &im6, GenericImage< T7 > &im7, VoxelFunc &vf, OutsideFunc &of)
Constructor.
double GetTSize() const
Returns the size of a voxel in the t-direction.
Definition: BaseImage.h:970
SeptenaryForEachVoxelBody_Const(const SeptenaryForEachVoxelBody_Const &o)
Copy constructor.
SeptenaryForEachVoxelBody(SeptenaryForEachVoxelBody &o, split s)
Split constructor.
SeptenaryForEachVoxelIfBody_4Const(const GenericImage< T1 > &im1, const GenericImage< T2 > &im2, const GenericImage< T3 > &im3, const GenericImage< T4 > &im4, GenericImage< T5 > &im5, GenericImage< T6 > &im6, GenericImage< T7 > &im7, VoxelFunc &vf, OutsideFunc &of)
Constructor.
SeptenaryForEachVoxelIfBody_2Const(const SeptenaryForEachVoxelIfBody_2Const &o)
Copy constructor.
SeptenaryForEachVoxelBody_1Const(SeptenaryForEachVoxelBody_1Const &o, split s)
Split constructor.
SeptenaryForEachVoxelIfBody(SeptenaryForEachVoxelIfBody &o, split s)
Split constructor.
int _x
Image x-dimension (in voxels)
SeptenaryForEachVoxelIfBody_4Const(SeptenaryForEachVoxelIfBody_4Const &o, split s)
Split constructor.
SeptenaryForEachVoxelIfBody_3Const(SeptenaryForEachVoxelIfBody_3Const &o, split s)
Split constructor.
void parallel_reduce(const Range &range, Body &body)
parallel_reduce dummy template function which executes the body serially
Definition: Parallel.h:238
SeptenaryForEachVoxelBody_1Const(const GenericImage< T1 > &im1, GenericImage< T2 > &im2, GenericImage< T3 > &im3, GenericImage< T4 > &im4, GenericImage< T5 > &im5, GenericImage< T6 > &im6, GenericImage< T7 > &im7, VoxelFunc &vf)
Constructor.
SeptenaryForEachVoxelBody_Const(SeptenaryForEachVoxelBody_Const &o, split s)
Split constructor.
SeptenaryForEachVoxelIfBody_Const(const SeptenaryForEachVoxelIfBody_Const &o)
Copy constructor.
SeptenaryForEachVoxelBody_3Const(const GenericImage< T1 > &im1, const GenericImage< T2 > &im2, const GenericImage< T3 > &im3, GenericImage< T4 > &im4, GenericImage< T5 > &im5, GenericImage< T6 > &im6, GenericImage< T7 > &im7, VoxelFunc &vf)
Constructor.
void parallel_for(const Range &range, const Body &body)
parallel_for dummy template function which executes the body serially
Definition: Parallel.h:232
SeptenaryForEachVoxelIfBody_5Const(const GenericImage< T1 > &im1, const GenericImage< T2 > &im2, const GenericImage< T3 > &im3, const GenericImage< T4 > &im4, const GenericImage< T5 > &im5, GenericImage< T6 > &im6, GenericImage< T7 > &im7, VoxelFunc &vf, OutsideFunc &of)
Constructor.