This is an automated email from the git hooks/post-receive script. gewo pushed a commit to branch master in repository gdcm.
commit 202f6145d855b5d6fdee4edc74394036e309c2ca Author: Gert Wollny <g...@debian.org> Date: Wed Oct 4 14:11:56 2017 +0000 New upstream version 2.8.3 --- Applications/Cxx/CMakeLists.txt | 6 + Applications/Cxx/gdcmdump.cxx | 48 ++- Applications/Cxx/gdcminfo.cxx | 22 ++ Applications/Cxx/gdcmpdf.cxx | 20 ++ Applications/Cxx/gdcmtar.cxx | 14 +- CMake/CTestCustom.ctest.in | 2 + CMake/InstallMacros.cmake | 40 +-- CMakeLists.txt | 11 +- Examples/Cxx/CMakeLists.txt | 1 + Examples/Cxx/ReadAndDumpDICOMDIR2.cxx | 393 +++++++++++++++++++++ Examples/Python/DecompressImage.py | 11 +- Source/Common/CMakeLists.txt | 16 +- Source/Common/gdcmConfigure.h.in | 3 + Source/Common/gdcmSwapper.txx | 8 +- Source/Common/gdcmSystem.cxx | 8 +- Source/DataDictionary/CMakeLists.txt | 4 +- Source/DataDictionary/gdcmPrivateDefaultDicts.cxx | 86 +++++ .../CMakeLists.txt | 8 +- .../gdcmCSAHeader.h | 8 +- .../gdcmMrProtocol.cxx | 12 + Source/InformationObjectDefinition/CMakeLists.txt | 7 +- Source/MediaStorageAndFileFormat/CMakeLists.txt | 15 +- .../MediaStorageAndFileFormat/gdcmDictPrinter.cxx | 33 +- Source/MediaStorageAndFileFormat/gdcmIPPSorter.cxx | 13 +- .../MediaStorageAndFileFormat/gdcmImageHelper.cxx | 1 + Source/MediaStorageAndFileFormat/gdcmPrinter.cxx | 2 +- Source/MediaStorageAndFileFormat/gdcmPrinter.h | 3 +- .../MediaStorageAndFileFormat/gdcmStringFilter.cxx | 4 +- Source/MessageExchangeDefinition/CMakeLists.txt | 10 +- Testing/Source/Data/CMakeLists.txt | 2 + Utilities/VTK/CMakeLists.txt | 28 +- Utilities/doxygen/man/gdcmdump.xml | 3 +- Utilities/doxygen/man/gdcmtar.xml | 14 +- Wrapping/Csharp/CMakeLists.txt | 3 + Wrapping/Python/gdcmswig.i | 2 +- 35 files changed, 738 insertions(+), 123 deletions(-) diff --git a/Applications/Cxx/CMakeLists.txt b/Applications/Cxx/CMakeLists.txt index 9b42682..2843fd5 100644 --- a/Applications/Cxx/CMakeLists.txt +++ b/Applications/Cxx/CMakeLists.txt @@ -84,6 +84,12 @@ if(GDCM_USE_SYSTEM_POPPLER) if(LIBPOPPLER_CATALOG_HAS_STRUCTTREEROOT) list(APPEND libpoppler_flags -DLIBPOPPLER_CATALOG_HAS_STRUCTTREEROOT) endif() + CHECK_CXX_SOURCE_COMPILES( + "\#include <poppler/Object.h>\nint main() { Object o(42); }" + LIBPOPPLER_NEW_OBJECT_API) +if(LIBPOPPLER_NEW_OBJECT_API) + list(APPEND libpoppler_flags -DLIBPOPPLER_NEW_OBJECT_API) + endif() if(libpoppler_flags) string(REPLACE ";" " " libpoppler_flags_string "${libpoppler_flags}") set_source_files_properties( diff --git a/Applications/Cxx/gdcmdump.cxx b/Applications/Cxx/gdcmdump.cxx index 24a6176..8e37cbf 100644 --- a/Applications/Cxx/gdcmdump.cxx +++ b/Applications/Cxx/gdcmdump.cxx @@ -49,6 +49,7 @@ #include "gdcmASN1.h" #include "gdcmAttribute.h" #include "gdcmBase64.h" +#include "gdcmTagKeywords.h" #include <string> #include <iostream> @@ -977,16 +978,55 @@ static int PrintMrProtocol(const std::string & filename) gdcm::CSAHeader csa; const gdcm::DataSet& ds = reader.GetFile().GetDataSet(); gdcm::MrProtocol mrprot; + const gdcm::PrivateTag att1(0x21,0x19,"SIEMENS MR SDS 01"); + const gdcm::PrivateTag att2(0x21,0xfe,"SIEMENS MR SDS 01"); + bool found = false; + namespace kwd = gdcm::Keywords; + kwd::SharedFunctionalGroupsSequence sfgs; if( csa.GetMrProtocol(ds, mrprot)) { - std::cout << mrprot; + found = true; } - else + else if( ds.FindDataElement( att1) ) { - std::cout << "Could not find MrProtocol/MrPhoenixProtocol ASCII section" << std::endl; + const gdcm::DataElement &data = ds.GetDataElement( att1 ); + const gdcm::ByteValue *bv = data.GetByteValue(); + static const char csastr[] = "PhoenixMetaProtocol"; // FIXME + if( mrprot.Load( bv, csastr, -1)) + found = true; + } + // SIEMENS now supports Enhanced MR + else if( ds.FindDataElement( sfgs.GetTag() ) ) + { + const gdcm::DataElement &shared = ds.GetDataElement( sfgs.GetTag() ); + gdcm::SmartPointer<gdcm::SequenceOfItems> sqi = shared.GetValueAsSQ(); + if( sqi != NULL && 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 ) { + gdcm::Item &item2 = sqi2->GetItem(1); + gdcm::DataSet & subds2 = item2.GetNestedDataSet(); + if( subds2.FindDataElement( att1) ) { + const gdcm::DataElement &data = subds2.GetDataElement( att1 ); + const gdcm::ByteValue *bv = data.GetByteValue(); + static const char csastr[] = "PhoenixMetaProtocol"; // FIXME + if( mrprot.Load( bv, csastr, -1)) + found = true; + } + } + } + } } - return 0; + if( found ) + std::cout << mrprot; + else + std::cerr << "Could not find MrProtocol/MrPhoenixProtocol ASCII section" << std::endl; + + return found ? 0 : 1; } diff --git a/Applications/Cxx/gdcminfo.cxx b/Applications/Cxx/gdcminfo.cxx index bf8b013..0143bf3 100644 --- a/Applications/Cxx/gdcminfo.cxx +++ b/Applications/Cxx/gdcminfo.cxx @@ -194,7 +194,11 @@ static std::string getInfoDate(Dict *infoDict, const char *key) //char buf[256]; std::string out; +#ifdef LIBPOPPLER_NEW_OBJECT_API + if ((obj = infoDict->lookup((char*)key)).isString()) +#else if (infoDict->lookup((char*)key, &obj)->isString()) +#endif { s = obj.getString()->getCString(); if (s[0] == 'D' && s[1] == ':') @@ -242,7 +246,9 @@ static std::string getInfoDate(Dict *infoDict, const char *key) out = date; } } +#ifndef LIBPOPPLER_NEW_OBJECT_API obj.free(); +#endif return out; } @@ -256,7 +262,11 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM int i, n; std::string out; +#ifdef LIBPOPPLER_NEW_OBJECT_API + if ((obj = infoDict->lookup((char*)key)).isString()) +#else if (infoDict->lookup((char*)key, &obj)->isString()) +#endif { s1 = obj.getString(); if ((s1->getChar(0) & 0xff) == 0xfe && @@ -288,7 +298,9 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM out.append( std::string(buf, n) ); } } +#ifndef LIBPOPPLER_NEW_OBJECT_API obj.free(); +#endif return out; } #endif @@ -452,7 +464,11 @@ static int ProcessOneFile( std::string const & filename, gdcm::Defs const & defs MemStream *appearStream; appearStream = new MemStream((char*)bv->GetPointer(), 0, +#ifdef LIBPOPPLER_NEW_OBJECT_API + bv->GetLength(), std::move(appearDict)); +#else bv->GetLength(), &appearDict); +#endif GooString *ownerPW, *userPW; ownerPW = NULL; userPW = NULL; @@ -480,7 +496,11 @@ static int ProcessOneFile( std::string const & filename, gdcm::Defs const & defs Object info; if (doc->isOk()) { +#ifdef LIBPOPPLER_NEW_OBJECT_API + info = doc->getDocInfo(); +#else doc->getDocInfo(&info); +#endif if (info.isDict()) { title = getInfoString(info.getDict(), "Title", uMap); @@ -491,7 +511,9 @@ static int ProcessOneFile( std::string const & filename, gdcm::Defs const & defs producer = getInfoString(info.getDict(), "Producer", uMap); creationdate = getInfoDate( info.getDict(), "CreationDate" ); moddate = getInfoDate( info.getDict(), "ModDate" ); +#ifndef LIBPOPPLER_NEW_OBJECT_API info.free(); +#endif } #ifdef LIBPOPPLER_CATALOG_HAS_STRUCTTREEROOT const char *tagged = doc->getStructTreeRoot() ? "yes" : "no"; diff --git a/Applications/Cxx/gdcmpdf.cxx b/Applications/Cxx/gdcmpdf.cxx index 4c7a7bb..92caad7 100644 --- a/Applications/Cxx/gdcmpdf.cxx +++ b/Applications/Cxx/gdcmpdf.cxx @@ -43,7 +43,11 @@ static std::string getInfoDate(Dict *infoDict, const char *key) //char buf[256]; std::string out; +#ifdef LIBPOPPLER_NEW_OBJECT_API + if ((obj = infoDict->lookup((char*)key)).isString()) +#else if (infoDict->lookup((char*)key, &obj)->isString()) +#endif { s = obj.getString()->getCString(); if (s[0] == 'D' && s[1] == ':') @@ -91,7 +95,9 @@ static std::string getInfoDate(Dict *infoDict, const char *key) out = date; } } +#ifndef LIBPOPPLER_NEW_OBJECT_API obj.free(); +#endif return out; } @@ -105,7 +111,11 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM int i, n; std::string out; +#ifdef LIBPOPPLER_NEW_OBJECT_API + if ((obj = infoDict->lookup((char*)key)).isString()) +#else if (infoDict->lookup((char*)key, &obj)->isString()) +#endif { s1 = obj.getString(); if ((s1->getChar(0) & 0xff) == 0xfe && @@ -137,7 +147,9 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM out.append( std::string(buf, n) ); } } +#ifndef LIBPOPPLER_NEW_OBJECT_API obj.free(); +#endif unicode = unicode || isUnicode; return out; } @@ -340,7 +352,9 @@ int main (int argc, char *argv[]) //ownerPW = new GooString( "toto" ); Object obj; +#ifndef LIBPOPPLER_NEW_OBJECT_API obj.initNull(); +#endif doc = new PDFDoc(fileName, ownerPW, userPW); if (doc->isEncrypted()) @@ -386,7 +400,11 @@ http://msdn.microsoft.com/en-us/library/078sfkak(VS.80).aspx GBool isUnicode = gFalse; if (doc->isOk()) { +#ifdef LIBPOPPLER_NEW_OBJECT_API + info = doc->getDocInfo(); +#else doc->getDocInfo(&info); +#endif if (info.isDict()) { title = getInfoString(info.getDict(), "Title", uMap, isUnicode); @@ -397,7 +415,9 @@ http://msdn.microsoft.com/en-us/library/078sfkak(VS.80).aspx producer = getInfoString(info.getDict(), "Producer", uMap, isUnicode); creationdate = getInfoDate( info.getDict(), "CreationDate" ); moddate = getInfoDate( info.getDict(), "ModDate" ); +#ifndef LIBPOPPLER_NEW_OBJECT_API info.free(); +#endif } } diff --git a/Applications/Cxx/gdcmtar.cxx b/Applications/Cxx/gdcmtar.cxx index f16f39b..c86e8b5 100644 --- a/Applications/Cxx/gdcmtar.cxx +++ b/Applications/Cxx/gdcmtar.cxx @@ -65,12 +65,12 @@ static void PrintHelp() std::cout << " -i --input DICOM filename" << std::endl; std::cout << " -o --output DICOM filename" << std::endl; std::cout << "Options:" << std::endl; - std::cout << " --enhance enhance (default)" << std::endl; - std::cout << " -U --unenhance unenhance" << std::endl; - std::cout << " -M --mosaic Split SIEMENS Mosaic image into multiple frames." << std::endl; - std::cout << " --mosaic-private When splitting SIEMENS Mosaic image into multiple frames, ppreserve private attributes (advanced user only)." << std::endl; - std::cout << " -p --pattern Specify trailing file pattern." << std::endl; - std::cout << " --root-uid Root UID." << std::endl; + std::cout << " --enhance Enhance (default)" << std::endl; + std::cout << " -U --unenhance Unenhance" << std::endl; + std::cout << " -M --mosaic Split SIEMENS Mosaic image into multiple frames." << std::endl; + std::cout << " --mosaic-private When splitting SIEMENS Mosaic image into multiple frames, preserve private attributes (advanced user only)." << std::endl; + std::cout << " -p --pattern Specify trailing file pattern." << std::endl; + std::cout << " --root-uid Root UID." << std::endl; //std::cout << " --resources-path Resources path." << std::endl; std::cout << "General Options:" << std::endl; std::cout << " -V --verbose more verbose (warning+error)." << std::endl; @@ -1327,7 +1327,7 @@ int main (int argc, char *argv[]) if( std::fabs(1. - snv_dot) > 1e-6 ) { gdcmErrorMacro("Invalid direction found"); - return false; + return 1; } } diff --git a/CMake/CTestCustom.ctest.in b/CMake/CTestCustom.ctest.in index 9a5aa45..c49e971 100644 --- a/CMake/CTestCustom.ctest.in +++ b/CMake/CTestCustom.ctest.in @@ -35,6 +35,8 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION "bootstrap class path not set in conjunction with" "warning CS1699" "has been explicitly marked deprecated here" + # clang-6.0: warning: the object size sanitizer has no effect at -O0, but is explicitly enabled: -fsanitize=float-cast-overflow,integer-divide-by-zero,null,object-size,return,shift,signed-integer-overflow,unreachable,vla-bound [-Winvalid-command-line-argument] + "the object size sanitizer has no effect at" ) # Disable dynamic analysis on some tests: diff --git a/CMake/InstallMacros.cmake b/CMake/InstallMacros.cmake index e937b55..5d129de 100644 --- a/CMake/InstallMacros.cmake +++ b/CMake/InstallMacros.cmake @@ -56,37 +56,15 @@ macro(install_library library) endmacro() macro (install_pdb library) - if (MSVC) - if(CMAKE_CONFIGURATION_TYPES) - # Visual Studio - # The following does not work with LOCATION keyword. See: - # http://www.cmake.org/pipermail/cmake/2011-February/042579.html - foreach(cfg ${CMAKE_CONFIGURATION_TYPES}) - get_target_property(library_dll ${library} LOCATION_${cfg}) - string(REPLACE .dll .pdb library_pdb ${library_dll}) - string(TOLOWER ${cfg} lcfg) - if(lcfg STREQUAL "debug" OR lcfg STREQUAL "relwithdebinfo") - install (FILES ${library_pdb} - DESTINATION ${GDCM_INSTALL_BIN_DIR} - COMPONENT DebugDevel - CONFIGURATIONS ${cfg} - ) - endif() - endforeach() - else() - # nmake - # Same as above we need the explicit location_<config> variable to account for - # the value of CMAKE_DEBUG_POSTFIX - get_target_property(library_dll ${library} LOCATION_${CMAKE_BUILD_TYPE}) - string(REPLACE .dll .pdb library_pdb ${library_dll}) - string(TOLOWER ${CMAKE_BUILD_TYPE} lcfg) - if(lcfg STREQUAL "debug" OR lcfg STREQUAL "relwithdebinfo") - install (FILES ${library_pdb} - DESTINATION ${GDCM_INSTALL_BIN_DIR} - COMPONENT DebugDevel - ) - endif() - endif() + if(BUILD_SHARED_LIBS) + if (MSVC) + install ( + FILES "$<TARGET_PDB_FILE:${library}>" + DESTINATION "${GDCM_INSTALL_BIN_DIR}" + COMPONENT DebugDevel + CONFIGURATIONS Debug RelWithDebInfo + ) + endif () endif () endmacro () diff --git a/CMakeLists.txt b/CMakeLists.txt index 1342e89..5c5031c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 2.8.7) if(POLICY CMP0022) - cmake_policy(SET CMP0022 OLD) + cmake_policy(SET CMP0022 NEW) endif() if(POLICY CMP0025) cmake_policy(SET CMP0025 NEW) endif() if(POLICY CMP0026) - cmake_policy(SET CMP0026 OLD) + cmake_policy(SET CMP0026 NEW) endif() if(POLICY CMP0042) cmake_policy(SET CMP0042 NEW) @@ -35,7 +35,7 @@ set(GDCM_PACKAGE_CONTACT "GDCM Developers <gdcm-develop...@lists.sourceforge.net #---------------------------------------------------------------------------- set(GDCM_MAJOR_VERSION 2) set(GDCM_MINOR_VERSION 8) -set(GDCM_BUILD_VERSION 2) +set(GDCM_BUILD_VERSION 3) set(GDCM_VERSION "${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}") # let advanced user the option to define GDCM_API_VERSION: @@ -543,7 +543,10 @@ set(GDCM_EXECUTABLE_DIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}) #----------------------------------------------------------------------------- # we need to link against CoreFoundation so that we can use CFBundle to get the executable path. if(APPLE) - find_library(COREFOUNDATION_LIBRARY CoreFoundation ) + option(GDCM_USE_COREFOUNDATION_LIBRARY "Use COREFOUNDATION_LIBRARY?" ON) + if(GDCM_USE_COREFOUNDATION_LIBRARY) + find_library(COREFOUNDATION_LIBRARY CoreFoundation ) + endif() endif() #----------------------------------------------------------------------------- diff --git a/Examples/Cxx/CMakeLists.txt b/Examples/Cxx/CMakeLists.txt index cc348d1..2c7a018 100644 --- a/Examples/Cxx/CMakeLists.txt +++ b/Examples/Cxx/CMakeLists.txt @@ -65,6 +65,7 @@ set(EXAMPLES_SRCS LargeVRDSExplicit ExtractEncryptedContent ReadAndDumpDICOMDIR + #ReadAndDumpDICOMDIR2 # commented out since requires C++11 GenerateStandardSOPClasses ClinicalTrialAnnotate CheckBigEndianBug diff --git a/Examples/Cxx/ReadAndDumpDICOMDIR2.cxx b/Examples/Cxx/ReadAndDumpDICOMDIR2.cxx new file mode 100755 index 0000000..bc8de1a --- /dev/null +++ b/Examples/Cxx/ReadAndDumpDICOMDIR2.cxx @@ -0,0 +1,393 @@ +/*========================================================================= + + Program: GDCM (Grassroots DICOM). A DICOM library + + Copyright (c) 2006-2017 Mathieu Malaterre + All rights reserved. + See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +/* + * This example shows how to read and dump a DICOMDIR File + * + * Thanks: + * Tom Marynowski (lordglub gmail) for contributing the original + * ReadAndDumpDICOMDIR.cxx example + * Mihail Isakov for contributing offset calculation code here: + * https://sourceforge.net/p/gdcm/mailman/gdcm-developers/?viewmonth=201707&viewday=15 + * Tod Baudais for combining the above and cleaning up this example + */ + +#include <string> +#include <unordered_map> +#include <iostream> +#include <memory> + +#include "gdcmReader.h" +#include "gdcmAttribute.h" +#include "gdcmDirectory.h" + +//============================================================================== +//============================================================================== + +#define TAG_MEDIA_STORAGE_SOP_CLASS_UID 0x0002,0x0002 +#define TAG_DIRECTORY_RECORD_SEQUENCE 0x0004,0x1220 +#define TAG_DIRECTORY_RECORD_TYPE 0x0004,0x1430 +#define TAG_PATIENTS_NAME 0x0010,0x0010 +#define TAG_PATIENT_ID 0x0010,0x0020 +#define TAG_STUDY_DATE 0x0008,0x0020 +#define TAG_STUDY_DESCRIPTION 0x0008,0x1030 +#define TAG_MODALITY 0x0008,0x0060 +#define TAG_SERIES_DESCRIPTION 0x0008,0x103E +#define TAG_REFERENCED_FILE_ID 0x0004,0x1500 +#define TAG_REFERENCED_LOWER_LEVEL_DIRECTORY_ENTITY_OFFSET 0x0004,0x1420 +#define TAG_NEXT_DIRECTORY_RECORD_OFFSET 0x0004,0x1400 + +//============================================================================== +// Some handy utility functions +//============================================================================== + +std::string left_trim(const std::string &s) { + std::string ss(s); + ss.erase(ss.begin(), std::find_if(ss.begin(), ss.end(), std::not1(std::ptr_fun<int, int>(std::isspace)))); + return ss; +} + +std::string right_trim(const std::string &s) { + std::string ss(s); + ss.erase(std::find_if(ss.rbegin(), ss.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), ss.end()); + return ss; +} + +std::string trim(const std::string &s) { + return left_trim(right_trim(s)); +} + +//============================================================================== +// This code could be put in a header file somewhere +//============================================================================== + +class DICOMDIRReader { + public: + DICOMDIRReader (void) {} + DICOMDIRReader (const DICOMDIRReader &rhs) = delete; + DICOMDIRReader (DICOMDIRReader &&rhs) = delete; + DICOMDIRReader & operator = (const DICOMDIRReader &rhs) = delete; + DICOMDIRReader & operator = (DICOMDIRReader &&rhs) = delete; + virtual ~DICOMDIRReader (void) {} + + public: + struct Common { + int64_t child_offset; + int64_t sibling_offset; + }; + + struct Image: public Common { + std::string path; + }; + + struct Series: public Common { + std::string modality; + std::string description; + + std::vector<std::shared_ptr<Image>> children; + }; + + struct Study: public Common { + std::string date; + std::string description; + + std::vector<std::shared_ptr<Series>> children; + }; + + struct Patient: public Common { + std::string name; + std::string id; + + std::vector<std::shared_ptr<Study>> children; + }; + + struct Other: public Common { + }; + + /// Load DICOMDIR + const std::vector<std::shared_ptr<Patient>>& load (const std::string &path); + + /// Return the results of the load + const std::vector<std::shared_ptr<Patient>>& patients (void) { return _patients; } + + private: + + template <class T> + std::string get_string (const T &ds, const gdcm::Tag &tag) + { + std::stringstream strm; + if (ds.FindDataElement(tag)) { + auto &de = ds.GetDataElement(tag); + if (!de.IsEmpty() && !de.IsUndefinedLength()) + de.GetValue().Print(strm); + } + return trim(strm.str()); + } + + template <class P, class C, class O> + void reassemble_hierarchy (P &parent_offsets, C &child_offsets, O &other_offsets) + { + for (auto &parent : parent_offsets) { + int64_t sibling_offset; + auto c = child_offsets[parent.second->child_offset]; + if (!c) { + auto o = other_offsets[parent.second->child_offset]; + if (!o) { + continue; + } else { + sibling_offset = o->sibling_offset; + } + } else { + parent.second->children.push_back(c); + sibling_offset = c->sibling_offset; + } + + // Get all siblings + while (sibling_offset) { + c = child_offsets[sibling_offset]; + if (!c) { + auto o = other_offsets[sibling_offset]; + if (!o) { + break; + } else { + sibling_offset = o->sibling_offset; + } + } else { + parent.second->children.push_back(c); + sibling_offset = c->sibling_offset; + } + } + } + } + + std::vector<std::shared_ptr<Patient>> _patients; +}; + +//============================================================================== +// This code could be put in an implementation file somewhere +//============================================================================== + +const std::vector<std::shared_ptr<DICOMDIRReader::Patient>>& DICOMDIRReader::load (const std::string &path) +{ + _patients.clear(); + + // + // Read the dataset from the DICOMDIR file + // + + gdcm::Reader reader; + reader.SetFileName(path.c_str()); + if(!reader.Read()) { + throw std::runtime_error("Unable to read file"); + } + + // Retrieve information from file + auto &file = reader.GetFile(); + auto &data_set = file.GetDataSet(); + auto &file_meta_information = file.GetHeader(); + + // Retrieve and check the Media Storage class from file + gdcm::MediaStorage media_storage; + media_storage.SetFromFile(file); + if(media_storage != gdcm::MediaStorage::MediaStorageDirectoryStorage) { + throw std::runtime_error("This file is not a DICOMDIR"); + } + + auto media_storage_sop_class_uid = get_string(file_meta_information, gdcm::Tag(TAG_MEDIA_STORAGE_SOP_CLASS_UID)); + + // Make sure we have a DICOMDIR file + if (media_storage_sop_class_uid != "1.2.840.10008.1.3.10") { + throw std::runtime_error("This file is not a DICOMDIR"); + } + + // + // Offset to first item courtesy of Mihail Isakov + // + + gdcm::VL first_item_offset = 0; + auto it = data_set.Begin(); + for(; it != data_set.End() && it->GetTag() != gdcm::Tag(TAG_DIRECTORY_RECORD_SEQUENCE); ++it) { + first_item_offset += it->GetLength<gdcm::ExplicitDataElement>(); + } + // Tag (4 bytes) + first_item_offset += it->GetTag().GetLength(); + // VR field + first_item_offset += it->GetVR().GetLength(); + // VL field + // For Explicit VR: adventitiously VL field lenght = VR field lenght, + // for SQ 4 bytes: + // http://dicom.nema.org/medical/dicom/current/output/html/part05.html#table_7.1-1 + first_item_offset += it->GetVR().GetLength(); + + // + // Iterate all data elements + // + + // For each item in data set + for(auto data_element : data_set.GetDES()) { + + // Only look at Directory sequence + if (data_element.GetTag() != gdcm::Tag(TAG_DIRECTORY_RECORD_SEQUENCE)) + continue; + + auto item_sequence = data_element.GetValueAsSQ(); + auto num_items = item_sequence->GetNumberOfItems(); + + // + // Compute an offset table + // + + // Start calculation of offset to each item courtesy of Mihail Isakov + std::vector<int64_t> item_offsets(num_items+1); + item_offsets[0] = file_meta_information.GetFullLength() + static_cast<int64_t>(first_item_offset); + + // + // Extract out all of the items + // + + std::unordered_map<int64_t, std::shared_ptr<Patient>> patient_offsets; + std::unordered_map<int64_t, std::shared_ptr<Study>> study_offsets; + std::unordered_map<int64_t, std::shared_ptr<Series>> series_offsets; + std::unordered_map<int64_t, std::shared_ptr<Image>> image_offsets; + std::unordered_map<int64_t, std::shared_ptr<Other>> other_offsets; + + for (uint32_t item_index = 1; item_index <= num_items; ++item_index) { + auto &item = item_sequence->GetItem(item_index); + + // Add offset for item to offset table + item_offsets[item_index] = item_offsets[item_index-1] + item.GetLength<gdcm::ExplicitDataElement>(); + + // Child offset + gdcm::Attribute<TAG_REFERENCED_LOWER_LEVEL_DIRECTORY_ENTITY_OFFSET> child_offset; + child_offset.SetFromDataElement(item.GetDataElement(gdcm::Tag (TAG_REFERENCED_LOWER_LEVEL_DIRECTORY_ENTITY_OFFSET))); + + // Sibling offset + gdcm::Attribute<TAG_NEXT_DIRECTORY_RECORD_OFFSET> sibling_offset; + sibling_offset.SetFromDataElement(item.GetDataElement(gdcm::Tag (TAG_NEXT_DIRECTORY_RECORD_OFFSET))); + + // Record Type + auto record_type = trim(get_string(item, gdcm::Tag (TAG_DIRECTORY_RECORD_TYPE))); + + // std::cout << "record_type " << record_type << " at " << item_offsets[item_index-1] << std::endl; + // std::cout << " child_offset " << child_offset.GetValue() << std::endl; + // std::cout << " sibling_offset " << sibling_offset.GetValue() << std::endl; + + // Extract patient information + if (record_type == "PATIENT") { + auto patient = std::make_shared<Patient>(); + patient->name = get_string(item, gdcm::Tag (TAG_PATIENTS_NAME)); + patient->id = get_string(item, gdcm::Tag (TAG_PATIENT_ID)); + + patient->child_offset = child_offset.GetValue(); + patient->sibling_offset = sibling_offset.GetValue(); + patient_offsets[item_offsets[item_index-1]] = patient; + + // Extract study information + } else if (record_type == "STUDY") { + auto study = std::make_shared<Study>(); + study->date = get_string(item, gdcm::Tag (TAG_STUDY_DATE)); + study->description = get_string(item, gdcm::Tag (TAG_STUDY_DESCRIPTION)); + + study->child_offset = child_offset.GetValue(); + study->sibling_offset = sibling_offset.GetValue(); + study_offsets[item_offsets[item_index-1]] = study; + + // Extract series information + } else if (record_type == "SERIES") { + auto series = std::make_shared<Series>(); + series->modality = get_string(item, gdcm::Tag (TAG_MODALITY)); + series->description = get_string(item, gdcm::Tag (TAG_SERIES_DESCRIPTION)); + + series->child_offset = child_offset.GetValue(); + series->sibling_offset = sibling_offset.GetValue(); + series_offsets[item_offsets[item_index-1]] = series; + + // Extract image information + } else if (record_type == "IMAGE") { + auto image = std::make_shared<Image>(); + image->path = get_string(item, gdcm::Tag (TAG_REFERENCED_FILE_ID)); + + image->child_offset = child_offset.GetValue(); + image->sibling_offset = sibling_offset.GetValue(); + image_offsets[item_offsets[item_index-1]] = image; + } else { + auto other = std::make_shared<Other>(); + + other->child_offset = child_offset.GetValue(); + other->sibling_offset = sibling_offset.GetValue(); + other_offsets[item_offsets[item_index-1]] = other; + } + } + + // Check validity + if (patient_offsets.size() == 0) + throw std::runtime_error("Unable to find patient record"); + + reassemble_hierarchy(series_offsets, image_offsets, other_offsets); + reassemble_hierarchy(study_offsets, series_offsets, other_offsets); + reassemble_hierarchy(patient_offsets, study_offsets, other_offsets); + + // Set the new root + for (auto &patient : patient_offsets) { + _patients.push_back(patient.second); + } + } + + return _patients; +} + +//============================================================================== +// Quick test +//============================================================================== + +int main(int argc, const char *argv[]) { + DICOMDIRReader reader; + + try { + if (argc != 2) + throw std::runtime_error("Wrong number of arguments"); + + auto &patients = reader.load(argv[1]); + + for (auto &patient : patients) { + + std::cout << "PATIENT" << std::endl; + std::cout << "NAME: " << patient->name << std::endl; + std::cout << "ID: " << patient->id << std::endl; + + int x = 0; + for (auto &study : patient->children) { + std::cout << " STUDY" << std::endl; + std::cout << " DESCRIPTION: " << study->description << std::endl; + std::cout << " DATE: " << study->date << std::endl; + + for (auto &series : study->children) { + x+=1; + std::cout << " SERIES " << x << std::endl; + std::cout << " DESCRIPTION: " << series->description << std::endl; + std::cout << " MODALITY: " << series->modality << std::endl; + + for (auto &image : series->children) { + std::cout << " IMAGE PATH: " << image->path << std::endl; + } + } + } + } + } + catch (...) { + // TODO handle this + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/Examples/Python/DecompressImage.py b/Examples/Python/DecompressImage.py index c3b7018..8d88bd3 100644 --- a/Examples/Python/DecompressImage.py +++ b/Examples/Python/DecompressImage.py @@ -31,8 +31,14 @@ if __name__ == "__main__": if not r.Read(): sys.exit(1) - image = gdcm.Image() + # check GetFragment API: + pd = r.GetFile().GetDataSet().GetDataElement(gdcm.Tag(0x7fe0, 0x0010)) + frags = pd.GetSequenceOfFragments(); + frags.GetFragment(0); + ir = r.GetImage() + w = gdcm.ImageWriter() + image = w.GetImage() image.SetNumberOfDimensions( ir.GetNumberOfDimensions() ); dims = ir.GetDimensions(); @@ -42,7 +48,7 @@ if __name__ == "__main__": # Just for fun: dircos = ir.GetDirectionCosines() - t = gdcm.Orientation.GetType(dircos) + t = gdcm.Orientation.GetType(tuple(dircos)) l = gdcm.Orientation.GetLabel(t) print "Orientation label:",l @@ -61,7 +67,6 @@ if __name__ == "__main__": pixeldata.SetByteValue( str1, gdcm.VL( len(str1) ) ) image.SetDataElement( pixeldata ) - w = gdcm.ImageWriter() w.SetFileName( file2 ) w.SetFile( r.GetFile() ) w.SetImage( image ) diff --git a/Source/Common/CMakeLists.txt b/Source/Common/CMakeLists.txt index b2ea721..488cc07 100644 --- a/Source/Common/CMakeLists.txt +++ b/Source/Common/CMakeLists.txt @@ -188,27 +188,29 @@ add_library(gdcmCommon ${Common_SRCS}) #target_link_libraries(gdcmCommon ${GDCM_ZLIB_LIBRARIES}) # ${GDCM_POLARSSL_LIBRARIES}) if(GDCM_BUILD_TESTING) -target_link_libraries(gdcmCommon gdcmmd5 ) + target_link_libraries(gdcmCommon LINK_PRIVATE gdcmmd5) endif() if(APPLE) - target_link_libraries(gdcmCommon ${COREFOUNDATION_LIBRARY}) + if(GDCM_USE_COREFOUNDATION_LIBRARY) + target_link_libraries(gdcmCommon LINK_PRIVATE ${COREFOUNDATION_LIBRARY}) + endif() endif() if(UNIX) - target_link_libraries(gdcmCommon ${CMAKE_DL_LIBS}) + target_link_libraries(gdcmCommon LINK_PRIVATE ${CMAKE_DL_LIBS}) endif() if(WIN32) - target_link_libraries(gdcmCommon ws2_32) - target_link_libraries(gdcmCommon crypt32) + target_link_libraries(gdcmCommon LINK_PRIVATE ws2_32) + target_link_libraries(gdcmCommon LINK_PRIVATE crypt32) endif() if(GDCM_USE_SYSTEM_OPENSSL) include_directories(${OPENSSL_INCLUDE_DIR}) - target_link_libraries(gdcmCommon ${OPENSSL_LIBRARIES}) + target_link_libraries(gdcmCommon LINK_PRIVATE ${OPENSSL_LIBRARIES}) endif() set_target_properties(gdcmCommon PROPERTIES ${GDCM_LIBRARY_PROPERTIES}) if(BUILD_SHARED_LIBS) - set_target_properties(gdcmCommon PROPERTIES INTERFACE_LINK_LIBRARIES "" LINK_INTERFACE_LIBRARIES "") + #set_target_properties(gdcmCommon PROPERTIES INTERFACE_LINK_LIBRARIES "" LINK_INTERFACE_LIBRARIES "") endif() # libs diff --git a/Source/Common/gdcmConfigure.h.in b/Source/Common/gdcmConfigure.h.in index b01444a..2f3b10a 100644 --- a/Source/Common/gdcmConfigure.h.in +++ b/Source/Common/gdcmConfigure.h.in @@ -166,4 +166,7 @@ #cmakedefine GDCM_ALWAYS_TRACE_MACRO +/* ITK Specific */ +#cmakedefine GDCM_USE_COREFOUNDATION_LIBRARY + #endif diff --git a/Source/Common/gdcmSwapper.txx b/Source/Common/gdcmSwapper.txx index 34cb1d5..88e530a 100644 --- a/Source/Common/gdcmSwapper.txx +++ b/Source/Common/gdcmSwapper.txx @@ -22,7 +22,7 @@ #define bswap_32(X) _byteswap_ulong(X) #define bswap_64(X) _byteswap_uint64(X) -#elif defined(__GLIBC__) || defined(__CYGWIN__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) // linux and al +#elif defined(GDCM_HAVE_BYTESWAP_H) #include <endian.h> #include <byteswap.h> @@ -72,6 +72,12 @@ (((x) & 0x00FF000000000000ULL) >> 40) | \ (((x) & 0xFF00000000000000ULL) >> 56)) +#else + +// If this condition is encountered, first check whether the platform has the functions required. +// If not, test whether the workaround for __MINGW32__ can be used for this platform. +#error "Byte swap methods are not available." + #endif #include "gdcmTag.h" diff --git a/Source/Common/gdcmSystem.cxx b/Source/Common/gdcmSystem.cxx index 0721bdf..4a07aa8 100644 --- a/Source/Common/gdcmSystem.cxx +++ b/Source/Common/gdcmSystem.cxx @@ -42,9 +42,9 @@ #elif defined(GDCM_HAVE__SNPRINTF) #define snprintf _snprintf #endif -#ifdef __APPLE__ +#ifdef GDCM_USE_COREFOUNDATION_LIBRARY #include <CoreFoundation/CoreFoundation.h> -#endif // __APPLE__ +#endif #if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) ||defined(__BORLANDC__) || defined(__MINGW32__)) #include <io.h> @@ -421,7 +421,7 @@ const char *System::GetCurrentProcessFileName() { return buf; } -#elif defined(__APPLE__) +#elif defined(GDCM_USE_COREFOUNDATION_LIBRARY) static char buf[PATH_MAX]; Boolean success = false; CFURLRef pathURL = CFBundleCopyExecutableURL(CFBundleGetMainBundle()); @@ -490,7 +490,7 @@ const char *System::GetCurrentModuleFileName() const char *System::GetCurrentResourcesDirectory() { -#ifdef __APPLE__ +#ifdef GDCM_USE_COREFOUNDATION_LIBRARY static char path[PATH_MAX]; Boolean success = false; CFURLRef pathURL = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()); diff --git a/Source/DataDictionary/CMakeLists.txt b/Source/DataDictionary/CMakeLists.txt index 609c207..81c910f 100644 --- a/Source/DataDictionary/CMakeLists.txt +++ b/Source/DataDictionary/CMakeLists.txt @@ -96,10 +96,10 @@ set(DICT_SRCS ) add_library(gdcmDICT ${DICT_SRCS}) -target_link_libraries(gdcmDICT gdcmDSED gdcmIOD) +target_link_libraries(gdcmDICT LINK_PRIVATE gdcmDSED gdcmIOD) set_target_properties(gdcmDICT PROPERTIES ${GDCM_LIBRARY_PROPERTIES}) if(BUILD_SHARED_LIBS) - set_target_properties(gdcmDICT PROPERTIES INTERFACE_LINK_LIBRARIES "" LINK_INTERFACE_LIBRARIES "") + #set_target_properties(gdcmDICT PROPERTIES INTERFACE_LINK_LIBRARIES "" LINK_INTERFACE_LIBRARIES "") endif() # libs diff --git a/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx b/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx index b1e46df..716c2d5 100644 --- a/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx +++ b/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx @@ -37,6 +37,92 @@ typedef struct } DICT_ENTRY; static const DICT_ENTRY DICOMV3DataDict [] = { + {0x0021,0x0001,"SIEMENS MR SDR 01",VR::LO,VM::VM1,"??",false}, + {0x0021,0x0001,"SIEMENS MR SDS 01",VR::IS,VM::VM1,"??",false}, + {0x0021,0x0002,"SIEMENS MR SDR 01",VR::LO,VM::VM1,"??",false}, + {0x0021,0x0003,"SIEMENS MR SDI 02",VR::DS,VM::VM1,"FrameAcquisitionDuration",false}, + {0x0021,0x0004,"SIEMENS MR SDI 02",VR::DS,VM::VM1,"??",false}, + {0x0021,0x0004,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false}, + {0x0021,0x0005,"SIEMENS MR SDS 01",VR::IS,VM::VM3,"??",false}, + {0x0021,0x0006,"SIEMENS MR SDI 02",VR::LO,VM::VM1,"ICE_Dims",false}, + {0x0021,0x0006,"SIEMENS MR SDS 01",VR::LO,VM::VM1,"CoilForGradient",false}, + {0x0021,0x0007,"SIEMENS MR SDS 01",VR::LO,VM::VM1,"LongModelName",false}, + {0x0021,0x0008,"SIEMENS MR SDS 01",VR::SH,VM::VM1,"GradientMode",false}, + {0x0021,0x0009,"SIEMENS MR SDS 01",VR::LO,VM::VM1,"PAT mode",false}, + {0x0021,0x000a,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false}, + {0x0021,0x000d,"SIEMENS MR SDS 01",VR::US,VM::VM1,"??",false}, + {0x0021,0x000f,"SIEMENS MR SDS 01",VR::DS,VM::VM3,"?Stim_lim?",false}, + {0x0021,0x0010,"SIEMENS MR SDS 01",VR::IS,VM::VM1,"PhoenixMetaProtocolVersion",false}, + {0x0021,0x0011,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false}, + {0x0021,0x0012,"SIEMENS MR SDS 01",VR::FD,VM::VM1,"??",false}, + {0x0021,0x0013,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false}, + {0x0021,0x0014,"SIEMENS MR SDS 01",VR::IS,VM::VM1,"??",false}, + {0x0021,0x0016,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false}, + {0x0021,0x0017,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false}, + {0x0021,0x0018,"SIEMENS MR SDS 01",VR::SH,VM::VM1,"?RFSWDMostCriticalAspect?",false}, + {0x0021,0x0019,"SIEMENS MR SDS 01",VR::OW,VM::VM1,"PhoenixMetaProtocol",false}, + {0x0021,0x001a,"SIEMENS MR SDI 02",VR::SH,VM::VM1,"?RFSWDDataType?",false}, + {0x0021,0x001b,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false}, + {0x0021,0x001c,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"??",false}, + {0x0021,0x001c,"SIEMENS MR SDS 01",VR::DS,VM::VM3,"??",false}, + {0x0021,0x001d,"SIEMENS MR SDS 01",VR::IS,VM::VM1,"??",false}, + {0x0021,0x0022,"SIEMENS MR SDS 01",VR::SH,VM::VM1,"Manufacturer",false}, + {0x0021,0x0023,"SIEMENS MR SDS 01",VR::IS,VM::VM1,"??",false}, + {0x0021,0x0024,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"??",false}, + {0x0021,0x0025,"SIEMENS MR SDS 01",VR::SL,VM::VM3,"?ImaAbsTablePosition?",false}, + {0x0021,0x0026,"SIEMENS MR SDS 01",VR::IS,VM::VM1_n,"?MiscSequenceParam?",false}, + {0x0021,0x0027,"SIEMENS MR SDS 01",VR::US,VM::VM1,"??",false}, + {0x0021,0x002a,"SIEMENS MR SDS 01",VR::IS,VM::VM1_n,"?CoilId?",false}, + {0x0021,0x002b,"SIEMENS MR SDS 01",VR::ST,VM::VM1,"?ImaAbsTablePosition?",false}, + {0x0021,0x002c,"SIEMENS MR SDS 01",VR::DS,VM::VM3,"??",false}, + {0x0021,0x002d,"SIEMENS MR SDS 01",VR::DS,VM::VM3,"??",false}, + {0x0021,0x002e,"SIEMENS MR SDS 01",VR::IS,VM::VM1,"??",false}, + {0x0021,0x002f,"SIEMENS MR SDS 01",VR::DS,VM::VM3,"??",false}, + {0x0021,0x0030,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false}, + {0x0021,0x0031,"SIEMENS MR SDS 01",VR::IS,VM::VM1,"PtabAbsStartPosZ",false}, + {0x0021,0x0032,"SIEMENS MR SDS 01",VR::SS,VM::VM1,"??",false}, + {0x0021,0x0033,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"?CoilForGradient2?",false}, + {0x0021,0x0033,"SIEMENS MR SDS 01",VR::SH,VM::VM1,"??",false}, + {0x0021,0x0034,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false}, + {0x0021,0x0035,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false}, + {0x0021,0x0036,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false}, + {0x0021,0x0037,"SIEMENS MR SDS 01",VR::SH,VM::VM1,"??",false}, + {0x0021,0x0038,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false}, + {0x0021,0x003b,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false}, + {0x0021,0x003d,"SIEMENS MR SDS 01",VR::CS,VM::VM1,"?Image Acquisition Param?",false}, + {0x0021,0x0041,"SIEMENS MR SDI 02",VR::SH,VM::VM1,"?GSWDDataType?",false}, + {0x0021,0x0042,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"?RealDwellTime?",false}, + {0x0021,0x0044,"SIEMENS MR SDS 01",VR::DS,VM::VM2,"??",false}, + {0x0021,0x0045,"SIEMENS MR SDI 02",VR::SL,VM::VM3,"?Table Position?",false}, + {0x0021,0x0045,"SIEMENS MR SDS 01",VR::CS,VM::VM1,"??",false}, + {0x0021,0x0046,"SIEMENS MR SDS 01",VR::DS,VM::VM1,"??",false}, + {0x0021,0x0048,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"??",false}, + {0x0021,0x0049,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"??",false}, + {0x0021,0x004f,"SIEMENS MR SDI 02",VR::LO,VM::VM1,"ImaCoilString",false}, + {0x0021,0x0050,"SIEMENS MR SDS 01",VR::US,VM::VM1,"??",false}, + {0x0021,0x0051,"SIEMENS MR SDI 02",VR::UL,VM::VM1,"?SequenceMask?",false}, + {0x0021,0x0051,"SIEMENS MR SDS 01",VR::US,VM::VM1,"??",false}, + {0x0021,0x0053,"SIEMENS MR SDS 01",VR::CS,VM::VM1,"??",false}, + {0x0021,0x0058,"SIEMENS MR SDI 02",VR::SH,VM::VM1,"AcquisitionMatrixText",false}, + {0x0021,0x0059,"SIEMENS MR SDI 02",VR::IS,VM::VM3,"?ImaRelTablePosition?",false}, + {0x0021,0x005a,"SIEMENS MR SDS 01",VR::CS,VM::VM1,"?Sequence Varient 1?",false}, + {0x0021,0x005b,"SIEMENS MR SDI 02",VR::FD,VM::VM3,"Image Position (Patient)",false}, + {0x0021,0x005b,"SIEMENS MR SDS 01",VR::CS,VM::VM1,"?Sequence Varient 2?",false}, + {0x0021,0x005d,"SIEMENS MR SDS 01",VR::SL,VM::VM1,"??",false}, + {0x0021,0x005e,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"?FrameIndex?",false}, + {0x0021,0x0063,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"?Acquisition Number?",false}, + {0x0021,0x0071,"SIEMENS MR SDI 02",VR::UT,VM::VM1,"?may contain PHI?",false}, + {0x0021,0x0075,"SIEMENS MR SDI 02",VR::CS,VM::VM1_n,"Image Type",false}, + {0x0021,0x0076,"SIEMENS MR SDI 02",VR::LO,VM::VM1_n,"Acquisition Info",false}, + {0x0021,0x0077,"SIEMENS MR SDI 02",VR::LO,VM::VM1,"Sequence Name",false}, + {0x0021,0x0078,"SIEMENS MR SDI 02",VR::CS,VM::VM1,"Acquisition Type 1",false}, + {0x0021,0x0079,"SIEMENS MR SDI 02",VR::CS,VM::VM1,"Acquisition Type 2",false}, + {0x0021,0x0088,"SIEMENS MR SDI 02",VR::DS,VM::VM1,"Slice Location",false}, + {0x0021,0x008a,"SIEMENS MR SDI 02",VR::IS,VM::VM1,"Instance/Frame Number",false}, + {0x0021,0x00fe,"SIEMENS MR SDI 02",VR::SQ,VM::VM1,"??",false}, + {0x0021,0x00fe,"SIEMENS MR SDS 01",VR::SQ,VM::VM1,"??",false}, + {0x0089,0x0054,"SYNGO_IMAGING",VR::OW,VM::VM1,"??",false}, + {0x0095,0x00fa,"SIENET",VR::PN,VM::VM1,"?Some kind of Patient Name?",false}, {0x8ff1,0x0010,"SSI Image enhancement Group",VR::LO,VM::VM1,"SSI Image enhancement Group Version",false }, {0x8ff1,0x0020,"SSI Image enhancement Group",VR::IS,VM::VM256,"RGB LUT",false }, {0x8ff1,0x0024,"SSI Image enhancement Group",VR::LO,VM::VM1,"LUT Description",false }, diff --git a/Source/DataStructureAndEncodingDefinition/CMakeLists.txt b/Source/DataStructureAndEncodingDefinition/CMakeLists.txt index b9b428e..af9a240 100644 --- a/Source/DataStructureAndEncodingDefinition/CMakeLists.txt +++ b/Source/DataStructureAndEncodingDefinition/CMakeLists.txt @@ -85,13 +85,13 @@ if(NOT GDCM_USE_SYSTEM_ZLIB) endif() add_library(gdcmDSED ${DSED_SRCS} ${DSED3_SRCS}) -target_link_libraries(gdcmDSED gdcmCommon) +target_link_libraries(gdcmDSED LINK_PUBLIC gdcmCommon) # zlib stuff are actually included (template) so we need to link them here. -target_link_libraries(gdcmDSED ${GDCM_ZLIB_LIBRARIES}) +target_link_libraries(gdcmDSED LINK_PRIVATE ${GDCM_ZLIB_LIBRARIES}) set_target_properties(gdcmDSED PROPERTIES ${GDCM_LIBRARY_PROPERTIES}) if(BUILD_SHARED_LIBS) - set(_ill "gdcmCommon") - set_target_properties(gdcmDSED PROPERTIES INTERFACE_LINK_LIBRARIES "${_ill}" LINK_INTERFACE_LIBRARIES "${_ill}") + #set(_ill "gdcmCommon") + #set_target_properties(gdcmDSED PROPERTIES INTERFACE_LINK_LIBRARIES "${_ill}" LINK_INTERFACE_LIBRARIES "${_ill}") endif() # libs diff --git a/Source/DataStructureAndEncodingDefinition/gdcmCSAHeader.h b/Source/DataStructureAndEncodingDefinition/gdcmCSAHeader.h index 2782a68..0e5e87e 100644 --- a/Source/DataStructureAndEncodingDefinition/gdcmCSAHeader.h +++ b/Source/DataStructureAndEncodingDefinition/gdcmCSAHeader.h @@ -77,11 +77,11 @@ public : ZEROED_OUT } CSAHeaderType; - GDCM_LEGACY(template <typename TSwap> - std::istream &Read(std::istream &is)); + template <typename TSwap> + GDCM_LEGACY(std::istream &Read(std::istream &is)); - GDCM_LEGACY(template <typename TSwap> - const std::ostream &Write(std::ostream &os) const); + template <typename TSwap> + GDCM_LEGACY(const std::ostream &Write(std::ostream &os) const); /// Decode the CSAHeader from element 'de' bool LoadFromDataElement(DataElement const &de); diff --git a/Source/DataStructureAndEncodingDefinition/gdcmMrProtocol.cxx b/Source/DataStructureAndEncodingDefinition/gdcmMrProtocol.cxx index b22b92f..2b8e163 100644 --- a/Source/DataStructureAndEncodingDefinition/gdcmMrProtocol.cxx +++ b/Source/DataStructureAndEncodingDefinition/gdcmMrProtocol.cxx @@ -63,6 +63,18 @@ bool MrProtocol::Load( const ByteValue * bv, const char * csastr, int version ) if( !hasstarted ) { hasstarted = starts_with(s, begin); + if( hasstarted ) { + if( version == -1 ) { + // find version if not specified: + static const char vers[] = "version="; + std::string::size_type p = s.find(vers); + if ( p != std::string::npos) { + const char *v = s.c_str() + p + sizeof(vers) - 1; + Pimpl->version = atoi(v); + } + } + continue; // do not insert ASCCONV begin + } } if( !hasstarted ) continue; if( starts_with(s, end) ) break; diff --git a/Source/InformationObjectDefinition/CMakeLists.txt b/Source/InformationObjectDefinition/CMakeLists.txt index adfd1f2..24d547b 100644 --- a/Source/InformationObjectDefinition/CMakeLists.txt +++ b/Source/InformationObjectDefinition/CMakeLists.txt @@ -46,11 +46,12 @@ if(GDCM_USE_SYSTEM_EXPAT) endif() add_library(gdcmIOD ${IOD_SRCS}) -target_link_libraries(gdcmIOD gdcmDSED gdcmCommon ${GDCM_EXPAT_LIBRARIES}) +target_link_libraries(gdcmIOD LINK_PUBLIC gdcmDSED gdcmCommon) +target_link_libraries(gdcmIOD LINK_PRIVATE ${GDCM_EXPAT_LIBRARIES}) set_target_properties(gdcmIOD PROPERTIES ${GDCM_LIBRARY_PROPERTIES}) if(BUILD_SHARED_LIBS) - set(_ill "gdcmDSED;gdcmCommon") - set_target_properties(gdcmIOD PROPERTIES INTERFACE_LINK_LIBRARIES "${_ill}" LINK_INTERFACE_LIBRARIES "${_ill}") + #set(_ill "gdcmDSED;gdcmCommon") + #set_target_properties(gdcmIOD PROPERTIES INTERFACE_LINK_LIBRARIES "${_ill}" LINK_INTERFACE_LIBRARIES "${_ill}") endif() # libs diff --git a/Source/MediaStorageAndFileFormat/CMakeLists.txt b/Source/MediaStorageAndFileFormat/CMakeLists.txt index b8bdb8a..4a56acb 100644 --- a/Source/MediaStorageAndFileFormat/CMakeLists.txt +++ b/Source/MediaStorageAndFileFormat/CMakeLists.txt @@ -189,9 +189,10 @@ if(GDCM_USE_PVRG) endif() # main libs: -target_link_libraries(gdcmMSFF gdcmIOD gdcmDSED gdcmDICT ${GDCM_LJPEG_LIBRARIES} ${GDCM_OPENJPEG_LIBRARIES}) +target_link_libraries(gdcmMSFF LINK_PUBLIC gdcmIOD gdcmDSED gdcmDICT) +target_link_libraries(gdcmMSFF LINK_PRIVATE ${GDCM_LJPEG_LIBRARIES} ${GDCM_OPENJPEG_LIBRARIES}) if(GDCM_USE_JPEGLS) - target_link_libraries(gdcmMSFF ${GDCM_CHARLS_LIBRARIES}) + target_link_libraries(gdcmMSFF LINK_PRIVATE ${GDCM_CHARLS_LIBRARIES}) endif() if(CMAKE_COMPILER_IS_GNUCXX AND MINGW) @@ -206,20 +207,20 @@ endif() if(WIN32) # For UuidCreate # http://msdn.microsoft.com/en-us/library/aa379205(VS.85).aspx - target_link_libraries(gdcmMSFF rpcrt4) + target_link_libraries(gdcmMSFF LINK_PRIVATE rpcrt4) #endif() else() -target_link_libraries(gdcmMSFF ${GDCMUUID}) + target_link_libraries(gdcmMSFF LINK_PRIVATE ${GDCMUUID}) endif() if(GDCM_USE_SYSTEM_JSON) -target_link_libraries(gdcmMSFF ${JSON_LIBRARIES}) + target_link_libraries(gdcmMSFF LINK_PRIVATE ${JSON_LIBRARIES}) endif() # handling of static lib within shared is a mess: #target_link_libraries(gdcmMSFF gdcmrle) set_target_properties(gdcmMSFF PROPERTIES ${GDCM_LIBRARY_PROPERTIES}) if(BUILD_SHARED_LIBS) - set(_ill "gdcmDSED;gdcmDICT;gdcmIOD") - set_target_properties(gdcmMSFF PROPERTIES INTERFACE_LINK_LIBRARIES "${_ill}" LINK_INTERFACE_LIBRARIES "${_ill}") + #set(_ill "gdcmDSED;gdcmDICT;gdcmIOD") + #set_target_properties(gdcmMSFF PROPERTIES INTERFACE_LINK_LIBRARIES "${_ill}" LINK_INTERFACE_LIBRARIES "${_ill}") endif() # libs diff --git a/Source/MediaStorageAndFileFormat/gdcmDictPrinter.cxx b/Source/MediaStorageAndFileFormat/gdcmDictPrinter.cxx index 270ce84..7569d43 100644 --- a/Source/MediaStorageAndFileFormat/gdcmDictPrinter.cxx +++ b/Source/MediaStorageAndFileFormat/gdcmDictPrinter.cxx @@ -23,6 +23,7 @@ namespace gdcm //----------------------------------------------------------------------------- DictPrinter::DictPrinter() { + PrintStyle = XML; } //----------------------------------------------------------------------------- @@ -80,8 +81,8 @@ VM GuessVMType(DataElement const &de) { assert( bv && "not bv" ); const char *array = bv->GetPointer(); - unsigned int c = VM::GetNumberOfElementsFromArray(array, vl); - vm = VM::GetVMTypeFromLength( c, 1 ); + size_t c = VM::GetNumberOfElementsFromArray(array, vl); + vm = VM::GetVMTypeFromLength( (unsigned int)c, 1 ); } } break; @@ -466,17 +467,33 @@ void DictPrinter::PrintDataElement2(std::ostream& os, const DataSet &ds, const D } VM vm = GuessVMType(de); - os << - "<entry group=\"" << std::hex << std::setw(4) << std::setfill('0') << - t.GetGroup() << "\" element=\"" << std::setw(4) << ((uint16_t)(t.GetElement() << 8) >> 8) << "\" "; - - os << "vr=\"" << pvr << "\" vm=\"" << vm << "\" "; - //os << "\" retired=\"false\"; + if( PrintStyle == XML ) + { + os << + "<entry group=\"" << std::hex << std::setw(4) << std::setfill('0') << + t.GetGroup() << "\" element=\"" << std::setw(4) << ((uint16_t)(t.GetElement() << 8) >> 8) << "\" "; + os << "vr=\"" << pvr << "\" vm=\"" << vm << "\" "; if( de.GetTag().IsPrivate() ) { os << "name=\"?\" owner=\"" << owner << /*"\" version=\"" << version << */ "\"/>\n"; } + } + else if ( PrintStyle == CXX ) + { + os << + "{0x" << std::hex << std::setw(4) << std::setfill('0') << + t.GetGroup() << ",0x" << std::setw(4) << ((uint16_t)(t.GetElement() << 8) >> 8) << ","; + if( de.GetTag().IsPrivate() ) + { + os << "\"" << owner + << "\","; + } + std::string vm_str = VM::GetVMString(vm); + std::replace( vm_str.begin(), vm_str.end(), '-', '_'); + os << "VR::" << pvr << ",VM::VM" << vm_str << ",\"??\",false},\n"; + } + //os << "\n <description>?</description>\n"; //os << "</entry>\n"; //os << "/>\n"; diff --git a/Source/MediaStorageAndFileFormat/gdcmIPPSorter.cxx b/Source/MediaStorageAndFileFormat/gdcmIPPSorter.cxx index f3670f9..1135a00 100644 --- a/Source/MediaStorageAndFileFormat/gdcmIPPSorter.cxx +++ b/Source/MediaStorageAndFileFormat/gdcmIPPSorter.cxx @@ -93,9 +93,18 @@ bool IPPSorter::Sort(std::vector<std::string> const & filenames) return false; } } - if( frames.size() > 1 ) // Should I really tolerate no Frame of Reference UID ? + const size_t fsize = frames.size(); // Should I really tolerate issue with Frame of Reference UID ? + if( fsize == 1 ) // by the book { - gdcmDebugMacro( "More than one Frame Of Reference UID" ); + // TODO: need to check not empty ? technically PMS used to send MR Image Storage with empty FoR + } + else if( fsize == 0 || fsize == filenames.size() ) // Should I really tolerate no Frame of Reference UID ? + { + gdcmWarningMacro( "Odd number of Frame Of Reference UID (continuing with caution): " << fsize ); + } + else + { + gdcmErrorMacro( "Sorry your setup with Frame Of Reference UID does not make any sense: " << fsize ); return false; } diff --git a/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx b/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx index 85940f7..6247ec4 100644 --- a/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx +++ b/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx @@ -1311,6 +1311,7 @@ std::vector<double> ImageHelper::GetSpacingValue(File const & f) el.Read( ss ); for(unsigned int i = 0; i < el.GetLength(); ++i) sp.push_back( el.GetValue(i) ); + std::swap( sp[0], sp[1]); assert( sp.size() == (unsigned int)entry.GetVM() ); } break; diff --git a/Source/MediaStorageAndFileFormat/gdcmPrinter.cxx b/Source/MediaStorageAndFileFormat/gdcmPrinter.cxx index 0970115..7b21100 100644 --- a/Source/MediaStorageAndFileFormat/gdcmPrinter.cxx +++ b/Source/MediaStorageAndFileFormat/gdcmPrinter.cxx @@ -757,7 +757,7 @@ VR Printer::PrintDataElement(std::ostringstream &os, const Dicts &dicts, const D if( bv ) { size_t count = VM::GetNumberOfElementsFromArray(bv->GetPointer(), bv->GetLength()); - guessvm = VM::GetVMTypeFromLength(count, 1); // hackish... + guessvm = VM::GetVMTypeFromLength((unsigned int)count, 1); // hackish... } } else if( refvr & VR::VRBINARY ) diff --git a/Source/MediaStorageAndFileFormat/gdcmPrinter.h b/Source/MediaStorageAndFileFormat/gdcmPrinter.h index 205407a..b4b62f6 100644 --- a/Source/MediaStorageAndFileFormat/gdcmPrinter.h +++ b/Source/MediaStorageAndFileFormat/gdcmPrinter.h @@ -72,7 +72,8 @@ public: VERBOSE_STYLE = 0, // GDCM Legacy VERBOSE one CONDENSED_STYLE, // // Ok I am missing voc here ...better naming would be nice - XML // sure why not + XML, // + CXX } PrintStyles; /// Set PrintStyle value diff --git a/Source/MediaStorageAndFileFormat/gdcmStringFilter.cxx b/Source/MediaStorageAndFileFormat/gdcmStringFilter.cxx index 8e9c505..535543f 100644 --- a/Source/MediaStorageAndFileFormat/gdcmStringFilter.cxx +++ b/Source/MediaStorageAndFileFormat/gdcmStringFilter.cxx @@ -553,12 +553,12 @@ std::string StringFilter::FromString(const Tag&t, const char * value, size_t len return s; } VL::Type castLen = (VL::Type)len; - VL::Type count = VM::GetNumberOfElementsFromArray(value, castLen); + size_t count = VM::GetNumberOfElementsFromArray(value, castLen); VL vl = vm.GetLength() * vr.GetSizeof(); if( vm.GetLength() == 0 ) { // VM1_n - vl = count * vr.GetSizeof(); + vl = (VL)( (VL)count * vr.GetSizeof()); #if !defined(NDEBUG) VM check = VM::GetVMTypeFromLength(count, 1); assert( vm.Compatible( check ) ); diff --git a/Source/MessageExchangeDefinition/CMakeLists.txt b/Source/MessageExchangeDefinition/CMakeLists.txt index 6ed2efb..4f19dbd 100644 --- a/Source/MessageExchangeDefinition/CMakeLists.txt +++ b/Source/MessageExchangeDefinition/CMakeLists.txt @@ -92,18 +92,18 @@ set(MessageExchangeDefinition_SRCS ) add_library(gdcmMEXD ${MessageExchangeDefinition_SRCS}) -target_link_libraries(gdcmMEXD gdcmMSFF gdcmDICT gdcmDSED gdcmIOD) +target_link_libraries(gdcmMEXD LINK_PRIVATE gdcmMSFF gdcmDICT gdcmDSED gdcmIOD) if(GDCM_USE_SYSTEM_SOCKETXX) - target_link_libraries(gdcmMEXD socket++) + target_link_libraries(gdcmMEXD LINK_PRIVATE socket++) else() - target_link_libraries(gdcmMEXD socketxx) + target_link_libraries(gdcmMEXD LINK_PRIVATE socketxx) endif() if(WIN32) - target_link_libraries(gdcmMEXD ws2_32) + target_link_libraries(gdcmMEXD LINK_PRIVATE ws2_32) endif() set_target_properties(gdcmMEXD PROPERTIES ${GDCM_LIBRARY_PROPERTIES}) if(BUILD_SHARED_LIBS) - set_target_properties(gdcmMEXD PROPERTIES INTERFACE_LINK_LIBRARIES "" LINK_INTERFACE_LIBRARIES "") + #set_target_properties(gdcmMEXD PROPERTIES INTERFACE_LINK_LIBRARIES "" LINK_INTERFACE_LIBRARIES "") endif() # libs diff --git a/Testing/Source/Data/CMakeLists.txt b/Testing/Source/Data/CMakeLists.txt index 7d61b16..166e2d8 100644 --- a/Testing/Source/Data/CMakeLists.txt +++ b/Testing/Source/Data/CMakeLists.txt @@ -68,6 +68,8 @@ set(BLACK_LIST_READER LengthOfItemLarger.dcm # https://github.com/team-charls/charls/issues/16 JPEG_LS_InvalidEscapeSequence_COM_padding.dcm +# MITRA_CORNELL + MITRA_CORNELL.dcm ) if(NOT GDCM_USE_PVRG) set(BLACK_LIST_READER diff --git a/Utilities/VTK/CMakeLists.txt b/Utilities/VTK/CMakeLists.txt index 92e691c..77fdd96 100644 --- a/Utilities/VTK/CMakeLists.txt +++ b/Utilities/VTK/CMakeLists.txt @@ -166,12 +166,12 @@ endif() #endif() set_target_properties(${VTKGDCM_NAME} PROPERTIES ${GDCM_LIBRARY_PROPERTIES}) -target_link_libraries(${VTKGDCM_NAME} gdcmMSFF ${vtkgdcm_LIBS}) +target_link_libraries(${VTKGDCM_NAME} LINK_PRIVATE gdcmMSFF ${vtkgdcm_LIBS}) if(GDCM_HAVE_PTHREAD_H) - target_link_libraries(${VTKGDCM_NAME} pthread) + target_link_libraries(${VTKGDCM_NAME} LINK_PRIVATE pthread) endif() # prevent viral dep of vtkgdcm -set_property(TARGET ${VTKGDCM_NAME} PROPERTY LINK_INTERFACE_LIBRARIES "") +#set_property(TARGET ${VTKGDCM_NAME} PROPERTY LINK_INTERFACE_LIBRARIES "") if(NOT GDCM_INSTALL_NO_LIBRARIES) install(TARGETS ${VTKGDCM_NAME} EXPORT ${GDCM_TARGETS_NAME} @@ -223,12 +223,12 @@ if(GDCM_WRAP_PHP) SWIG_ADD_MODULE(php_vtkgdcm php vtkgdcm.i) SWIG_LINK_LIBRARIES(php_vtkgdcm vtkgdcm) - target_link_libraries(${SWIG_MODULE_php_vtkgdcm_REAL_NAME} ${vtkgdcm_LIBS}) + target_link_libraries(${SWIG_MODULE_php_vtkgdcm_REAL_NAME} LINK_PRIVATE ${vtkgdcm_LIBS}) if(UNIX) set_target_properties(${SWIG_MODULE_php_vtkgdcm_REAL_NAME} PROPERTIES OUTPUT_NAME "vtkgdcm") endif() set_target_properties(${SWIG_MODULE_php_vtkgdcm_REAL_NAME} PROPERTIES PREFIX "") - set_target_properties(${SWIG_MODULE_php_vtkgdcm_REAL_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "") + #set_target_properties(${SWIG_MODULE_php_vtkgdcm_REAL_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "") set_property(TARGET ${SWIG_MODULE_php_vtkgdcm_REAL_NAME} PROPERTY NO_SONAME 1) if(NOT GDCM_INSTALL_NO_LIBRARIES) @@ -295,7 +295,7 @@ if(GDCM_WRAP_CSHARP) if(UNIX) set_target_properties(${SWIG_MODULE_vtkgdcmsharpglue_REAL_NAME} PROPERTIES PREFIX "lib") endif() - target_link_libraries(${SWIG_MODULE_vtkgdcmsharpglue_REAL_NAME} ${vtkgdcm_LIBS}) + target_link_libraries(${SWIG_MODULE_vtkgdcmsharpglue_REAL_NAME} LINK_PRIVATE ${vtkgdcm_LIBS}) if(NOT GDCM_INSTALL_NO_LIBRARIES) install(TARGETS ${SWIG_MODULE_vtkgdcmsharpglue_REAL_NAME} EXPORT ${GDCM_TARGETS_NAME} @@ -673,13 +673,13 @@ if(GDCM_WRAP_JAVA) if(APPLE) set_target_properties(${VTKGDCM_NAME}Java PROPERTIES SUFFIX ".jnilib") endif() - target_link_libraries(${VTKGDCM_NAME}Java ${VTKGDCM_NAME}) + target_link_libraries(${VTKGDCM_NAME}Java LINK_PRIVATE ${VTKGDCM_NAME}) set_property(TARGET ${VTKGDCM_NAME}Java PROPERTY NO_SONAME 1) # By default link those module since APPLE and WIN32 needs fully resolved # shared lib allow advanced users to skip the link step: if(NOT GDCM_NO_VTKJAVA_LIBS_LINKING) foreach(c ${vtkgdcm_LIBS}) - target_link_libraries(${VTKGDCM_NAME}Java ${c}Java) + target_link_libraries(${VTKGDCM_NAME}Java LINK_PRIVATE ${c}Java) endforeach() endif() # Create the jar file: @@ -757,18 +757,18 @@ if(GDCM_WRAP_PYTHON) add_library(${VTKGDCM_NAME}Python MODULE ${VTKGDCM_NAME}PythonInit.cxx) # do not set the version on the Python module: #set_target_properties(${VTKGDCM_NAME}Python PROPERTIES ${GDCM_LIBRARY_PROPERTIES}) - target_link_libraries(${VTKGDCM_NAME}PythonD ${VTKGDCM_NAME} ${PYTHON_LIBRARY}) + target_link_libraries(${VTKGDCM_NAME}PythonD LINK_PRIVATE ${VTKGDCM_NAME} ${PYTHON_LIBRARY}) foreach(c ${vtkgdcm_LIBS}) - target_link_libraries(${VTKGDCM_NAME}PythonD ${c}Python${DEXTENSION}) + target_link_libraries(${VTKGDCM_NAME}PythonD LINK_PRIVATE ${c}Python${DEXTENSION}) endforeach() if(TARGET vtkPythonCore) - target_link_libraries(${VTKGDCM_NAME}PythonD vtkPythonCore) + target_link_libraries(${VTKGDCM_NAME}PythonD LINK_PRIVATE vtkPythonCore) endif() - target_link_libraries(${VTKGDCM_NAME}Python ${VTKGDCM_NAME}PythonD) + target_link_libraries(${VTKGDCM_NAME}Python LINK_PRIVATE ${VTKGDCM_NAME}PythonD) if(NOT GDCM_NO_PYTHON_LIBS_LINKING) - target_link_libraries(${VTKGDCM_NAME}Python ${PYTHON_LIBRARY}) + target_link_libraries(${VTKGDCM_NAME}Python LINK_PRIVATE ${PYTHON_LIBRARY}) endif() - set_property(TARGET ${VTKGDCM_NAME}PythonD PROPERTY LINK_INTERFACE_LIBRARIES "") + #set_property(TARGET ${VTKGDCM_NAME}PythonD PROPERTY LINK_INTERFACE_LIBRARIES "") set_property(TARGET ${VTKGDCM_NAME}Python PROPERTY NO_SONAME 1) #set_property(TARGET ${VTKGDCM_NAME}PythonD PROPERTY NO_SONAME 1) # Removing lib prefix if we are at VTK7. Based on a reply by David Gobbi to diff --git a/Utilities/doxygen/man/gdcmdump.xml b/Utilities/doxygen/man/gdcmdump.xml index 8dae04c..b059700 100644 --- a/Utilities/doxygen/man/gdcmdump.xml +++ b/Utilities/doxygen/man/gdcmdump.xml @@ -53,7 +53,8 @@ dcm_directory DICOM input directory -C --csa print SIEMENS CSA Header (0029,[12]0,SIEMENS CSA HEADER). --csa-asl print decoded SIEMENS CSA MR_ASL (base64). --csa-diffusion print decoded SIEMENS CSA MRDiffusion (base64). - --mrprotocol print SIEMENS CSA MrProtocol only (within ASCCONV BEGIN/END). + --mrprotocol print SIEMENS MrProtocol only (within ASCCONV BEGIN/END). + either encapsulated in CSA or directly (syngo XA10) -P --pdb print GEMS Protocol Data Block (0025,1b,GEMS_SERS_01). --elscint print ELSCINT Protocol Information (01f7,26,ELSCINT1). --vepro print VEPRO Protocol Information (0055,20,VEPRO VIF 3.0 DATA). diff --git a/Utilities/doxygen/man/gdcmtar.xml b/Utilities/doxygen/man/gdcmtar.xml index 5d43f5b..8c3f053 100644 --- a/Utilities/doxygen/man/gdcmtar.xml +++ b/Utilities/doxygen/man/gdcmtar.xml @@ -40,12 +40,12 @@ file-out DICOM output filename <refsection xml:id="gdcmtar_1specific_options"> <title>specific options</title> -<para><literallayout> --enhance enhance (default) - -U --unenhance unenhance - -M --mosaic Split SIEMENS Mosaic image into multiple frames. - --mosaic-private When splitting SIEMENS Mosaic image into multiple frames, ppreserve private attributes (advanced user only). - -p --pattern Specify trailing file pattern. - --root-uid Root UID. +<para><literallayout> --enhance Enhance (default) + -U --unenhance Unenhance + -M --mosaic Split SIEMENS Mosaic image into multiple frames. + --mosaic-private When splitting SIEMENS Mosaic image into multiple frames, preserve private attributes (advanced user only). + -p --pattern Specify trailing file pattern. + --root-uid Root UID. </literallayout></para> </refsection> <refsection xml:id="gdcmtar_1general_options"> @@ -139,7 +139,7 @@ NumberOfDimensions: 2 Dimensions: (64,64,1) ... </literallayout></para> -<para>By default all private attributes are removed since they may not match the newly generated SOP Instance. One way to preserver the private attributes is to use the --mosaic-private command line option</para> +<para>By default all private attributes are removed since they may not match the newly generated SOP Instance. One way to preserve the private attributes is to use the --mosaic-private command line option</para> <para><literallayout>$ gdcmtar --mosaic --mosaic-private -i MR-sonata-3D-as-Tile.dcm -o mosaic --pattern %03d.dcm </literallayout></para> diff --git a/Wrapping/Csharp/CMakeLists.txt b/Wrapping/Csharp/CMakeLists.txt index c1a838c..8ea1ded 100644 --- a/Wrapping/Csharp/CMakeLists.txt +++ b/Wrapping/Csharp/CMakeLists.txt @@ -28,6 +28,9 @@ SWIG_LINK_LIBRARIES(gdcmsharpglue gdcmMSFF gdcmMEXD ) set_target_properties(${SWIG_MODULE_gdcmsharpglue_REAL_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "") +if(UNIX) +set_target_properties(${SWIG_MODULE_gdcmsharpglue_REAL_NAME} PROPERTIES PREFIX "lib") +endif() set_property(TARGET ${SWIG_MODULE_gdcmsharpglue_REAL_NAME} PROPERTY NO_SONAME 1) # Module are always place in the library destination but for poor win32 user I diff --git a/Wrapping/Python/gdcmswig.i b/Wrapping/Python/gdcmswig.i index 26722ee..21a71d8 100644 --- a/Wrapping/Python/gdcmswig.i +++ b/Wrapping/Python/gdcmswig.i @@ -439,7 +439,7 @@ EXTEND_CLASS_PRINT(gdcm::Image) %include "gdcmFragment.h" EXTEND_CLASS_PRINT(gdcm::Fragment) // convert SWIGTYPE_p_std__vectorT_gdcm__Fragment_t__size_type -//%template() std::vector< gdcm::Fragment >; +%template(fragmentVector) std::vector< gdcm::Fragment >; // -> error: ‘type_name’ is not a member of ‘swig::traits<gdcm::Fragment>’ (swig 3.0.7) %include "gdcmPDBElement.h" EXTEND_CLASS_PRINT(gdcm::PDBElement) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/gdcm.git _______________________________________________ debian-med-commit mailing list debian-med-commit@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit