Skip to content

Commit

Permalink
ENH: Add a test for reading float vector image as Image<Vector<double>>
Browse files Browse the repository at this point in the history
  • Loading branch information
dzenanz committed Jan 14, 2022
1 parent 5dd9585 commit df6e287
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Modules/IO/ImageBase/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ itkMatrixImageWriteReadTest.cxx
itkReadWriteImageWithDictionaryTest.cxx
itkVectorImageReadWriteTest.cxx
itk64bitTest.cxx
itkImageFileReaderManyComponentVectorTest.cxx
)


Expand Down Expand Up @@ -352,6 +353,10 @@ itk_add_test(NAME itkVectorImageReadWriteTest2
COMMAND ITKIOImageBaseTestDriver itkVectorImageReadWriteTest
${ITK_TEST_OUTPUT_DIR}/VectorImageReadWriteTest.nrrd)

itk_add_test(NAME itkImageFileReaderManyComponentVectorTest
COMMAND ITKIOImageBaseTestDriver itkImageFileReaderManyComponentVectorTest
DATA{Input/rf_voltage_15_freq_0005000000_2017-5-31_12-36-44_ReferenceSpectrum_side_lines_03_fft1d_size_128.mha})

add_executable(itkUnicodeIOTest itkUnicodeIOTest.cxx)
itk_module_target_label(itkUnicodeIOTest)
itk_add_test(NAME itkUnicodeIOTest COMMAND itkUnicodeIOTest)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bf4f01d5f37610ee46b1942a9928f735cead6b198dc1c9b0c85c0a08b0cb24f8037a2a318c5985f6a76953006458e1a6600de297576b5aa01e8f602fac173ed8
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/

#include "itkImageFileReader.h"
#include "itkTestingMacros.h"

int
itkImageFileReaderManyComponentVectorTest(int argc, char * argv[])
{
if (argc < 2)
{
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv);
std::cerr << " inputImage";
std::cerr << std::endl;
return EXIT_FAILURE;
}

constexpr unsigned Channels = 31;
constexpr unsigned Dimension = 2;
using ImageNDType = itk::Image<itk::Vector<double, Channels>, Dimension>;

ImageNDType::Pointer image;
ITK_TRY_EXPECT_NO_EXCEPTION(image = itk::ReadImage<ImageNDType>(argv[1]));

return EXIT_SUCCESS;
}

0 comments on commit df6e287

Please sign in to comment.