Skip to content

Commit

Permalink
COMP: Address braces around initializer warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
blowekamp authored and dzenanz committed May 3, 2021
1 parent 8fd1fec commit dae904e
Showing 1 changed file with 29 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class StatisticsLabelMapFixture : public ::testing::Test
TEST_F(StatisticsLabelMapFixture, 2D_zero)
{
using Utils = FixtureUtilities<2, unsigned char>;
using namespace itk::GTest::TypedefsAndConstructors::Dimension2;

auto image = Utils::CreateImage();
auto labelImage = Utils ::CreateLabelImage();
Expand Down Expand Up @@ -190,21 +191,22 @@ TEST_F(StatisticsLabelMapFixture, 2D_zero)
TEST_F(StatisticsLabelMapFixture, 2D_ones_with_outliers)
{
using Utils = FixtureUtilities<2, signed short>;
using namespace itk::GTest::TypedefsAndConstructors::Dimension2;

auto image = Utils::CreateImage();
Utils::PixelType value = 1;
image->FillBuffer(value);

// Test with outliers outside the label.
image->SetPixel({ 0, 0 }, 32000);
image->SetPixel({ 0, 1 }, -32000);
image->SetPixel(IndexType{ 0, 0 }, 32000);
image->SetPixel(IndexType{ 0, 1 }, -32000);


auto labelImage = Utils ::CreateLabelImage();
Utils::LabelPixelType label = 1;
labelImage->FillBuffer(label);
labelImage->SetPixel({ 0, 0 }, 0);
labelImage->SetPixel({ 0, 1 }, 0);
labelImage->SetPixel(IndexType{ 0, 0 }, 0);
labelImage->SetPixel(IndexType{ 0, 1 }, 0);

Utils::LabelObjectType::ConstPointer labelObject = Utils::ComputeLabelObject(labelImage, image, label, 1 << 16);

Expand All @@ -225,21 +227,22 @@ TEST_F(StatisticsLabelMapFixture, 2D_ones_with_outliers)
TEST_F(StatisticsLabelMapFixture, 2D_rand_with_outliers)
{
using Utils = FixtureUtilities<2, signed short>;
using namespace itk::GTest::TypedefsAndConstructors::Dimension2;

auto image = Utils::CreateImageRandom(500, 0);
auto labelImage = Utils ::CreateLabelImage();

// Test with outliers outside the label.
image->SetPixel({ 0, 0 }, 32000);
image->SetPixel({ 0, 1 }, -2000);
image->SetPixel(IndexType{ 0, 0 }, 32000);
image->SetPixel(IndexType{ 0, 1 }, -2000);
// Set min/max in label
image->SetPixel({ 0, 2 }, 0);
image->SetPixel({ 0, 3 }, 500);
image->SetPixel(IndexType{ 0, 2 }, 0);
image->SetPixel(IndexType{ 0, 3 }, 500);

Utils::LabelPixelType label = 1;
labelImage->FillBuffer(label);
labelImage->SetPixel({ 0, 0 }, 0);
labelImage->SetPixel({ 0, 1 }, 0);
labelImage->SetPixel(IndexType{ 0, 0 }, 0);
labelImage->SetPixel(IndexType{ 0, 1 }, 0);


Utils::LabelObjectType::ConstPointer labelObject = Utils::ComputeLabelObject(labelImage, image, label, 1 << 16);
Expand All @@ -259,21 +262,22 @@ TEST_F(StatisticsLabelMapFixture, 2D_rand_with_outliers)
TEST_F(StatisticsLabelMapFixture, 2D_even)
{
using Utils = FixtureUtilities<2, unsigned char>;
using namespace itk::GTest::TypedefsAndConstructors::Dimension2;

auto image = Utils::CreateImage();
auto labelImage = Utils ::CreateLabelImage();

// Set label with two elements far apart, the median should be average
image->SetPixel({ 0, 0 }, 10);
image->SetPixel({ 0, 1 }, 100);
image->SetPixel({ 0, 2 }, 1);
image->SetPixel({ 0, 3 }, 200);
image->SetPixel(IndexType{ 0, 0 }, 10);
image->SetPixel(IndexType{ 0, 1 }, 100);
image->SetPixel(IndexType{ 0, 2 }, 1);
image->SetPixel(IndexType{ 0, 3 }, 200);

Utils::LabelPixelType label = 1;
labelImage->SetPixel({ 0, 0 }, label);
labelImage->SetPixel({ 0, 1 }, label);
labelImage->SetPixel({ 0, 2 }, label);
labelImage->SetPixel({ 0, 3 }, label);
labelImage->SetPixel(IndexType{ 0, 0 }, label);
labelImage->SetPixel(IndexType{ 0, 1 }, label);
labelImage->SetPixel(IndexType{ 0, 2 }, label);
labelImage->SetPixel(IndexType{ 0, 3 }, label);


Utils::LabelObjectType::ConstPointer labelObject = Utils::ComputeLabelObject(labelImage, image, label, 1 << 8);
Expand All @@ -296,19 +300,20 @@ TEST_F(StatisticsLabelMapFixture, 2D_even)
TEST_F(StatisticsLabelMapFixture, 2D_three)
{
using Utils = FixtureUtilities<2, unsigned char>;
using namespace itk::GTest::TypedefsAndConstructors::Dimension2;

auto image = Utils::CreateImage();
auto labelImage = Utils ::CreateLabelImage();

// Set label with two elements far apart, the median should be average
image->SetPixel({ 0, 0 }, 1);
image->SetPixel({ 0, 1 }, 3);
image->SetPixel({ 0, 2 }, 10);
image->SetPixel(IndexType{ 0, 0 }, 1);
image->SetPixel(IndexType{ 0, 1 }, 3);
image->SetPixel(IndexType{ 0, 2 }, 10);

Utils::LabelPixelType label = 1;
labelImage->SetPixel({ 0, 0 }, label);
labelImage->SetPixel({ 0, 1 }, label);
labelImage->SetPixel({ 0, 2 }, label);
labelImage->SetPixel(IndexType{ 0, 0 }, label);
labelImage->SetPixel(IndexType{ 0, 1 }, label);
labelImage->SetPixel(IndexType{ 0, 2 }, label);


Utils::LabelObjectType::ConstPointer labelObject = Utils::ComputeLabelObject(labelImage, image, label, 1 << 8);
Expand Down

0 comments on commit dae904e

Please sign in to comment.