Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkSimpleFilterWatcher.h"
#include "vnl/vnl_sample.h"
#include "itkTestingMacros.h"
#include <algorithm> // For generate.
#include <random> // For mt19937.

int
itkConnectedComponentImageFilterTest(int argc, char * argv[])
Expand Down Expand Up @@ -124,12 +124,20 @@ itkConnectedComponentImageFilterTest(int argc, char * argv[])

std::vector<RGBPixelType> colormap;
colormap.resize(numObjects + 1);
vnl_sample_reseed(1031571);

using RGBComponentType = RGBPixelType::ComponentType;
constexpr auto maxRGBComponentValue = std::numeric_limits<RGBComponentType>::max();

constexpr std::mt19937::result_type randomSeed{ 1031571 };
std::mt19937 randomNumberEngine(randomSeed);
std::uniform_int_distribution<> randomNumberDistribution(maxRGBComponentValue / 3, maxRGBComponentValue);

for (auto & i : colormap)
{
RGBPixelType px;
std::generate(
px.begin(), px.end(), [] { return static_cast<unsigned char>(255 * vnl_sample_uniform(0.3333, 1.0)); });
std::generate(px.begin(), px.end(), [&randomNumberEngine, &randomNumberDistribution] {
return static_cast<RGBComponentType>(randomNumberDistribution(randomNumberEngine));
});

i = px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include "itkImageFileWriter.h"
#include "itkSimpleFilterWatcher.h"
#include "itkTestingMacros.h"
#include "vnl/vnl_sample.h"
#include <algorithm> // For generate.
#include <random> // For mt19937.

int
itkConnectedComponentImageFilterTestRGB(int argc, char * argv[])
Expand Down Expand Up @@ -104,11 +104,19 @@ itkConnectedComponentImageFilterTestRGB(int argc, char * argv[])
std::vector<RGBPixelType> colormap;
RGBPixelType px;
colormap.resize(numObjects + 1);
vnl_sample_reseed(1031571);

using RGBComponentType = RGBPixelType::ComponentType;
constexpr auto maxRGBComponentValue = std::numeric_limits<RGBComponentType>::max();

constexpr std::mt19937::result_type randomSeed{ 1031571 };
std::mt19937 randomNumberEngine(randomSeed);
std::uniform_int_distribution<> randomNumberDistribution(maxRGBComponentValue / 3, maxRGBComponentValue);

for (auto & i : colormap)
{
std::generate(
px.begin(), px.end(), [] { return static_cast<unsigned char>(255 * vnl_sample_uniform(0.3333, 1.0)); });
std::generate(px.begin(), px.end(), [&randomNumberEngine, &randomNumberDistribution] {
return static_cast<RGBComponentType>(randomNumberDistribution(randomNumberEngine));
});

i = px;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bafkreidtm3ujuq2se3t4evejuuibd2cuk2xbv72yeqemnwo3syno72vjqq
bafkreicqlhg6xztvfqmgynbf3xb6qhbghwfzvkugt6nwxn2kloiwnfalp4
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bafkreig3gdn4rui4nxur5kkxrfv2nwh22vutbjmh5xl24ipxc2th7rz5qe
bafkreidv7hznlkcvddhdi7udpvsvqd7q677dhiamqenhskxyq53vogf62q
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bafkreiamfgwxqutd2spazedlyworg33yphhvjqcq7mkiq3eto2i5x4hy3y
bafkreidngvamh6ejxx5j6lzf57p3kqtjjvgm4dtil7ofekz4blhmns3pf4
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bafkreig5qyo7d7klilcdl5was6yoahhljq42p4cujwbcv3ar3twguajod4
bafkreihut6bgxwhnrmts5ov5hr357n4u7m53f2sjquuobazjizetlqb4ky
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bafkreiecgg7dkdhieady5toarh75h5qrocfxecsonscbt27xzwkxxu2uwq
bafkreiejqekgsjh7frp43eya5fssenr56bfxazjo2ocp7qyevse5xfjjrq
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bafkreigngeop4cdefb3bd7rjgqwgsbu5kwzkr2dirwhpx27l2twlq7vkuq
bafkreifvvwy6zmh7td3cutymiervm7ipqgkfwx6rxuyxej2acw4i5ebcmu
Loading