2Copyright Télécom ParisTech (2015).
4Contributor: Yann Leprince <yann.leprince@ylep.fr>.
6This file is part of highres-cortex, a collection of software designed
7to process high-resolution magnetic resonance images of the cerebral
10This software is governed by the CeCILL licence under French law and
11abiding by the rules of distribution of free software. You can use,
12modify and/or redistribute the software under the terms of the CeCILL
13licence as circulated by CEA, CNRS and INRIA at the following URL:
14<http://www.cecill.info/>.
16As a counterpart to the access to the source code and rights to copy,
17modify and redistribute granted by the licence, users are provided only
18with a limited warranty and the software's author, the holder of the
19economic rights, and the successive licensors have only limited
22In this respect, the user's attention is drawn to the risks associated
23with loading, using, modifying and/or developing or reproducing the
24software by the user in light of its specific status of scientific
25software, that may mean that it is complicated to manipulate, and that
26also therefore means that it is reserved for developers and experienced
27professionals having in-depth computer knowledge. Users are therefore
28encouraged to load and test the software's suitability as regards their
29requirements in conditions enabling the security of their systems and/or
30data to be ensured and, more generally, to use and operate it in the
31same conditions as regards security.
33The fact that you are presently reading this means that you have had
34knowledge of the CeCILL licence and that you accept its terms.
37template <typename T, class Predicate>
39yl::check_border_values(const carto::VolumeRef<T>& volume,
40 const Predicate& predicate)
42 const std::vector<int> borders = volume->getBorders();
45 for(int z = -borders[4]; z < 0; ++z)
46 for(int y = -borders[2]; y < volume->getSizeY() + borders[3]; ++y)
47 for(int x = -borders[0]; x < volume->getSizeX() + borders[1]; ++x)
48 if(!predicate(volume(x, y, z)))
52 for(int z = volume->getSizeZ(); z < volume->getSizeZ() + borders[5]; ++z)
53 for(int y = -borders[2]; y < volume->getSizeY() + borders[3]; ++y)
54 for(int x = -borders[0]; x < volume->getSizeX() + borders[1]; ++x)
55 if(!predicate(volume(x, y, z)))
59 for(int z = 0; z < volume->getSizeZ(); ++z)
60 for(int y = -borders[2]; y < 0; ++y)
61 for(int x = -borders[0]; x < volume->getSizeX() + borders[1]; ++x)
62 if(!predicate(volume(x, y, z)))
66 for(int z = 0; z < volume->getSizeZ(); ++z)
67 for(int y = volume->getSizeY(); y < volume->getSizeY() + borders[3]; ++y)
68 for(int x = -borders[0]; x < volume->getSizeX() + borders[1]; ++x)
69 if(!predicate(volume(x, y, z)))
73 for(int z = 0; z < volume->getSizeZ(); ++z)
74 for(int y = 0; y < volume->getSizeY(); ++y)
75 for(int x = -borders[0]; x < 0; ++x)
76 if(!predicate(volume(x, y, z)))
80 for(int z = 0; z < volume->getSizeZ(); ++z)
81 for(int y = 0; y < volume->getSizeY(); ++y)
82 for(int x = volume->getSizeX(); x < volume->getSizeX() + borders[1]; ++x)
83 if(!predicate(volume(x, y, z)))
90int yl::xyz_min_border(const carto::VolumeRef<T>& volume)
92 return xyz_min_border(volume->getBorders());