Skip to content

Commit 380c33d

Browse files
committed
ENH: add regression test for #4386
1 parent 867ee31 commit 380c33d

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

Modules/Segmentation/Voronoi/test/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ itk_add_test(
2727
COMMAND
2828
ITKVoronoiTestDriver
2929
itkVoronoiSegmentationRGBImageFilterTest)
30+
itk_add_test(
31+
NAME
32+
itkVoronoiDiagram2DInfiniteLoopTest
33+
COMMAND
34+
ITKVoronoiTestDriver
35+
itkVoronoiDiagram2DInfiniteLoopTest)
3036
itk_add_test(
3137
NAME
3238
itkVoronoiDiagram2DTest
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*=========================================================================
2+
*
3+
* Copyright NumFOCUS
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0.txt
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*=========================================================================*/
18+
19+
#include "itkVoronoiDiagram2DGenerator.h"
20+
#include "itkTestingMacros.h"
21+
22+
int
23+
itkVoronoiDiagram2DInfiniteLoopTest(int argc, char * argv[])
24+
{
25+
if (argc != 0)
26+
{
27+
std::cerr << "Takes no parameters." << std::endl;
28+
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << std::endl;
29+
return EXIT_FAILURE;
30+
}
31+
32+
// From https://github.com/InsightSoftwareConsortium/ITK/issues/4386
33+
using VoronoiDiagramType = itk::VoronoiDiagram2D<double>;
34+
using VoronoiGeneratorType = itk::VoronoiDiagram2DGenerator<double>;
35+
using PointType = VoronoiDiagramType::PointType;
36+
VoronoiGeneratorType::Pointer vg = VoronoiGeneratorType::New();
37+
vg->SetOrigin(PointType{ { -1.61569, -1.76726 } });
38+
vg->SetBoundary(PointType{ { 1.60174, 1.76345 } });
39+
vg->AddOneSeed(PointType{ { -1.39649, 0.322212 } });
40+
vg->AddOneSeed(PointType{ { -1.30128, 0.231786 } });
41+
vg->AddOneSeed(PointType{ { -1.21509, 0.0515039 } });
42+
vg->AddOneSeed(PointType{ { -1.22364, -0.030281 } });
43+
vg->AddOneSeed(PointType{ { -1.22125, -0.120815 } });
44+
vg->AddOneSeed(PointType{ { -1.25159, -0.23593 } });
45+
vg->Update();
46+
47+
return EXIT_SUCCESS;
48+
}

0 commit comments

Comments
 (0)