Skip to content

Commit

Permalink
STYLE: use ReadImage and WriteImage in PolygonSpatialObjectIsInsideTest
Browse files Browse the repository at this point in the history
  • Loading branch information
dzenanz committed Mar 30, 2021
1 parent 59ebc33 commit 75adb9f
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,8 @@ itkPolygonSpatialObjectIsInsideInObjectSpaceTest(int argc, char * argv[])
ITK_TRY_EXPECT_NO_EXCEPTION(polygonPtr->Update());

// Read baseline image
ImageType::Pointer baselineImagePtr = nullptr;
itk::ImageFileReader<ImageType>::Pointer reader = itk::ImageFileReader<ImageType>::New();
reader->SetFileName(baselineFileName);
ITK_TRY_EXPECT_NO_EXCEPTION(reader->Update());
baselineImagePtr = reader->GetOutput();
ImageType::Pointer baselineImagePtr = nullptr;
ITK_TRY_EXPECT_NO_EXCEPTION(baselineImagePtr = itk::ReadImage<ImageType>(baselineFileName));


// create image
Expand All @@ -122,11 +119,7 @@ itkPolygonSpatialObjectIsInsideInObjectSpaceTest(int argc, char * argv[])
ITK_TRY_EXPECT_NO_EXCEPTION(toImageFilter->Update());

// write image
using FileWriterType = itk::ImageFileWriter<ImageType>;
auto fileWriter = FileWriterType::New();
fileWriter->SetInput(toImageFilter->GetOutput());
fileWriter->SetFileName(outFileName);
ITK_TRY_EXPECT_NO_EXCEPTION(fileWriter->Update());
ITK_TRY_EXPECT_NO_EXCEPTION(itk::WriteImage(toImageFilter->GetOutput(), outFileName));

return EXIT_SUCCESS;
}

0 comments on commit 75adb9f

Please sign in to comment.