Commit 0ef6bc05 authored by Gert Wollny's avatar Gert Wollny
Browse files

New upstream version 3.0.0

parent 766b0df0
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -2,7 +2,8 @@
# https://github.com/travis-ci/travis-ci/issues/3505
language: cpp
# Use the faster container-based infrastructure.
sudo: false
#sudo: false
dist: xenial
env:
  global:
   # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
@@ -53,20 +54,21 @@ matrix:
        - CXXFLAGS="-Wall -Wextra" # -m64 -fsanitize=address,undefined
        # http://stackoverflow.com/questions/15678153/homebrew-python-on-mac-os-x-10-8-fatal-python-error-pythreadstate-get-no-cu
        #- CMAKE_EXTRA="-DGDCM_WRAP_PYTHON:BOOL=ON -DGDCM_BUILD_DOCBOOK_MANPAGES:BOOL=OFF -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python2.7"
        - CMAKE_EXTRA="-DGDCM_WRAP_PYTHON:BOOL=ON -DGDCM_WRAP_CSHARP:BOOL=OFF -DGDCM_WRAP_JAVA:BOOL=ON -DGDCM_USE_SYSTEM_UUID:BOOL=ON -DGDCM_USE_SYSTEM_ZLIB:BOOL=ON -DGDCM_BUILD_DOCBOOK_MANPAGES:BOOL=OFF"
        - CMAKE_EXTRA="-DGDCM_WRAP_PYTHON:BOOL=ON -DGDCM_WRAP_CSHARP:BOOL=OFF -DGDCM_WRAP_JAVA:BOOL=OFF -DGDCM_USE_SYSTEM_UUID:BOOL=ON -DGDCM_USE_SYSTEM_ZLIB:BOOL=ON -DGDCM_BUILD_DOCBOOK_MANPAGES:BOOL=OFF"
        - B_NAME=default
        - CPACK_NAME=Darwin

before_install:
  #- env
  - cmake --version
  #- swig -version
  - if [ "$B_NAME" == "system" ]; then swig -version; fi
  # do not run the full test suite for now on fsanitize and osx (takes too long)
  - if [ "$B_NAME" == "fsanitize" ]; then mv Testing/Data Testing/Data.old; fi
  # https://docs.travis-ci.com/user/osx-ci-environment/#Environment-variables
  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then mv Testing/Data Testing/Data.old; fi
  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update                     ; fi
  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install swig docbook-xsl   ; fi
  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then swig -version; fi
  # https://github.com/travis-ci/travis-ci/issues/2312
  #- if [ "$TRAVIS_OS_NAME" == "osx" ]; then virtualenv env -p python3       ; fi
  #- if [ "$TRAVIS_OS_NAME" == "osx" ]; then source env/bin/activate         ; fi
