Skip to content
Commits on Source (5)
......@@ -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
......
subdirs(Cxx)
add_subdirectory(Cxx)
......@@ -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(
......
......@@ -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();
......
......@@ -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 )
{
......
......@@ -197,7 +197,7 @@ static void display_element(std::ostream& os, const gdcm::DataElement& de,
}
else if (vr & gdcm::VR::VRASCII)
{
if (de.GetByteValue() != NULL)
if (de.GetByteValue() != nullptr)
{ // is this OK? it worked when de was a pointer, without the != NULL
gdcm::VL vl = de.GetByteValue()->GetLength();
// error: operands to ?: have different types 'gdcm::VL' and 'uint32_t'
......
......@@ -337,6 +337,67 @@ static int DumpTOSHIBA_MEC_CT3(const gdcm::DataSet & ds)
return 0;
}
static bool DumpToshibaDTI( const char * input, size_t len )
{
if( len % 2 ) return false;
std::vector<char> copy( input, input + len );
std::reverse( copy.begin(), copy.end() );
std::istringstream is;
std::string dup( &copy[0], copy.size() );
is.str( dup );
gdcm::File file;
gdcm::FileMetaInformation & fmi = file.GetHeader();
fmi.SetDataSetTransferSyntax( gdcm::TransferSyntax::ExplicitVRLittleEndian );
gdcm::DataSet & ds = file.GetDataSet();
ds.Read<gdcm::ExplicitDataElement,gdcm::SwapperNoOp>( is );
gdcm::Printer p;
p.SetFile( file );
p.SetColor( color != 0 );
p.Print( std::cout );
return true;
}
static int DumpTOSHIBA_PMTF_INFORMATION_DATA(const gdcm::DataSet & ds)
{
// (0029,0010) ?? (LO) [PMTF INFORMATION DATA ] # 22,1 Private Creator
// (0029,1001) ?? (SQ) (Sequence with undefined length) # u/l,1 ?
const gdcm::PrivateTag tpmtf(0x0029,0x1,"PMTF INFORMATION DATA");
if( !ds.FindDataElement( tpmtf) ) return 1;
const gdcm::DataElement& pmtf = ds.GetDataElement( tpmtf );
if ( pmtf.IsEmpty() ) return 1;
gdcm::SmartPointer<gdcm::SequenceOfItems> seq = pmtf.GetValueAsSQ();
if ( !seq || !seq->GetNumberOfItems() ) return 1;
size_t n = seq->GetNumberOfItems();
for( size_t i = 1; i <= n; ++i )
{
std::cout << "Item #" << i << std::endl;
gdcm::Item &item = seq->GetItem(i);
gdcm::DataSet &subds = item.GetNestedDataSet();
// (0029,0010) ?? (LO) [PMTF INFORMATION DATA ] # 22,1 Private Creator
// (0029,1090) ?? (OB) 00\05\00\13\00\12\00\22\ # 202,1 ?
const gdcm::PrivateTag tseq(0x0029,0x90,"PMTF INFORMATION DATA");
if( subds.FindDataElement( tseq ) )
{
const gdcm::DataElement & de = subds.GetDataElement( tseq );
const gdcm::ByteValue * bv = de.GetByteValue();
if( !bv ) return 1;
bool b = DumpToshibaDTI( bv->GetPointer(), bv->GetLength() );
if( !b ) return 1;
}
}
return 0;
}
// VEPRO
/*
[VIMDATA2]
......@@ -476,7 +537,7 @@ static bool ProcessData( const char *buf, size_t len )
static int DumpVEPRO(const gdcm::DataSet & ds)
{
// 01f7,1026
const gdcm::ByteValue *bv2 = NULL;
const gdcm::ByteValue *bv2 = nullptr;
const gdcm::PrivateTag tdata1(0x55,0x0020,"VEPRO VIF 3.0 DATA");
const gdcm::PrivateTag tdata2(0x55,0x0020,"VEPRO VIM 5.0 DATA");
// Prefer VIF over VIM ?
......@@ -790,6 +851,24 @@ static int PrintCT3(const std::string & filename, bool verbose)
return ret;
}
static int PrintPMTF(const std::string & filename, bool verbose)
{
(void)verbose;
gdcm::Reader reader;
reader.SetFileName( filename.c_str() );
if( !reader.Read() )
{
std::cerr << "Failed to read: " << filename << std::endl;
return 1;
}
const gdcm::DataSet& ds = reader.GetFile().GetDataSet();
int ret = cleanup::DumpTOSHIBA_PMTF_INFORMATION_DATA( ds );
return ret;
}
static int PrintPDB(const std::string & filename, bool verbose)
{
(void)verbose;
......@@ -1001,13 +1080,13 @@ static int PrintMrProtocol(const std::string & filename)
{
const gdcm::DataElement &shared = ds.GetDataElement( sfgs.GetTag() );
gdcm::SmartPointer<gdcm::SequenceOfItems> sqi = shared.GetValueAsSQ();
if( sqi != NULL && sqi->GetNumberOfItems() == 1 ) {
if( sqi != nullptr && sqi->GetNumberOfItems() == 1 ) {
gdcm::Item &item = sqi->GetItem(1);
gdcm::DataSet & subds = item.GetNestedDataSet();
if( subds.FindDataElement( att2) ) {
const gdcm::DataElement &privsq = subds.GetDataElement( att2 );
gdcm::SmartPointer<gdcm::SequenceOfItems> sqi2 = privsq.GetValueAsSQ();
if( sqi2 != NULL && sqi2->GetNumberOfItems() == 1 ) {
if( sqi2 != nullptr && sqi2->GetNumberOfItems() == 1 ) {
gdcm::Item &item2 = sqi2->GetItem(1);
gdcm::DataSet & subds2 = item2.GetNestedDataSet();
if( subds2.FindDataElement( att1) ) {
......@@ -1061,6 +1140,7 @@ static void PrintHelp()
std::cout << " or VEPRO Protocol Information (0055,20,VEPRO VIM 5.0 DATA)." << std::endl;
std::cout << " --sds print Philips MR Series Data Storage (1.3.46.670589.11.0.0.12.2) Information (2005,32,Philips MR Imaging DD 002)." << std::endl;
std::cout << " --ct3 print CT Private Data 2 (7005,10,TOSHIBA_MEC_CT3)." << std::endl;
std::cout << " --pmtf print PMTF INFORMATION DATA sub-sequences (0029,01,PMTF INFORMATION DATA)." << std::endl;
std::cout << " -A --asn1 print encapsulated ASN1 structure >(0400,0520)." << std::endl;
std::cout << " --map-uid-names map UID to names." << std::endl;
std::cout << "General Options:" << std::endl;
......@@ -1093,6 +1173,7 @@ int main (int argc, char *argv[])
int printvepro = 0;
int printsds = 0; // MR Series Data Storage
int printct3 = 0; // TOSHIBA_MEC_CT3
int printpmtf = 0; // TOSHIBA / PMTF INFORMATION DATA
int verbose = 0;
int warning = 0;
int debug = 0;
......@@ -1102,7 +1183,7 @@ int main (int argc, char *argv[])
int recursive = 0;
int printasn1 = 0;
int mapuidnames = 0;
while (1) {
while (true) {
//int this_option_optind = optind ? optind : 1;
int option_index = 0;
/*
......@@ -1114,7 +1195,7 @@ int main (int argc, char *argv[])
};
*/
static struct option long_options[] = {
{"input", 1, 0, 0},
{"input", 1, nullptr, 0},
{"xml-dict", 0, &printdict, 1},
{"recursive", 0, &recursive, 1},
{"print", 0, &print, 1},
......@@ -1138,7 +1219,8 @@ int main (int argc, char *argv[])
{"csa-asl", 0, &printcsaasl, 1},
{"csa-diffusion", 0, &printcsadiffusion, 1},
{"mrprotocol", 0, &printmrprotocol, 1},
{0, 0, 0, 0} // required
{"pmtf", 0, &printpmtf, 1},
{nullptr, 0, nullptr, 0} // required
};
static const char short_options[] = "i:xrpdcCPAVWDEhvI";
c = getopt_long (argc, argv, short_options,
......@@ -1309,7 +1391,7 @@ int main (int argc, char *argv[])
std::cerr << "Not handled for now" << std::endl;
}
const char * csaname = NULL;
const char * csaname = nullptr;
if( printcsaasl )
{
printcsabase64 = 1;
......@@ -1355,6 +1437,10 @@ int main (int argc, char *argv[])
{
res += PrintCT3(*it, verbose!= 0);
}
else if( printpmtf )
{
res += PrintPMTF(*it, verbose!= 0);
}
else if( printelscint )
{
res += PrintELSCINT(*it, verbose!= 0);
......@@ -1410,6 +1496,10 @@ int main (int argc, char *argv[])
{
res += PrintCT3(filename, verbose!= 0);
}
else if( printpmtf )
{
res += PrintPMTF(filename, verbose!= 0);
}
else if( printelscint )
{
res += PrintELSCINT(filename, verbose!= 0);
......
......@@ -76,11 +76,11 @@ int main(int argc, char *argv[])
int descriptor = 0;
std::string descriptor_str;
std::string root;
while (1) {
while (true) {
int option_index = 0;
static struct option long_options[] = {
{"input", 1, 0, 0},
{"output", 1, 0, 0}, // o
{"input", 1, nullptr, 0},
{"output", 1, nullptr, 0}, // o
{"recursive", 0, &recursive, 1},
{"root-uid", 1, &rootuid, 1}, // specific Root (not GDCM)
{"resources-path", 1, &resourcespath, 1},
......@@ -92,7 +92,7 @@ int main(int argc, char *argv[])
{"error", 0, &error, 1},
{"help", 0, &help, 1},
{"version", 0, &version, 1},
{0, 0, 0, 0} // required
{nullptr, 0, nullptr, 0} // required
};
static const char short_options[] = "i:o:rVWDEhv";
c = getopt_long (argc, argv, short_options,
......@@ -200,7 +200,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
......
......@@ -460,15 +460,15 @@ int main (int argc, char *argv[])
// Too early for UID Generation
std::string series_uid; // = uid.Generate();
std::string study_uid; // = uid.Generate();
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},
{"input", 1, nullptr, 0},
{"output", 1, nullptr, 0},
// provide convert-like command line args:
{"depth", 1, &depth, 1},
{"size", 1, 0, 0},
{"size", 1, nullptr, 0},
{"region", 1, &bregion, 1},
{"fill", 1, &fill, 1},
{"study-uid", 1, &studyuid, 1},
......@@ -492,7 +492,7 @@ int main (int argc, char *argv[])
{"error", 0, &error, 1},
{"help", 0, &help, 1},
{"version", 0, &version, 1},
{0, 0, 0, 0}
{nullptr, 0, nullptr, 0}
};
// i -> input file
......@@ -696,7 +696,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
......
......@@ -105,22 +105,22 @@ static int checkdeflated(const char *name)
return 1;
}
in = fopen(name, "r");
if (in == NULL)
if (in == nullptr)
{
fprintf( stderr, "in is NULL\n" );
return 1;
}
buf = (unsigned char*)malloc(size);
if (buf != NULL && (size1 = (unsigned long)fread(buf, 1, size, in)) != size) {
if (buf != nullptr && (size1 = (unsigned long)fread(buf, 1, size, in)) != size) {
free(buf);
buf = NULL;
buf = nullptr;
fprintf( stderr, "could not fread: %lu bytes != %lu\n", size, size1 );
fprintf( stderr, "feof: %i ferror %i\n", feof(in), ferror(in) );
}
fclose(in);
len = size;
source = buf;
if( source == NULL ) {
if( source == nullptr ) {
fprintf( stderr, "source is NULL\n" );
return 1;
}
......@@ -172,7 +172,7 @@ static int checkdeflated(const char *name)
printf( "deflate stream has proper length: %lu\n", len );
}
ret = puff(NULL, &destlen, source, &sourcelen);
ret = puff(nullptr, &destlen, source, &sourcelen);
if (ret)
fprintf(stdout,"puff() failed with return code %d\n", ret);
......@@ -202,7 +202,11 @@ static std::string getInfoDate(Dict *infoDict, const char *key)
#endif
{
const GooString* gs = obj.getString();
#ifdef LIBPOPPLER_GOOSTRING_HAS_GETCSTRING
s = gs->getCString();
#else
s = gs->c_str();
#endif
if (s[0] == 'D' && s[1] == ':')
{
s += 2;
......@@ -257,7 +261,11 @@ static std::string getInfoDate(Dict *infoDict, const char *key)
static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uMap)
{
Object obj;
#ifdef LIBPOPPLER_GOOSTRING_HAS_CONSTGETCHAR
const GooString *s1;
#else
GooString *s1;
#endif
bool isUnicode;
Unicode u;
char buf[8];
......@@ -400,7 +408,7 @@ static int ProcessOneFile( std::string const & filename, gdcm::Defs const & defs
return 1;
}
gdcm::SplitMosaicFilter filter;
const gdcm::Image *pimage = NULL;
const gdcm::Image *pimage = nullptr;
const gdcm::Image &image = reader.GetImage();
if( mosaic )
{
......@@ -608,10 +616,10 @@ int main(int argc, char *argv[])
int version = 0;
int debug = 0;
int error = 0;
while (1) {
while (true) {
int option_index = 0;
static struct option long_options[] = {
{"input", 1, 0, 0},
{"input", 1, nullptr, 0},
{"recursive", 0, &recursive, 1},
{"check-deflated", 0, &deflated, 1},
{"resources-path", 0, &resourcespath, 1},
......@@ -627,7 +635,7 @@ int main(int argc, char *argv[])
{"error", 0, &error, 1},
{"help", 0, &help, 1},
{"version", 0, &version, 1},
{0, 0, 0, 0} // required
{nullptr, 0, nullptr, 0} // required
};
static const char short_options[] = "i:rdVWDEhv";
c = getopt_long (argc, argv, short_options,
......
......@@ -193,11 +193,11 @@ int main(int argc, char *argv[])
int help = 0;
int version = 0;
while (1) {
while (true) {
int option_index = 0;
static struct option long_options[] = {
{"input", 1, 0, 0},
{"output", 1, 0, 0},
{"input", 1, nullptr, 0},
{"output", 1, nullptr, 0},
{"root-uid", 1, &rootuid, 1}, // specific Root (not GDCM)
{"split", 0, &split, 1},
{"decomp-pap3", 0, &decomp_pap3, 1},
......@@ -211,7 +211,7 @@ int main(int argc, char *argv[])
{"help", 0, &help, 1},
{"version", 0, &version, 1},
{0, 0, 0, 0}
{nullptr, 0, nullptr, 0}
};
c = getopt_long (argc, argv, "i:o:S:VWDEhv",
......@@ -310,7 +310,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
......
......@@ -50,7 +50,11 @@ static std::string getInfoDate(Dict *infoDict, const char *key)
#endif
{
const GooString* gs = obj.getString();
#ifdef LIBPOPPLER_GOOSTRING_HAS_GETCSTRING
s = gs->getCString();
#else
s = gs->c_str();
#endif
if (s[0] == 'D' && s[1] == ':')
{
s += 2;
......@@ -105,7 +109,11 @@ static std::string getInfoDate(Dict *infoDict, const char *key)
static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uMap, bool & unicode)
{
Object obj;
#ifdef LIBPOPPLER_GOOSTRING_HAS_CONSTGETCHAR
const GooString *s1;
#else
GooString *s1;
#endif
bool isUnicode = false;
Unicode u;
char buf[8];
......
......@@ -90,13 +90,13 @@ int main(int argc, char *argv[])
int error = 0;
int help = 0;
int version = 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}, // i
{"output", 1, 0, 0}, // o
{"tag", 1, 0, 0}, // t
{"input", 1, nullptr, 0}, // i
{"output", 1, nullptr, 0}, // o
{"tag", 1, nullptr, 0}, // t
{"split-frags", 0, &splitfrags, 1}, // f
/*
* pixel-data flag is important for image like DermaColorLossLess.dcm since the bytevalue is
......@@ -105,7 +105,7 @@ int main(int argc, char *argv[])
* would expect
*/
{"pixel-data", 0, &pixeldata, 1}, // P
{"pattern", 1, 0, 0}, // p
{"pattern", 1, nullptr, 0}, // p
{"verbose", 0, &verbose, 1},
{"warning", 0, &warning, 1},
......@@ -114,7 +114,7 @@ int main(int argc, char *argv[])
{"help", 0, &help, 1},
{"version", 0, &version, 1},
{0, 0, 0, 0}
{nullptr, 0, nullptr, 0}
};
c = getopt_long (argc, argv, "i:o:t:Sp:PVWDEhv",
......@@ -224,7 +224,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
......
......@@ -123,15 +123,15 @@ int main(int argc, char *argv[])
int help = 0;
int version = 0;
while (1) {
while (true) {
//int this_option_optind = optind ? optind : 1;
int option_index = 0;
static struct option long_options[] = {
{"dir", 1, 0, 0},
{"tag", 1, 0, 0},
{"recursive", 1, 0, 0},
{"print", 1, 0, 0},
{"private-tag", 1, 0, 0},
{"dir", 1, nullptr, 0},
{"tag", 1, nullptr, 0},
{"recursive", 1, nullptr, 0},
{"print", 1, nullptr, 0},
{"private-tag", 1, nullptr, 0},
{"strict", 0, &strict, 1},
// General options !
......@@ -142,7 +142,7 @@ int main(int argc, char *argv[])
{"help", 0, &help, 1},
{"version", 0, &version, 1},
{0, 0, 0, 0}
{nullptr, 0, nullptr, 0}
};
c = getopt_long (argc, argv, "d:t:rpP:VWDEhv",
......
......@@ -181,7 +181,7 @@ int main(int argc, char *argv[])
gdcm::Tag tag;
std::vector< std::pair<gdcm::Tag, std::string> > keys;
while (1) {
while (true) {
//int this_option_optind = optind ? optind : 1;
int option_index = 0;
/*
......@@ -199,16 +199,16 @@ int main(int argc, char *argv[])
{"error", 0, &error, 1},
{"help", 0, &help, 1},
{"version", 0, &version, 1},
{"hostname", 1, 0, 0}, // -h
{"aetitle", 1, 0, 0}, //
{"call", 1, 0, 0}, //
{"hostname", 1, nullptr, 0}, // -h
{"aetitle", 1, nullptr, 0}, //
{"call", 1, nullptr, 0}, //
{"port", 0, &port, 1}, // -p
{"input", 1, 0, 0}, // dcmfile-in
{"input", 1, nullptr, 0}, // dcmfile-in
{"echo", 0, &echomode, 1}, // --echo
{"store", 0, &storemode, 1}, // --store
{"find", 0, &findmode, 1}, // --find
{"move", 0, &movemode, 1}, // --move
{"key", 1, 0, 0}, // (15) --key
{"key", 1, nullptr, 0}, // (15) --key
{"worklist", 0, &findworklist, 1}, // --worklist
{"patientroot", 0, &findpatientroot, 1}, // --patientroot
{"studyroot", 0, &findstudyroot, 1}, // --studyroot
......@@ -224,7 +224,7 @@ int main(int argc, char *argv[])
{"image", 0, &imagequery, 1}, // --image
{"log-file", 1, &logfile, 1}, // --log-file
{"get", 0, &getmode, 1}, // --get
{0, 0, 0, 0} // required
{nullptr, 0, nullptr, 0} // required
};
static const char short_options[] = "i:H:p:L:VWDEhvk:o:r";
c = getopt_long (argc, argv, short_options,
......@@ -284,7 +284,7 @@ int main(int argc, char *argv[])
//ss >> str;
std::getline(ss, str); // do not skip whitespace
if( str.size() % 2 == 1 ) str += " ";
keys.push_back( std::make_pair(tag, str) );
keys.emplace_back(tag, str );
}
else if( option_index == 20 ) /* port-scp */
{
......@@ -339,7 +339,7 @@ int main(int argc, char *argv[])
assert( cdummy == ',' || cdummy == '=' );
std::string str;
std::getline(ss, str); // do not skip whitespace
keys.push_back( std::make_pair(tag, str) );
keys.emplace_back(tag, str );
}
break;
......@@ -426,7 +426,7 @@ int main(int argc, char *argv[])
std::vector<std::string> files;
while (optind < argc)
{
files.push_back( argv[optind++] );
files.emplace_back(argv[optind++] );
}
filenames = files;
}
......
......@@ -974,14 +974,14 @@ int main (int argc, char *argv[])
int version = 0;
std::string pattern;
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},
{"input", 1, nullptr, 0},
{"output", 1, nullptr, 0},
{"mosaic", 0, &mosaic, 1}, // split siemens mosaic into multiple frames
{"pattern", 1, 0, 0}, // p
{"pattern", 1, nullptr, 0}, // p
{"enhance", 0, &enhance, 1}, // unenhance
{"unenhance", 0, &unenhance, 1}, // unenhance
{"root-uid", 1, &rootuid, 1}, // specific Root (not GDCM)
......@@ -996,7 +996,7 @@ int main (int argc, char *argv[])
{"help", 0, &help, 1},
{"version", 0, &version, 1},
{0, 0, 0, 0}
{nullptr, 0, nullptr, 0}
};
c = getopt_long (argc, argv, "i:o:MUp:VWDEhv",
......@@ -1115,7 +1115,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
......
......@@ -56,7 +56,7 @@ class SimpleFileXMLPrinter : public XMLPrinter
{
public:
void HandleBulkData(const char *uuid, const TransferSyntax & ts,
const char *bulkdata, size_t bulklen)
const char *bulkdata, size_t bulklen) override
{
// Store Bulk Data
std::ofstream out( uuid, std::ios::binary );
......@@ -702,13 +702,13 @@ int main (int argc, char *argv[])
int error = 0;
int help = 0;
int version = 0;
while (1) {
while (true) {
int option_index = 0;
static struct option long_options[] = {
{"input", 1, 0, 0},
{"output", 1, 0, 0},
{"input", 1, nullptr, 0},
{"output", 1, nullptr, 0},
{"loadBulkData", 0, &loadBulkData, 1},
{"TransferSyntax", 0, &loadTransferSyntax, 1},
{"verbose", 0, &verbose, 1},
......@@ -717,7 +717,7 @@ int main (int argc, char *argv[])
{"error", 0, &error, 1},
{"help", 0, &help, 1},
{"version", 0, &version, 1},
{0, 0, 0, 0} // required
{nullptr, 0, nullptr, 0} // required
};
static const char short_options[] = "i:o:BTVWDEhv";
c = getopt_long (argc, argv, short_options,
......
# Copyright (c) 2006-2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# Make sure to not use FindJNI anymore and prefer FindJavaProperties
find_package(JavaProperties REQUIRED)
find_path(JAVA_INCLUDE_PATH jni.h
${JavaProp_JAVA_HOME}/../include
)
string(TOLOWER ${JavaProp_OS_NAME} include_os_name) # Linux -> linux
set(JAVA_JNI_MD_INCLUDE_DIRECTORIES
${JAVA_INCLUDE_PATH}/${include_os_name}
${JAVA_INCLUDE_PATH}/win32 # win32
${JAVA_INCLUDE_PATH}/linux # kFreeBSD
${JAVA_INCLUDE_PATH}/solaris # SunOS
)
find_path(JAVA_INCLUDE_PATH2 jni_md.h
${JAVA_JNI_MD_INCLUDE_DIRECTORIES}
)
find_path(JAVA_AWT_INCLUDE_PATH jawt.h
${JAVA_INCLUDE_PATH}
)
set(JAVA_AWT_LIBRARY_DIRECTORIES
${JavaProp_SUN_BOOT_LIBRARY_PATH} # works for linux
${JavaProp_JAVA_HOME}/../lib # works for win32
)
foreach(dir ${JAVA_AWT_LIBRARY_DIRECTORIES})
set(JAVA_JVM_LIBRARY_DIRECTORIES
${JAVA_JVM_LIBRARY_DIRECTORIES}
"${dir}"
"${dir}/client"
"${dir}/server"
)
endforeach()
find_library(JAVA_AWT_LIBRARY NAMES jawt
PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES}
)
find_library(JAVA_JVM_LIBRARY NAMES jvm JavaVM
PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES}
)
# on linux I get this annoying error:
# Exception in thread "main" java.lang.UnsatisfiedLinkError: libvtkgdcmJava.so:
# libmawt.so: cannot open shared object file: No such file or directory
# let's find this lib here then
if(UNIX)
find_library(JAVA_MAWT_LIBRARY NAMES mawt
# there is one also in headless but it does not work...
PATHS ${JavaProp_SUN_BOOT_LIBRARY_PATH}/xawt
)
endif()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI DEFAULT_MSG JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
mark_as_advanced(
JAVA_AWT_LIBRARY
JAVA_MAWT_LIBRARY
JAVA_JVM_LIBRARY
JAVA_AWT_INCLUDE_PATH
JAVA_INCLUDE_PATH
JAVA_INCLUDE_PATH2
)
set(JNI_LIBRARIES
${JAVA_AWT_LIBRARY}
${JAVA_JVM_LIBRARY}
)
set(JNI_INCLUDE_DIRS
${JAVA_INCLUDE_PATH}
${JAVA_INCLUDE_PATH2}
${JAVA_AWT_INCLUDE_PATH}
)
......@@ -24,7 +24,7 @@ macro(install_swig_module module_name module_type)
set(MODDIR GDCM_INSTALL_${MODTYPE}_DIR)
# if user sets a GDCM_INSTALL_PYTHONMODULE_DIR
if(${MODDIR})
SET(MODDST "${${MODDIR}}")
set(MODDST "${${MODDIR}}")
endif()
if(NOT GDCM_INSTALL_NO_LIBRARIES)
install(TARGETS ${SWIG_MODULE_${module_name}_REAL_NAME}
......
cmake_minimum_required(VERSION 2.8.7)
if(POLICY CMP0022)
cmake_policy(SET CMP0022 NEW)
endif()
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif()
if(POLICY CMP0026)
cmake_policy(SET CMP0026 NEW)
endif()
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
if( POLICY CMP0063 )
cmake_policy(SET CMP0063 NEW)
cmake_minimum_required(VERSION 3.9.2 FATAL_ERROR)
set(GDCM_MAX_VALIDATED_CMAKE_VERSION "3.13.1")
if("${CMAKE_VERSION}" VERSION_LESS_EQUAL "${GDCM_MAX_VALIDATED_CMAKE_VERSION}")
# As of 2018-12-04 GDCM has been validated to build with cmake version 3.13.1 new policies.
# Set and use the newest cmake policies that are validated to work
set(GDCM_CMAKE_POLICY_VERSION "${CMAKE_VERSION}")
else()
set(GDCM_CMAKE_POLICY_VERSION "${GDCM_MAX_VALIDATED_CMAKE_VERSION}")
endif()
if( POLICY CMP0074 )
cmake_policy(SET CMP0074 NEW)
cmake_policy(VERSION ${GDCM_CMAKE_POLICY_VERSION})
# GDCM version 3.0.0 will only support C++11 and greater
if(CMAKE_CXX_STANDARD EQUAL "98" )
message(FATAL_ERROR "CMAKE_CXX_STANDARD:STRING=98 is not supported in GDCM version 3.0.0 and greater.")
endif()
project(GDCM)
set(CMAKE_CXX_STANDARD 98)
set(CMAKE_CXX_EXTENSIONS OFF)
#----------------------------------------------------------------------------
project(GDCM
VERSION 3.0.0
LANGUAGES CXX C
)
## NOTE: the "DESCRIPTION" feature of project() was introduced in cmake 3.10.0
set(PROJECT_DESCRIPTION "GDCM - Grassroots DICOM. GDCM is yet another DICOM library.")
## Set aliases for backwards compatibility. GDCM_VERSION_XXX are configured by the project() command
set(GDCM_MAJOR_VERSION ${GDCM_VERSION_MAJOR})
set(GDCM_MINOR_VERSION ${GDCM_VERSION_MINOR})
set(GDCM_BUILD_VERSION ${GDCM_VERSION_PATCH})
set(GDCM_VERSION "${GDCM_VERSION_MAJOR}.${GDCM_VERSION_MINOR}.${GDCM_VERSION_PATCH}") # ${GDCM_VERSION_TWEAK}
mark_as_advanced(CMAKE_BACKWARDS_COMPATIBILITY CMAKE_BUILD_TYPE CMAKE_INSTALL_PREFIX)
set(GDCM_CMAKE_DIR "${GDCM_SOURCE_DIR}/CMake" CACHE INTERNAL "")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${GDCM_CMAKE_DIR}")
set(GDCM_PACKAGE_DESCRIPTION_SUMMARY "GDCM - Grassroots DICOM. GDCM is yet another DICOM library.")
set(GDCM_PACKAGE_DESCRIPTION_SUMMARY ${PROJECT_DESCRIPTION})
set(GDCM_PACKAGE_CONTACT "GDCM Developers <gdcm-developers@lists.sourceforge.net>")
# TODO
......@@ -40,22 +49,16 @@ set(GDCM_PACKAGE_CONTACT "GDCM Developers <gdcm-developers@lists.sourceforge.net
# See the CVS version of files in VTK/GUISupport/MFC for details. Or grep the
# VTK source tree for "DELAYLOAD"
#----------------------------------------------------------------------------
set(GDCM_MAJOR_VERSION 2)
set(GDCM_MINOR_VERSION 8)
set(GDCM_BUILD_VERSION 9)
set(GDCM_VERSION
"${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
# let advanced user the option to define GDCM_API_VERSION:
if(NOT DEFINED GDCM_API_VERSION)
set(GDCM_API_VERSION "${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}")
set(GDCM_API_VERSION "${GDCM_VERSION_MAJOR}.${GDCM_VERSION_MINOR}")
endif()
set(GDCM_LIBRARY_PROPERTIES ${GDCM_LIBRARY_PROPERTIES}
VERSION "${GDCM_VERSION}"
SOVERSION "${GDCM_API_VERSION}"
)
#set(GDCM_EXECUTABLE_PROPERTIES ${GDCM_EXECUTABLE_PROPERTIES}
# VERSION "${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}"
# VERSION "${GDCM_VERSION_MAJOR}.${GDCM_VERSION_MINOR}"
#)
set(GDCM_EXECUTABLE_PROPERTIES)
if(GDCM_NO_EXECUTABLE_PROPERTIES)
......@@ -84,7 +87,7 @@ APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt)
APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/CMake/COPYING-CMAKE-SCRIPTS)
#-----------------------------------------------------------------------------
if(GDCM_MINOR_VERSION MATCHES "[02468]$")
if(GDCM_VERSION_MINOR MATCHES "[02468]$")
# Are we building a release branch / tag (read: even number)?
# By default dashboard are expected to run with Design by Contract on
# to trigger any of the assert, but on the other hand no user really
......@@ -119,13 +122,8 @@ else()
endif()
if(BUILD_SHARED_LIBS)
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.6)
set(NAMELINK_ONLY NAMELINK_ONLY)
set(NAMELINK_SKIP NAMELINK_SKIP)
else()
set(NAMELINK_ONLY)
set(NAMELINK_SKIP)
endif()
endif()
......@@ -205,7 +203,7 @@ if(NOT GDCM_HAVE_STDINT_H)
"${GDCM_SOURCE_DIR}/Utilities/C99"
)
# Process the install rules from C99
subdirs(Utilities/C99)
add_subdirectory(Utilities/C99)
endif()
endif()
......@@ -236,7 +234,7 @@ endif()
# Install directories
string(TOLOWER ${PROJECT_NAME} projectname)
set(subdir "${projectname}-${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}")
set(subdir "${projectname}-${GDCM_VERSION_MAJOR}.${GDCM_VERSION_MINOR}")
if(NOT GDCM_INSTALL_BIN_DIR)
set(GDCM_INSTALL_BIN_DIR "bin")
......@@ -368,7 +366,7 @@ else()
endif()
if(GDCM_USE_SYSTEM_CHARLS)
find_package(CharLS REQUIRED)
find_package(CharLS 2.0.0 REQUIRED)
set(GDCM_CHARLS_LIBRARIES ${CHARLS_LIBRARIES})
else()
set(GDCM_CHARLS_LIBRARIES gdcmcharls)
......@@ -595,18 +593,18 @@ if(GDCM_DOCUMENTATION)
endif()
endif()
# Need to subdirs in Source/Common before Wrapping
# Need to add_subdirectory in Source/Common before Wrapping
# to have gdcmConfigure.h around
if(GDCM_STANDALONE)
set(BUILD_APPLICATIONS ${GDCM_BUILD_APPLICATIONS})
else()
set(BUILD_APPLICATIONS OFF)
endif()
subdirs(Utilities)
add_subdirectory(Utilities)
add_subdirectory(Source)
if(GDCM_STANDALONE)
subdirs(Wrapping)
add_subdirectory(Wrapping)
if(GDCM_WRAP_CSHARP)
add_subdirectory(Wrapping/Csharp)
endif()
......@@ -615,27 +613,10 @@ endif()
if(GDCM_STANDALONE)
# After Wrapping please
if(BUILD_EXAMPLES)
subdirs(Examples)
add_subdirectory(Examples)
endif()
endif()
#-----------------------------------------------------------------------------
# Special CMake Module required when doing Python Testing
if(GDCM_STANDALONE)
if(BUILD_TESTING AND GDCM_WRAP_PYTHON)
include(${GDCM_SOURCE_DIR}/CMake/UsePythonTest.cmake)
endif()
# Special CMake Module required when doing C# Testing
if(BUILD_TESTING AND GDCM_WRAP_CSHARP)
include(${GDCM_SOURCE_DIR}/CMake/UseCSharpTest.cmake)
endif()
# Special CMake Module required when doing Java Testing
if(BUILD_TESTING AND GDCM_WRAP_JAVA)
include(${GDCM_SOURCE_DIR}/CMake/UseJavaTest.cmake)
endif()
endif()
#-----------------------------------------------------------------------------
# Need pthread for the following class:
CHECK_INCLUDE_FILE("pthread.h" GDCM_HAVE_PTHREAD_H)
......@@ -655,7 +636,7 @@ if(GDCM_STANDALONE)
mark_as_advanced(DART_TESTING_TIMEOUT)
enable_testing()
include(CTest)
subdirs(Testing)
add_subdirectory(Testing)
if(NOT GDCM_DATA_ROOT)
message("If you want to build the test suite, you must set GDCM_DATA_ROOT (advanced option) "
"to the full path name of the gdcmData directory; if you don't want, disable GDCM_BUILD_TESTING.\n"
......@@ -687,7 +668,7 @@ if(GDCM_STANDALONE)
mark_as_advanced(VTK_DIR)
set(GDCM_VTK_DIR ${VTK_DIR})
mark_as_advanced(GDCM_USE_PARAVIEW)
subdirs(Utilities/VTK)
add_subdirectory(Utilities/VTK)
endif()
endif()
......@@ -696,7 +677,7 @@ if(GDCM_STANDALONE)
option(GDCM_BUILD_APPLICATIONS "apps ?" OFF)
set(BUILD_APPLICATIONS ${GDCM_BUILD_APPLICATIONS})
if(BUILD_APPLICATIONS)
subdirs(Applications)
add_subdirectory(Applications)
endif()
else()
set(BUILD_APPLICATIONS OFF)
......@@ -726,9 +707,9 @@ if(GDCM_STANDALONE) # disabled for ITK distribution of gdcm
set(CPACK_PACKAGE_VENDOR "GDCM")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_BINARY_DIR}/Copyright.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/Copyright.txt")
set(CPACK_PACKAGE_VERSION_MAJOR "${GDCM_MAJOR_VERSION}")
set(CPACK_PACKAGE_VERSION_MINOR "${GDCM_MINOR_VERSION}")
set(CPACK_PACKAGE_VERSION_PATCH "${GDCM_BUILD_VERSION}")
set(CPACK_PACKAGE_VERSION_MAJOR "${GDCM_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${GDCM_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${GDCM_VERSION_PATCH}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "GDCM ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "gdcm-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
......@@ -1051,5 +1032,5 @@ if(GDCM_USE_VTK)
endif()
set(GDCM_LIBRARY_DIRS ${LIBRARY_OUTPUT_PATH})
if(GDCM_STANDALONE)
subdirs(CMake/ExportConfiguration)
add_subdirectory(CMake/ExportConfiguration)
endif()