20 std::vector<std::string>
LoadDumps(
const std::string& fileName)
22 std::vector<std::string> separatedDumps;
24 std::ifstream fileStream( fileName.c_str() );
29 std::getline(fileStream, line);
31 if (line.find(
"-- Image ") == 0)
34 if ( !buffer.empty() )
37 separatedDumps.push_back(buffer);
43 buffer += line +
"\n";
49 if ( !buffer.empty() )
51 separatedDumps.push_back(buffer);
55 return separatedDumps;
59 int main(
int argc,
char** argv)
71 MITK_ERROR <<
" " << argv[0] <<
" reference.dump file1 [file2 .. fileN]";
73 MITK_ERROR <<
" Loads all DICOM images in file1 to fileN as MITK images ";
74 MITK_ERROR <<
" and compares loaded images against stored expectations (dumps).";
75 MITK_ERROR <<
" See also DumpDICOMMitkImage (generates dumps)";
86 std::vector<std::string> expectedDumps =
LoadDumps(argv[1]);
88 for (
int arg = 2; arg < argc; ++arg) files.push_back( argv[arg] );
92 unsigned int imageCounter(0);
93 for ( mitk::TestDICOMLoading::ImageList::const_iterator imageIter = images.begin();
94 imageIter != images.end();
95 ++imageIter, ++imageCounter )
99 if (imageCounter >= expectedDumps.size())
101 MITK_ERROR <<
"Loader produces more images than expected. Aborting after image " << (imageCounter-1);
102 MITK_INFO <<
"Image " << imageCounter <<
" loaded as:\n" << imageDump;
107 if (loadedAsExpected)
109 MITK_INFO <<
"Image " << imageCounter <<
" loads as expected.";
113 MITK_ERROR <<
"Image " << imageCounter <<
" did not load as expected.";
114 MITK_INFO <<
"Expected: \n" << expectedDumps[imageCounter] <<
"\nGot:\n" << imageDump;
119 if (images.size() < expectedDumps.size())
121 MITK_ERROR <<
"Loader produced only " << images.size() <<
" mitk::Images, while test expected " << expectedDumps.size() <<
" images";
std::string DumpImageInformation(const Image *image)
Dump relevant image information for later comparison.
std::list< Image::Pointer > ImageList
std::vector< std::string > StringList
int main(int argc, char **argv)
section MAP_FRAME_Mapper_Settings Mapper settings For the mapping of corrected images
ImageList LoadFiles(const StringList &files)
std::vector< std::string > LoadDumps(const std::string &fileName)
bool CompareImageInformationDumps(const std::string &reference, const std::string &test)
Compare two image information dumps.