Skip to content

Commit fd4e069

Browse files
authored
Merge pull request #5725 from CavRiley/Update-connected-component-testing-baselines
ENH: Update connected component testing baselines
2 parents c632a72 + 415d2ed commit fd4e069

8 files changed

+30
-14
lines changed

Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTest.cxx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
#include "itkImageFileReader.h"
2323
#include "itkImageFileWriter.h"
2424
#include "itkSimpleFilterWatcher.h"
25-
#include "vnl/vnl_sample.h"
2625
#include "itkTestingMacros.h"
2726
#include <algorithm> // For generate.
27+
#include <random> // For mt19937.
2828

2929
int
3030
itkConnectedComponentImageFilterTest(int argc, char * argv[])
@@ -124,12 +124,20 @@ itkConnectedComponentImageFilterTest(int argc, char * argv[])
124124

125125
std::vector<RGBPixelType> colormap;
126126
colormap.resize(numObjects + 1);
127-
vnl_sample_reseed(1031571);
127+
128+
using RGBComponentType = RGBPixelType::ComponentType;
129+
constexpr auto maxRGBComponentValue = std::numeric_limits<RGBComponentType>::max();
130+
131+
constexpr std::mt19937::result_type randomSeed{ 1031571 };
132+
std::mt19937 randomNumberEngine(randomSeed);
133+
std::uniform_int_distribution<> randomNumberDistribution(maxRGBComponentValue / 3, maxRGBComponentValue);
134+
128135
for (auto & i : colormap)
129136
{
130137
RGBPixelType px;
131-
std::generate(
132-
px.begin(), px.end(), [] { return static_cast<unsigned char>(255 * vnl_sample_uniform(0.3333, 1.0)); });
138+
std::generate(px.begin(), px.end(), [&randomNumberEngine, &randomNumberDistribution] {
139+
return static_cast<RGBComponentType>(randomNumberDistribution(randomNumberEngine));
140+
});
133141

134142
i = px;
135143
}

Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTestRGB.cxx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include "itkImageFileWriter.h"
2424
#include "itkSimpleFilterWatcher.h"
2525
#include "itkTestingMacros.h"
26-
#include "vnl/vnl_sample.h"
2726
#include <algorithm> // For generate.
27+
#include <random> // For mt19937.
2828

2929
int
3030
itkConnectedComponentImageFilterTestRGB(int argc, char * argv[])
@@ -104,11 +104,19 @@ itkConnectedComponentImageFilterTestRGB(int argc, char * argv[])
104104
std::vector<RGBPixelType> colormap;
105105
RGBPixelType px;
106106
colormap.resize(numObjects + 1);
107-
vnl_sample_reseed(1031571);
107+
108+
using RGBComponentType = RGBPixelType::ComponentType;
109+
constexpr auto maxRGBComponentValue = std::numeric_limits<RGBComponentType>::max();
110+
111+
constexpr std::mt19937::result_type randomSeed{ 1031571 };
112+
std::mt19937 randomNumberEngine(randomSeed);
113+
std::uniform_int_distribution<> randomNumberDistribution(maxRGBComponentValue / 3, maxRGBComponentValue);
114+
108115
for (auto & i : colormap)
109116
{
110-
std::generate(
111-
px.begin(), px.end(), [] { return static_cast<unsigned char>(255 * vnl_sample_uniform(0.3333, 1.0)); });
117+
std::generate(px.begin(), px.end(), [&randomNumberEngine, &randomNumberDistribution] {
118+
return static_cast<RGBComponentType>(randomNumberDistribution(randomNumberEngine));
119+
});
112120

113121
i = px;
114122
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bafkreidtm3ujuq2se3t4evejuuibd2cuk2xbv72yeqemnwo3syno72vjqq
1+
bafkreicqlhg6xztvfqmgynbf3xb6qhbghwfzvkugt6nwxn2kloiwnfalp4
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bafkreig3gdn4rui4nxur5kkxrfv2nwh22vutbjmh5xl24ipxc2th7rz5qe
1+
bafkreidv7hznlkcvddhdi7udpvsvqd7q677dhiamqenhskxyq53vogf62q
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bafkreiamfgwxqutd2spazedlyworg33yphhvjqcq7mkiq3eto2i5x4hy3y
1+
bafkreidngvamh6ejxx5j6lzf57p3kqtjjvgm4dtil7ofekz4blhmns3pf4
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bafkreig5qyo7d7klilcdl5was6yoahhljq42p4cujwbcv3ar3twguajod4
1+
bafkreihut6bgxwhnrmts5ov5hr357n4u7m53f2sjquuobazjizetlqb4ky
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bafkreiecgg7dkdhieady5toarh75h5qrocfxecsonscbt27xzwkxxu2uwq
1+
bafkreiejqekgsjh7frp43eya5fssenr56bfxazjo2ocp7qyevse5xfjjrq
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bafkreigngeop4cdefb3bd7rjgqwgsbu5kwzkr2dirwhpx27l2twlq7vkuq
1+
bafkreifvvwy6zmh7td3cutymiervm7ipqgkfwx6rxuyxej2acw4i5ebcmu

0 commit comments

Comments
 (0)