Medical Imaging Interaction Toolkit  2018.4.99-dfa0c14e
Medical Imaging Interaction Toolkit
DumpDICOMMitkImage.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "mitkTestDICOMLoading.h"
14 #include "mitkImage.h"
15 
16 int main(int argc, char** argv)
17 {
19  mitk::StringList files;
20 
21  if (argc < 2)
22  {
23  std::cerr << "Wrong usage of DumpDICOMMitkImage. Call it like VerifyDICOMMitkImageDump <dumpfile> <dcmfile1> [<dcmfile2> [... <dcmfileN>]].";
24  return 1;
25  }
26 
27  std::string dumpPath = argv[1];
28 
29  for (int arg = 2; arg < argc; ++arg) files.push_back( argv[arg] );
30 
32 
33  std::ostringstream sstream;
34  // combine individual dumps in a way that VerifyDICOMMitkImageDump is able to separate again.
35  // I.e.: when changing this piece of code, always change VerifyDICOMMitkImageDump, too.
36  unsigned int imageCounter(0);
37  for ( mitk::TestDICOMLoading::ImageList::const_iterator imageIter = images.begin();
38  imageIter != images.end();
39  ++imageIter )
40  {
41  sstream << "-- Image " << ++imageCounter << "\n";
42  sstream << loader.DumpImageInformation( *imageIter ) << "\n";
43  }
44  std::cout << sstream.str();
45  std::ofstream out(dumpPath, ios::trunc | ios::out);
46  out << sstream.str();
47  out.close();
48 
49 }
50 
std::string DumpImageInformation(const Image *image)
Dump relevant image information for later comparison.
std::list< Image::Pointer > ImageList
std::vector< std::string > StringList
ImageList LoadFiles(const StringList &files)
std::vector< mitk::Image::Pointer > images
int main(int argc, char **argv)