56 typedef DGtal::ImageContainerByITKImage < DGtal::Z3i::Domain, PixelType > DGtalImage;
60 typename DGtalImage::ITKImagePointer dgtal_itk = img.getITKImagePointer();
63 typedef itk::Image<PixelType, 3> ItkImage;
64 typedef itk::ImageFileReader<ItkImage> ReaderType;
65 typename ReaderType::Pointer reader = ReaderType::New();
66 reader->SetFileName(filename);
70 typename ItkImage::Pointer itk = reader->GetOutput();
72 INFO(
"Checking spacing" )
73 REQUIRE( dgtal_itk->GetSpacing() == itk->GetSpacing() );
74 INFO(
"Checking origin" )
75 REQUIRE( dgtal_itk->GetOrigin() == itk->GetOrigin() );
76 INFO(
"Checking direction" )
77 REQUIRE( dgtal_itk->GetDirection() == itk->GetDirection() );
90 "Testing feature io/readers of ITKReader with 16 bits (uint16) images" )
93 testPath +
"samples/lobsterCroped16b.mhd" );
98 "Testing feature io/readers of ITKReader with rescaled 16 bits (uint16) "
102 RescalFCT resc = RescalFCT( 0, 65535, 0, 255 );
104 testPath +
"samples/lobsterCroped16b.mhd", resc );
108 "Testing behavior of ITKReader on non existent image file" )
110 bool caughtException =
false;
111 const std::string filename = testPath +
"samples/null.mhd";
118 caughtException =
true;
119 trace.
info() <<
"Exception was correctly caught" << std::endl;
121 REQUIRE( caughtException ==
true);
125 "Checking spatial information when loading through DGtal" )
132 "Checking import with/without shifted domain")
143 auto i = 101*pTarget[1]+pTarget[0]+pTarget[2]*101*101;
144 trace.
info() <<
"value:" << *(imNonShifted.range().begin()+i);
145 REQUIRE( ( *(imNonShifted.range().begin()+i) == *(imShifted.range().begin()+i ) ));
146 REQUIRE( ( *(imNonShifted.range().begin()+i) == 68 ));