+1 −1
Original line number Diff line number Diff line
subdirs(Cxx)
add_subdirectory(Cxx)
+13 −1
Original line number Diff line number Diff line
@@ -90,6 +90,18 @@ if(GDCM_USE_SYSTEM_POPPLER)
  if(LIBPOPPLER_NEW_OBJECT_API)
    list(APPEND libpoppler_flags -DLIBPOPPLER_NEW_OBJECT_API)
  endif()
  CHECK_CXX_SOURCE_COMPILES(
	  "\#include <poppler/goo/GooString.h>\nint main() { const GooString gs; gs.getChar(0); return 0; }"
    LIBPOPPLER_GOOSTRING_HAS_CONSTGETCHAR)
  if(LIBPOPPLER_GOOSTRING_HAS_CONSTGETCHAR)
    list(APPEND libpoppler_flags -DLIBPOPPLER_GOOSTRING_HAS_CONSTGETCHAR)
  endif()
  CHECK_CXX_SOURCE_COMPILES(
	  "\#include <poppler/goo/GooString.h>\nint main() { GooString gs; gs.getCString(); return 0; }"
	  LIBPOPPLER_GOOSTRING_HAS_GETCSTRING)
  if(LIBPOPPLER_GOOSTRING_HAS_GETCSTRING)
    list(APPEND libpoppler_flags -DLIBPOPPLER_GOOSTRING_HAS_GETCSTRING)
  endif()
  if(libpoppler_flags)
    string(REPLACE ";" " " libpoppler_flags_string "${libpoppler_flags}")
    set_source_files_properties(
+21 −21
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ static bool AnonymizeOneFile(gdcm::Anonymizer &anon, const char *filename, const
  return true;
}

static bool GetRSAKeys(gdcm::CryptographicMessageSyntax &cms, const char *privpath = 0, const char *certpath = 0)
static bool GetRSAKeys(gdcm::CryptographicMessageSyntax &cms, const char *privpath = nullptr, const char *certpath = nullptr)
{
  if( privpath && *privpath )
    {
@@ -318,26 +318,26 @@ int main(int argc, char *argv[])
  gdcm::CryptoFactory::CryptoLib crypto_lib;
  crypto_lib = gdcm::CryptoFactory::DEFAULT;

  while (1) {
  while (true) {
    //int this_option_optind = optind ? optind : 1;
    int option_index = 0;
    static struct option long_options[] = {
        {"input", required_argument, NULL, 'i'},                 // i
        {"output", required_argument, NULL, 'o'},                // o
        {"input", required_argument, nullptr, 'i'},                 // i
        {"output", required_argument, nullptr, 'o'},                // o
        {"root-uid", required_argument, &rootuid, 1}, // specific Root (not GDCM)
        {"resources-path", required_argument, &resourcespath, 1},
        {"de-identify", no_argument, NULL, 'e'},
        {"re-identify", no_argument, NULL, 'd'},
        {"key", required_argument, NULL, 'k'},
        {"certificate", required_argument, NULL, 'c'}, // 7
        {"password", required_argument, NULL, 'p'},
        {"de-identify", no_argument, nullptr, 'e'},
        {"re-identify", no_argument, nullptr, 'd'},
        {"key", required_argument, nullptr, 'k'},
        {"certificate", required_argument, nullptr, 'c'}, // 7
        {"password", required_argument, nullptr, 'p'},

        {"des3", no_argument, &des3, 1},
        {"aes128", no_argument, &aes128, 1},
        {"aes192", no_argument, &aes192, 1},
        {"aes256", no_argument, &aes256, 1},

        {"recursive", no_argument, NULL, 'r'},
        {"recursive", no_argument, nullptr, 'r'},
        {"dumb", no_argument, &dumb_mode, 1},
        {"empty", required_argument, &empty_tag, 1}, // 15
        {"remove", required_argument, &remove_tag, 1},
@@ -345,14 +345,14 @@ int main(int argc, char *argv[])
        {"continue", no_argument, &continuemode, 1},
        {"crypto", required_argument, &crypto_api, 1}, //19

        {"verbose", no_argument, NULL, 'V'},
        {"warning", no_argument, NULL, 'W'},
        {"debug", no_argument, NULL, 'D'},
        {"error", no_argument, NULL, 'E'},
        {"help", no_argument, NULL, 'h'},
        {"version", no_argument, NULL, 'v'},
        {"verbose", no_argument, nullptr, 'V'},
        {"warning", no_argument, nullptr, 'W'},
        {"debug", no_argument, nullptr, 'D'},
        {"error", no_argument, nullptr, 'E'},
        {"help", no_argument, nullptr, 'h'},
        {"version", no_argument, nullptr, 'v'},

        {0, 0, 0, 0}
        {nullptr, 0, nullptr, 0}
    };

    c = getopt_long (argc, argv, "i:o:rdek:c:p:VWDEhv",
@@ -449,7 +449,7 @@ int main(int argc, char *argv[])
            std::string str;
            //ss >> str;
            std::getline(ss, str); // do not skip whitespace
            replace_tags_value.push_back( std::make_pair(tag, str) );
            replace_tags_value.emplace_back(tag, str );
            }
          else if( option_index == 19 ) /* crypto */
            {
@@ -547,7 +547,7 @@ int main(int argc, char *argv[])
    while (optind < argc)
      {
      //printf ("%s\n", argv[optind++]);
      files.push_back( argv[optind++] );
      files.emplace_back(argv[optind++] );
      }
    //printf ("\n");
    if( files.size() == 2
@@ -605,7 +605,7 @@ int main(int argc, char *argv[])
    return 1;
    }

  gdcm::CryptoFactory* crypto_factory = NULL;
  gdcm::CryptoFactory* crypto_factory = nullptr;
  if( deidentify || reidentify )
    {
    crypto_factory = gdcm::CryptoFactory::GetFactoryInstance(crypto_lib);
@@ -773,7 +773,7 @@ int main(int argc, char *argv[])
    }

  // Get private key/certificate
  gdcm::CryptographicMessageSyntax *cms_ptr = NULL;
  gdcm::CryptographicMessageSyntax *cms_ptr = nullptr;
  if( crypto_factory )
    {
    cms_ptr = crypto_factory->CreateCMSProvider();
+31 −22
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ static void PrintHelp()
  std::cout << "     --remove-retired      Remove retired tags." << std::endl;
  std::cout << "Image only Options:" << std::endl;
  std::cout << "  -l --apply-lut                      Apply LUT (non-standard, advanced user only)." << std::endl;
  std::cout << "  -8 --apply-lut8                     Apply LUT/RGB8 (non-standard, advanced user only)." << std::endl;
  std::cout << "     --decompress-lut                 Decompress LUT (linearize segmented LUT)." << std::endl;
  std::cout << "  -P --photometric-interpretation %s  Change Photometric Interpretation (when possible)." << std::endl;
  std::cout << "  -w --raw                            Decompress image." << std::endl;
@@ -438,6 +439,7 @@ int main (int argc, char *argv[])
  int implicit = 0;
  int quiet = 0;
  int lut = 0;
  int lut8 = 0;
  int decompress_lut = 0;
  int raw = 0;
  int deflated = 0;
@@ -486,28 +488,28 @@ int main (int argc, char *argv[])
  int jpeglserror = 0;
  int jpeglserror_value = 0;

  while (1) {
  while (true) {
    //int this_option_optind = optind ? optind : 1;
    int option_index = 0;
    static struct option long_options[] = {
        {"input", 1, 0, 0},
        {"output", 1, 0, 0},
        {"group-length", 1, 0, 0}, // valid / create / remove
        {"preamble", 1, 0, 0}, // valid / create / remove
        {"padding", 1, 0, 0}, // valid (\0 -> space) / optimize (at most 1 byte of padding)
        {"vr", 1, 0, 0}, // valid
        {"sop", 1, 0, 0}, // default to SC...
        {"iod", 1, 0, 0}, // valid
        {"meta", 1, 0, 0}, // valid / create / remove
        {"dataset", 1, 0, 0}, // valid / create / remove?
        {"sequence", 1, 0, 0}, // defined / undefined
        {"deflate", 1, 0, 0}, // 1 - 9 / best = 9 / fast = 1
        {"tag", 1, 0, 0}, // need to specify a tag xxxx,yyyy = value to override default
        {"name", 1, 0, 0}, // same as tag but explicit use of name
        {"input", 1, nullptr, 0},
        {"output", 1, nullptr, 0},
        {"group-length", 1, nullptr, 0}, // valid / create / remove
        {"preamble", 1, nullptr, 0}, // valid / create / remove
        {"padding", 1, nullptr, 0}, // valid (\0 -> space) / optimize (at most 1 byte of padding)
        {"vr", 1, nullptr, 0}, // valid
        {"sop", 1, nullptr, 0}, // default to SC...
        {"iod", 1, nullptr, 0}, // valid
        {"meta", 1, nullptr, 0}, // valid / create / remove
        {"dataset", 1, nullptr, 0}, // valid / create / remove?
        {"sequence", 1, nullptr, 0}, // defined / undefined
        {"deflate", 1, nullptr, 0}, // 1 - 9 / best = 9 / fast = 1
        {"tag", 1, nullptr, 0}, // need to specify a tag xxxx,yyyy = value to override default
        {"name", 1, nullptr, 0}, // same as tag but explicit use of name
        {"root-uid", 1, &rootuid, 1}, // specific Root (not GDCM)
        {"check-meta", 0, &checkmeta, 1}, // specific Root (not GDCM)
// Image specific options:
        {"pixeldata", 1, 0, 0}, // valid
        {"pixeldata", 1, nullptr, 0}, // valid
        {"apply-lut", 0, &lut, 1}, // default (implicit VR, LE) / Explicit LE / Explicit BE
        {"raw", 0, &raw, 1}, // default (implicit VR, LE) / Explicit LE / Explicit BE
        {"deflated", 0, &deflated, 1}, // DeflatedExplicitVRLittleEndian
@@ -517,8 +519,8 @@ int main (int argc, char *argv[])
        {"jpegls", 0, &jpegls, 1}, // JPEG-LS: lossy / lossless
        {"j2k", 0, &j2k, 1}, // J2K: lossy / lossless
        {"rle", 0, &rle, 1}, // lossless !
        {"mpeg2", 0, 0, 0}, // lossy !
        {"jpip", 0, 0, 0}, // ??
        {"mpeg2", 0, nullptr, 0}, // lossy !
        {"jpip", 0, nullptr, 0}, // ??
        {"split", 1, &split, 1}, // split fragments
        {"planar-configuration", 1, &planarconf, 1}, // Planar Configuration
        {"explicit", 0, &explicitts, 1}, //
@@ -534,6 +536,7 @@ int main (int argc, char *argv[])
        {"photometric-interpretation", 1, &photometricinterpretation, 1}, //
        {"with-private-dict", 0, &changeprivatetags, 1}, //
        {"decompress-lut", 0, &decompress_lut, 1}, // linearized segmented LUT
        {"apply-lut8", 0, &lut8, 1},
// j2k :
        {"rate", 1, &rate, 1}, //
        {"quality", 1, &quality, 1}, // will also work for regular jpeg compressor
@@ -552,10 +555,10 @@ int main (int argc, char *argv[])
        {"ignore-errors", 0, &ignoreerrors, 1},
        {"quiet", 0, &quiet, 1},

        {0, 0, 0, 0}
        {nullptr, 0, nullptr, 0}
    };

    c = getopt_long (argc, argv, "i:o:XMUClwdJKLRFYS:P:VWDEhvIr:q:t:n:e:",
    c = getopt_long (argc, argv, "i:o:XMUCl8wdJKLRFYS:P:VWDEhvIr:q:t:n:e:",
      long_options, &option_index);
    if (c == -1)
      {
@@ -673,6 +676,11 @@ int main (int argc, char *argv[])
      lut = 1;
      break;

    case '8':
      lut8 = 1;
      break;


    case 'w':
      raw = 1;
      break;
@@ -785,7 +793,7 @@ int main (int argc, char *argv[])
    while (optind < argc)
      {
      //printf ("%s\n", argv[optind++]);
      files.push_back( argv[optind++] );
      files.emplace_back(argv[optind++] );
      }
    //printf ("\n");
    if( files.size() == 2
@@ -1097,7 +1105,7 @@ int main (int argc, char *argv[])
      return 1;
      }
  }
  else if( lut )
  else if( lut || lut8 )
    {
    gdcm::PixmapReader reader;
    reader.SetFileName( filename.c_str() );
@@ -1110,6 +1118,7 @@ int main (int argc, char *argv[])

    gdcm::ImageApplyLookupTable lutfilt;
    lutfilt.SetInput( image );
    lutfilt.SetRGB8( lut8 != 0 );
    bool b = lutfilt.Apply();
    if( !b )
      {
Loading