21 std::vector<std::string>
LoadDumps(
const std::string &fileName)
23 std::vector<std::string> separatedDumps;
25 std::ifstream fileStream(fileName.c_str());
31 std::getline(fileStream, line);
33 if (line.find(
"-- Image ") == 0)
39 separatedDumps.push_back(buffer);
45 buffer += line +
"\n";
53 separatedDumps.push_back(buffer);
57 return separatedDumps;
60 int main(
int argc,
char **argv)
72 MITK_ERROR <<
" " << argv[0] <<
" reference.dump file1 [file2 .. fileN]";
74 MITK_ERROR <<
" Loads all DCM images in file1 to fileN as MITK images ";
75 MITK_ERROR <<
" and compares loaded images against stored expectations (dumps).";
76 MITK_ERROR <<
" See also DumpDCMMitkImage (generates dumps)";
89 std::vector<std::string> expectedDumps =
LoadDumps(argv[1]);
91 for (
int arg = 2; arg < argc; ++arg)
92 files.push_back(argv[arg]);
96 unsigned int imageCounter(0);
97 for (mitk::TestDCMLoading::ImageList::const_iterator imageIter = images.begin(); imageIter != images.end();
98 ++imageIter, ++imageCounter)
102 if (imageCounter >= expectedDumps.size())
104 MITK_ERROR <<
"Loader produces more images than expected. Aborting after image " << (imageCounter - 1);
105 MITK_INFO <<
"Image " << imageCounter <<
" loaded as:\n" << imageDump;
110 if (loadedAsExpected)
112 MITK_INFO <<
"Image " << imageCounter <<
" loads as expected.";
116 MITK_ERROR <<
"Image " << imageCounter <<
" did not load as expected.";
117 MITK_INFO <<
"Expected: \n" << expectedDumps[imageCounter] <<
"\nGot:\n" << imageDump;
int main(int argc, char **argv)
std::string DumpImageInformation(const Image *image)
Dump relevant image information for later comparison.
DicomSeriesReader::StringContainer StringContainer
bool CompareImageInformationDumps(const std::string &reference, const std::string &test)
Compare two image information dumps.
std::vector< std::string > LoadDumps(const std::string &fileName)
std::list< itk::SmartPointer< Image > > ImageList
ImageList LoadFiles(const StringContainer &files, itk::SmartPointer< Image > preLoadedVolume=nullptr)
section MAP_FRAME_Mapper_Settings Mapper settings For the mapping of corrected images