24 for (std::size_t j = 0; j < r; j++, row += c) {
26 for (std::size_t i = 1; i < c; i++) {
37 for (std::size_t i = 1; i < c; i++) {
38 std::size_t colIndex = c - i;
40 if (row[colIndex - 1] > limit) {
41 row[colIndex - 1] = limit;
56 std::size_t sliceIndex,
57 const std::vector<GridElement>& sq) {
59 std::size_t r = gridSize.
y;
60 std::size_t c = gridSize.
x;
61 std::size_t voxelCount = r * c;
67 if (!
EDT_1D(sliceData, r, c)) {
74 std::vector<GridElement> colData;
77 }
catch (
const std::bad_alloc&) {
83 for (std::size_t i = 0; i < c; ++i) {
87 for (std::size_t j = 0; j < r; ++j, pt += c) colData[j] = *pt;
96 for (std::size_t j = 1; j < r; ++j, pt += c) {
97 std::size_t rowIndex = j;
99 if (colData[rowIndex] > buffer + 1) {
100 GridElement b = (colData[rowIndex] - buffer - 1) / 2;
101 if (rowIndex + b + 1 > r)
107 if (colData[rowIndex + l] <= m) {
111 if (m < *npt) *npt = m;
118 buffer = colData[rowIndex];
128 for (std::size_t j = 1; j < r; ++j, pt -= c) {
129 std::size_t rowIndex = r - j - 1;
131 if (colData[rowIndex] > buffer + 1) {
132 GridElement b = (colData[rowIndex] - buffer - 1) / 2;
139 if (colData[rowIndex - l] <= m) {
143 if (m < *npt) *npt = m;
150 buffer = colData[rowIndex];
162 std::size_t r = gridSize.
y;
163 std::size_t c = gridSize.
x;
164 std::size_t p = gridSize.
z;
165 std::size_t voxelCount = r * c * p;
167 std::size_t diag =
static_cast<std::size_t
>(
168 ceil(sqrt(
static_cast<double>(r * r + c * c + p * p))) - 1);
169 std::size_t nsqr = 2 * (diag + 1);
171 std::vector<GridElement> sq;
174 }
catch (
const std::bad_alloc&) {
179 for (std::size_t i = 0; i < nsqr; ++i) {
185 static_cast<GridElement>(r * r + c * c + p * p) - 1;
192 sprintf(buffer,
"Box: [%u x %u x %u]", gridSize.
x, gridSize.
y,
202 for (std::size_t i = 0; i < voxelCount; ++i) {
205 data[i] = maxDistance;
212 for (std::size_t k = 0; k < p; ++k) {
213 if (!
SDT_2D(grid, k, sq)) {
217 if (progressCb && !normProgress.
oneStep()) {
225 std::size_t rc = r * c;
226 std::vector<GridElement> colData;
229 }
catch (
const std::bad_alloc&) {
234 for (std::size_t j = 0; j < r; ++j,
data += c) {
235 for (std::size_t i = 0; i < c; ++i) {
238 for (std::size_t k = 0; k < p; ++k, pt += rc) colData[k] = *pt;
244 for (std::size_t k = 1; k < p; ++k, pt += rc) {
246 if (colData[k] > buffer + 1) {
248 if (k + b + 1 > p) b =
static_cast<GridElement>(p - 1 - k);
253 if (colData[k + l] <= m)
break;
254 if (m < *npt) *npt = m;
266 buffer = colData[p - 1];
268 for (std::size_t k = p - 2; k !=
static_cast<std::size_t
>(-1);
271 if (colData[k] > buffer + 1) {
278 if (colData[k - l] <= m)
break;
279 if (m < *npt) *npt = m;
290 if (progressCb && !normProgress.
oneStep()) {
virtual void setInfo(const char *infoStr)=0
Notifies some information about the ongoing process.
virtual void setMethodTitle(const char *methodTitle)=0
Notifies the algorithm title.
virtual bool textCanBeEdited() const
Returns whether the dialog title and info can be updated or not.
virtual void update(float percent)=0
Notifies the algorithm progress.
Simple 3D grid structure.
unsigned GridElement
Cell type.
GridElement * data()
Gives access to the internal grid data (with margin)
const Tuple3ui & size() const
Returns the grid dimensions.
bool oneStep()
Increments total progress value of a single unit.
MiniVec< float, N > ceil(const MiniVec< float, N > &a)
Generic file read and write utility for python interface.