[med-svn] [gdcm] 01/04: New upstream version 2.6.8
Gert Wollny
gewo at moszumanska.debian.org
Tue May 23 11:38:41 UTC 2017
This is an automated email from the git hooks/post-receive script.
gewo pushed a commit to branch master
in repository gdcm.
commit ca2ab1c732a484b01f4bd84d4903d0d4269a3ebc
Author: Gert Wollny <gewo at debian.org>
Date: Tue May 23 10:42:57 2017 +0000
New upstream version 2.6.8
---
.travis.yml | 5 +
CMake/CTestCustom.ctest.in | 1 +
CMakeLists.txt | 6 +-
Examples/Cxx/CMakeLists.txt | 2 +
Examples/Cxx/EmptyMask.cxx | 234 +++++++++++++++++++++
Examples/Cxx/TemplateEmptyImage.cxx | 107 ++++++++++
Source/Common/gdcmSystem.cxx | 3 +
Source/Common/gdcmTesting.cxx | 1 +
Source/DataDictionary/gdcmPrivateDefaultDicts.cxx | 3 +
.../gdcmAttribute.h | 1 -
.../gdcmSequenceOfItems.h | 1 +
Source/MediaStorageAndFileFormat/CMakeLists.txt | 4 +
.../gdcmFileDerivation.cxx | 43 ++--
.../MediaStorageAndFileFormat/gdcmFileDerivation.h | 5 +
.../MediaStorageAndFileFormat/gdcmFileStreamer.cxx | 91 ++++----
.../MediaStorageAndFileFormat/gdcmImageHelper.cxx | 9 +-
.../gdcmImageRegionReader.cxx | 20 +-
.../MediaStorageAndFileFormat/gdcmImageWriter.cxx | 7 +-
.../MediaStorageAndFileFormat/gdcmPixmapReader.cxx | 2 +-
.../MediaStorageAndFileFormat/gdcmPixmapWriter.cxx | 18 +-
.../gdcmSplitMosaicFilter.cxx | 10 +-
Testing/Source/Common/Cxx/TestMD5.cxx | 1 +
Testing/Source/Common/Cxx/TestSHA1.cxx | 1 +
Testing/Source/Common/Cxx/TestSystem1.cxx | 2 +-
Testing/Source/Data/gdcmMD5DataImages.cxx | 1 +
Testing/Source/Data/gdcmMediaStorageDataFiles.cxx | 1 +
.../gdcmSelectedPrivateGroupOffsetDataFiles.cxx | 1 +
.../Data/gdcmSelectedTagsOffsetDataFiles.cxx | 1 +
Testing/Source/Data/gdcmStreamOffsetDataFiles.cxx | 1 +
.../Cxx/TestAttribute7.cxx | 25 +++
.../MediaStorageAndFileFormat/Cxx/TestPrinter1.cxx | 2 +
.../Cxx/TestSCUValidation.cxx | 3 +-
Utilities/VTK/CMakeLists.txt | 4 +-
Utilities/VTK/vtkGDCMPolyDataReader.cxx | 5 +-
Utilities/VTK/vtkImageMapToColors16.cxx | 7 +-
Utilities/VTK/vtkImageMapToColors16.h | 4 +
Utilities/socketxx/socket++/fork.cpp | 2 +-
37 files changed, 550 insertions(+), 84 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index fff24d5..a0c1ede 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -49,6 +49,8 @@ matrix:
env:
- CFLAGS="-Wall -Wextra" # -m64 -fsanitize=address,undefined
- 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_BUILD_DOCBOOK_MANPAGES:BOOL=OFF"
- B_NAME=default
- CPACK_NAME=Darwin
@@ -63,6 +65,9 @@ before_install:
- 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 python3 ; 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
# kakadu setup for linux/system:
- if [ "$B_NAME" == "system" ]; then wget http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_Linux-x86-64_150710.zip; fi
- if [ "$B_NAME" == "system" ]; then unzip KDU77_Demo_Apps_for_Linux-x86-64_150710.zip; fi
diff --git a/CMake/CTestCustom.ctest.in b/CMake/CTestCustom.ctest.in
index 1f06319..9a5aa45 100644
--- a/CMake/CTestCustom.ctest.in
+++ b/CMake/CTestCustom.ctest.in
@@ -34,6 +34,7 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION
"Nested struct not currently supported"
"bootstrap class path not set in conjunction with"
"warning CS1699"
+ "has been explicitly marked deprecated here"
)
# Disable dynamic analysis on some tests:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8c8a130..96f89f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,9 @@ endif()
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif()
+if(POLICY CMP0026)
+ cmake_policy(SET CMP0026 OLD)
+endif()
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
@@ -32,7 +35,7 @@ set(GDCM_PACKAGE_CONTACT "GDCM Developers <gdcm-developers at lists.sourceforge.net
#----------------------------------------------------------------------------
set(GDCM_MAJOR_VERSION 2)
set(GDCM_MINOR_VERSION 6)
-set(GDCM_BUILD_VERSION 7)
+set(GDCM_BUILD_VERSION 8)
set(GDCM_VERSION
"${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
# let advanced user the option to define GDCM_API_VERSION:
@@ -409,6 +412,7 @@ endif()
if(GDCM_USE_SYSTEM_ZLIB)
# If user say so, then this is a requirement !
find_package(ZLIB REQUIRED)
+ include_directories(${ZLIB_INCLUDE_DIR})
set(GDCM_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
else()
set(GDCM_ZLIB_LIBRARIES "gdcmzlib")
diff --git a/Examples/Cxx/CMakeLists.txt b/Examples/Cxx/CMakeLists.txt
index a9b4c88..65cec74 100644
--- a/Examples/Cxx/CMakeLists.txt
+++ b/Examples/Cxx/CMakeLists.txt
@@ -32,6 +32,8 @@ mark_as_advanced(QT_QMAKE_EXECUTABLE)
endif()
set(EXAMPLES_SRCS
+ EmptyMask
+ TemplateEmptyImage
MakeTemplate
FixOrientation
DumpGEMSMovieGroup
diff --git a/Examples/Cxx/EmptyMask.cxx b/Examples/Cxx/EmptyMask.cxx
new file mode 100644
index 0000000..f829a22
--- /dev/null
+++ b/Examples/Cxx/EmptyMask.cxx
@@ -0,0 +1,234 @@
+/*=========================================================================
+
+ Program: GDCM (Grassroots DICOM). A DICOM library
+
+ Copyright (c) 2006-2011 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.
+
+=========================================================================*/
+#include "gdcmImage.h"
+#include "gdcmImageWriter.h"
+#include "gdcmFileDerivation.h"
+#include "gdcmUIDGenerator.h"
+#include "gdcmImageRegionReader.h"
+#include "gdcmDirectory.h"
+#include "gdcmScanner.h"
+#include "gdcmFilename.h"
+#include "gdcmFileStreamer.h"
+#include "gdcmAnonymizer.h"
+#include "gdcmAttribute.h"
+
+static gdcm::Tag t1(0x8,0x16);
+static gdcm::Tag t2(0x8,0x18);
+static gdcm::Tag t3(0x20,0xe);
+static gdcm::Tag t4(0x20,0x52);
+
+static bool EmptyMaskDICOMFile( gdcm::UIDGenerator & uid, const gdcm::Scanner & s,
+ const std::map< std::string, std::string > & seriesuidhash,
+ const std::map< std::string, std::string > & framerefuidhash,
+ const char * outfile, const char * filename )
+{
+ if( s.IsKey( filename ) )
+ {
+ gdcm::ImageRegionReader irr;
+ irr.SetFileName( filename );
+ const bool b3 = irr.ReadInformation();
+ (void)b3;
+ size_t buflen = irr.ComputeBufferLength();
+
+ // Step 2: DERIVED object
+ gdcm::FileDerivation fd;
+ const char * ReferencedSOPClassUID = s.GetValue (filename, t1);
+ const char * ReferencedSOPInstanceUID = s.GetValue (filename, t2);
+ if( !fd.AddReference( ReferencedSOPClassUID, ReferencedSOPInstanceUID ) )
+ {
+ //std::cerr << "AddRef: " << (ReferencedSOPClassUID ? ReferencedSOPClassUID : "") << "," << (ReferencedSOPInstanceUID ? ReferencedSOPInstanceUID : "") << std::endl;
+ std::cerr << "AddRef: " << filename << std::endl;
+ // This is not considered an error to not reference, eg. UID padded with 0
+ }
+
+ // CID 7202 Source Image Purposes of Reference
+ // DCM 121321 Mask image for image processing operation
+ fd.SetPurposeOfReferenceCodeSequenceCodeValue( 121321 );
+ // CID 7203 Image Derivation
+ // DCM 113047 Pixel by pixel mask
+ fd.SetDerivationCodeSequenceCodeValue( 113047 );
+ fd.SetDerivationDescription( "Empty Mask Derivation" );
+ fd.SetAppendDerivationHistory( true );
+ fd.SetFile( irr.GetFile() );
+ if( !fd.Derive() )
+ {
+ std::cerr << "Sorry could not derive using input info" << std::endl;
+ return false;
+ }
+
+ gdcm::Anonymizer ano;
+ ano.SetFile( fd.GetFile() );
+ ano.RemoveGroupLength();
+ ano.Replace (t2, uid.Generate());
+ const char * oldseriesuid = s.GetValue (filename, t3);
+ const char * oldframerefuid = s.GetValue (filename, t4);
+ if( oldseriesuid )
+ {
+ std::map< std::string, std::string >::const_iterator it1 = seriesuidhash.find( oldseriesuid );
+ ano.Replace (t3, it1->second.c_str() );
+ }
+ if( oldframerefuid )
+ {
+ std::map< std::string, std::string >::const_iterator it2 = framerefuidhash.find( oldframerefuid );
+ ano.Replace (t4, it2->second.c_str() );
+ }
+
+ {
+ gdcm::DataSet& ds = ano.GetFile().GetDataSet();
+ gdcm::Attribute<0x0008,0x0008> at3;
+ gdcm::Attribute<0x0008,0x0008> at4;
+ at3.SetFromDataSet( ds );
+ unsigned int nvalues = at3.GetNumberOfValues();
+ unsigned int newvalues = std::max( nvalues, 4u );
+ at4.SetNumberOfValues( newvalues );
+ // copy original ones:
+ for( unsigned int i = 0u; i < nvalues; ++i )
+ {
+ at4.SetValue(i, at3.GetValue(i) );
+ }
+ // Make up non empty values:
+ static const gdcm::CSComp values[] = {"DERIVED","SECONDARY","OTHER"};
+ for( unsigned int i = nvalues; i < 3u; ++i )
+ {
+ at4.SetValue(i, values[i] );
+ }
+ // why not:
+ at4.SetValue( 3u, "MASK" );
+ ds.Replace( at4.GetAsDataElement() );
+ }
+
+ gdcm::File & file = ano.GetFile();
+ gdcm::FileMetaInformation & fmi = file.GetHeader();
+ const gdcm::TransferSyntax & orits = fmi.GetDataSetTransferSyntax();
+ gdcm::TransferSyntax::TSType newts = gdcm::TransferSyntax::ImplicitVRLittleEndian;
+ if( orits.IsExplicit() )
+ {
+ newts = gdcm::TransferSyntax::ExplicitVRLittleEndian;
+ }
+ fmi.Clear();
+ fmi.SetDataSetTransferSyntax( newts );
+
+ gdcm::Writer w;
+ w.SetFile( ano.GetFile() );
+
+ // Set the filename:
+ w.SetFileName( outfile );
+ if( !w.Write() )
+ {
+ return false;
+ }
+ gdcm::FileStreamer fs;
+ fs.SetTemplateFileName(outfile);
+ fs.SetOutputFileName(outfile);
+ gdcm::Tag pixeldata (0x7fe0, 0x0010);
+ fs.CheckDataElement( pixeldata );
+ if( !fs.StartDataElement( pixeldata ) )
+ {
+ std::cerr << "StartDataElement" << std::endl;
+ return false;
+ }
+ {
+ const size_t chunk = 4096;
+ char bytes[chunk] = {};
+ const size_t nchunks = buflen / chunk;
+ const size_t remain = buflen % chunk;
+ for( size_t i = 0; i < nchunks; ++i )
+ {
+ // Read the source file into a byte array.
+ fs.AppendToDataElement( pixeldata, bytes, chunk );
+ }
+ fs.AppendToDataElement( pixeldata, bytes, remain );
+ }
+ if( !fs.StopDataElement( pixeldata ) )
+ {
+ // Most likely an issue with Pixel Data Length computation:
+ std::cerr << "StopDataElement" << std::endl;
+ return false;
+ }
+ }
+ else
+ {
+ std::cerr << "Not DICOM file: " << filename << std::endl;
+ return false;
+ }
+ return true;
+}
+
+int main(int, char *argv[])
+{
+ gdcm::FileMetaInformation::SetSourceApplicationEntityTitle( "EmptyMask" );
+ const char * dirname = argv[1];
+ const char * outdir = argv[2];
+ gdcm::System::FileIsDirectory( dirname );
+ gdcm::System::MakeDirectory( outdir );
+ gdcm::Directory d;
+ const unsigned int nfiles = d.Load( dirname, true );
+ (void)nfiles;
+ gdcm::Directory::FilenamesType const & filenames = d.GetFilenames();
+
+ gdcm::Trace::WarningOff();
+ gdcm::Trace::ErrorOff();
+
+ gdcm::Scanner s;
+ s.AddTag( t1 );
+ s.AddTag( t2 );
+ s.AddTag( t3 );
+ s.AddTag( t4 );
+ const bool b2 = s.Scan( filenames );
+ (void)b2;
+ gdcm::UIDGenerator uid;
+ int ret = 0;
+ std::map< std::string, std::string > seriesuidhash;
+ {
+ gdcm::Scanner::ValuesType vt = s.GetValues(t3);
+ for(
+ gdcm::Scanner::ValuesType::const_iterator it = vt.begin();
+ it != vt.end(); ++it )
+ {
+ const char * newseriesuid = uid.Generate();
+ seriesuidhash.insert(
+ std::make_pair( *it, newseriesuid ) );
+ }
+ }
+ std::map< std::string, std::string > framerefuidhash;
+ {
+ gdcm::Scanner::ValuesType vt = s.GetValues(t4);
+ // Frame of Reference are relative to Series UID
+ // http://dicom.nema.org/medical/Dicom/2015a/output/chtml/part03/sect_C.7.4.html
+ for(
+ gdcm::Scanner::ValuesType::const_iterator it = vt.begin();
+ it != vt.end(); ++it )
+ {
+ const char * newframerefuid = uid.Generate();
+ framerefuidhash.insert(
+ std::make_pair( *it, newframerefuid ) );
+ }
+ }
+ for( gdcm::Directory::FilenamesType::const_iterator it = filenames.begin(); it != filenames.end(); ++it )
+ {
+ const char * filename = it->c_str();
+ gdcm::Filename fn( filename );
+ std::string outfile = outdir;
+ outfile += '/';
+ outfile += fn.GetName();
+ if( !EmptyMaskDICOMFile( uid, s, seriesuidhash, framerefuidhash, outfile.c_str(), filename ) )
+ {
+ std::cerr << "Failure to EmptyMask" << std::endl;
+ gdcm::System::RemoveFile(outfile.c_str());
+ ret = 1;
+ }
+ }
+
+ return ret;
+}
diff --git a/Examples/Cxx/TemplateEmptyImage.cxx b/Examples/Cxx/TemplateEmptyImage.cxx
new file mode 100644
index 0000000..3e45ec0
--- /dev/null
+++ b/Examples/Cxx/TemplateEmptyImage.cxx
@@ -0,0 +1,107 @@
+/*=========================================================================
+
+ Program: GDCM (Grassroots DICOM). A DICOM library
+
+ Copyright (c) 2006-2011 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.
+
+=========================================================================*/
+#include "gdcmFileStreamer.h"
+#include "gdcmTag.h"
+#include "gdcmTrace.h"
+#include "gdcmImageRegionReader.h"
+#include "gdcmImageHelper.h"
+#include "gdcmWriter.h"
+#include "gdcmImageWriter.h"
+#include "gdcmTagKeywords.h"
+#include "gdcmUIDGenerator.h"
+
+int main(int argc, char *argv[])
+{
+ if( argc < 2 ) return 1;
+ const char * filename = argv[1];
+ gdcm::ImageRegionReader irr;
+ irr.SetFileName( filename );
+ const bool b3 = irr.ReadInformation();
+ std::cout << b3 << std::endl;
+ gdcm::Image & img = irr.GetImage();
+ std::cout << img << std::endl;
+ // const gdcm::Region & r = irr.GetRegion();
+ // std::cout << r << std::endl;
+ gdcm::ImageWriter w;
+ gdcm::File & file = w.GetFile();
+ gdcm::DataSet & ds = file.GetDataSet();
+
+ gdcm::UIDGenerator uid;
+ namespace kwd = gdcm::Keywords;
+ kwd::FrameOfReferenceUID frameref;
+ frameref.SetValue( uid.Generate() );
+ // ContentDate
+ char date[22];
+ const size_t datelen = 8;
+ int res = gdcm::System::GetCurrentDateTime(date);
+ (void)res;
+ kwd::ContentDate contentdate;
+ // Do not copy the whole cstring:
+ contentdate.SetValue( gdcm::DAComp( date, datelen ) );
+ ds.Insert( contentdate.GetAsDataElement() );
+ // ContentTime
+ const size_t timelen = 6 + 1 + 6; // time + milliseconds
+ kwd::ContentTime contenttime;
+ // Do not copy the whole cstring:
+ contenttime.SetValue( gdcm::TMComp(date+datelen, timelen) );
+ ds.Insert( contenttime.GetAsDataElement() );
+
+ gdcm::MediaStorage ms0 = w.ComputeTargetMediaStorage();
+ std::cout << ms0 << std::endl;
+ kwd::SeriesNumber seriesnumber = { 1 };
+ kwd::InstanceNumber instancenum = { 1 };
+ kwd::StudyID studyid = { "St1" };
+ kwd::PatientID patientid = { "P1" };
+ kwd::SOPClassUID sopclassuid;
+ kwd::PositionReferenceIndicator pri;
+ //kwd::Laterality lat;
+ //kwd::BodyPartExamined bodypartex = { "HEAD" };
+ kwd::BodyPartExamined bodypartex = { "ANKLE" };
+ kwd::PatientOrientation pator;
+ kwd::BurnedInAnnotation bia = { "NO" };
+ kwd::ConversionType convtype = { "SYN" };
+ kwd::PresentationLUTShape plutshape = { "IDENTITY" }; // MONOCHROME2
+ // gdcm will pick the Word in case Byte class is not compatible:
+ gdcm::MediaStorage ms = gdcm::MediaStorage::MultiframeGrayscaleByteSecondaryCaptureImageStorage;
+ sopclassuid.SetValue( ms.GetString() );
+ ds.Insert( instancenum.GetAsDataElement() );
+ ds.Insert( sopclassuid.GetAsDataElement() );
+ ds.Insert( seriesnumber.GetAsDataElement() );
+ ds.Insert( patientid.GetAsDataElement() );
+ ds.Insert( studyid.GetAsDataElement() );
+ ds.Insert( frameref.GetAsDataElement() );
+ ds.Insert( pri.GetAsDataElement() );
+ //ds.Insert( lat.GetAsDataElement() );
+ ds.Insert( bodypartex.GetAsDataElement() );
+ ds.Insert( pator.GetAsDataElement() );
+ ds.Insert( bia.GetAsDataElement() );
+ ds.Insert( convtype.GetAsDataElement() );
+ ds.Insert( plutshape.GetAsDataElement() );
+ // gdcm::MediaStorage ms1 = w.ComputeTargetMediaStorage();
+ // std::cout << ms1 << std::endl;
+ std::cout << ds << std::endl;
+ gdcm::PixelFormat & pf = img.GetPixelFormat();
+ pf.SetPixelRepresentation(0); // always overwrite
+ img.SetSlope(1);
+ img.SetIntercept(0);
+ w.SetImage( img );
+ w.SetFileName( "TemplateImage.dcm" );
+ if( !w.Write() )
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
diff --git a/Source/Common/gdcmSystem.cxx b/Source/Common/gdcmSystem.cxx
index 8a2f7e3..a33e533 100644
--- a/Source/Common/gdcmSystem.cxx
+++ b/Source/Common/gdcmSystem.cxx
@@ -140,6 +140,8 @@ const char * System::GetCWD()
bool System::MakeDirectory(const char *path)
{
+ if( !path || !*path )
+ return false;
if(System::FileExists(path))
{
return true;
@@ -975,6 +977,7 @@ static const char *CharsetAliasToName(const char *alias)
}
}
// We need to tell the user...
+ gdcmWarningMacro( "Could not find Charset from alias: " + alias );
return NULL;
}
#endif //_WIN32
diff --git a/Source/Common/gdcmTesting.cxx b/Source/Common/gdcmTesting.cxx
index b4c615b..f4c3031 100644
--- a/Source/Common/gdcmTesting.cxx
+++ b/Source/Common/gdcmTesting.cxx
@@ -441,6 +441,7 @@ static const LossyFile gdcmLossyFilenames[] = {
{ 1,"JPEGNote_bogus.dcm" },
{ 0,"RLEDebianBug816607Orig.dcm" },
{ 0,"IllegalGroup2ImplicitTS.dcm" },
+{ 0,"GE_MR_0025xx1bProtocolDataBlockXML.dcm" },
{ 0, NULL }
};
diff --git a/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx b/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx
index 67b4ff6..78b4b0c 100644
--- a/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx
+++ b/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx
@@ -37,6 +37,9 @@ typedef struct
} DICT_ENTRY;
static const DICT_ENTRY DICOMV3DataDict [] = {
+ {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 },
{0x0009,0x00ee,"MEDISO-1",VR::DT,VM::VM1,"?",false }, // ftp://dicom.nema.org/MEDICAL/dicom/DataSets/WG30/Mediso/PETCT/Rat%20C-2-3%20PETCT/Compliance/testratc23enhancedpet2.dcm.dcdump.txt
{0x0009,0x00ef,"MEDISO-1",VR::DT,VM::VM1,"?",false },
{0x0009,0x00f0,"MEDISO-1",VR::FD,VM::VM1,"?",false },
diff --git a/Source/DataStructureAndEncodingDefinition/gdcmAttribute.h b/Source/DataStructureAndEncodingDefinition/gdcmAttribute.h
index af4d2a2..97f9400 100644
--- a/Source/DataStructureAndEncodingDefinition/gdcmAttribute.h
+++ b/Source/DataStructureAndEncodingDefinition/gdcmAttribute.h
@@ -631,7 +631,6 @@ public:
assert( Internal == 0 );
if( own ) // make a copy:
{
- assert( /*array &&*/ numel );
Internal = new ArrayType[numel];
if( array && numel )
std::copy(array, array+numel, Internal);
diff --git a/Source/DataStructureAndEncodingDefinition/gdcmSequenceOfItems.h b/Source/DataStructureAndEncodingDefinition/gdcmSequenceOfItems.h
index 5be8c57..fa3526e 100644
--- a/Source/DataStructureAndEncodingDefinition/gdcmSequenceOfItems.h
+++ b/Source/DataStructureAndEncodingDefinition/gdcmSequenceOfItems.h
@@ -82,6 +82,7 @@ public:
/// Index starts at 1 not 0
bool RemoveItemByIndex( const SizeType index );
+ bool IsEmpty() const { return Items.empty(); };
SizeType GetNumberOfItems() const { return Items.size(); }
void SetNumberOfItems(SizeType n) { Items.resize(n); }
diff --git a/Source/MediaStorageAndFileFormat/CMakeLists.txt b/Source/MediaStorageAndFileFormat/CMakeLists.txt
index 1034074..c531eb8 100644
--- a/Source/MediaStorageAndFileFormat/CMakeLists.txt
+++ b/Source/MediaStorageAndFileFormat/CMakeLists.txt
@@ -116,6 +116,10 @@ if(NOT BUILD_SHARED_LIBS)
PROPERTIES
COMPILE_FLAGS -DOPJ_STATIC
)
+ set_source_files_properties(gdcmJPEGLSCodec.cxx
+ PROPERTIES
+ COMPILE_DEFINITIONS CHARLS_STATIC
+ )
else()
set_source_files_properties(gdcmJPEGLSCodec.cxx
PROPERTIES
diff --git a/Source/MediaStorageAndFileFormat/gdcmFileDerivation.cxx b/Source/MediaStorageAndFileFormat/gdcmFileDerivation.cxx
index 63d6930..efa4394 100644
--- a/Source/MediaStorageAndFileFormat/gdcmFileDerivation.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmFileDerivation.cxx
@@ -188,11 +188,13 @@ static const CodeDefinition PurposeOfReferencetoAlternateRepresentation[] = {
class FileDerivationInternals
{
public:
- FileDerivationInternals():References(),DerivationCodeSequenceCodeValue(0),PurposeOfReferenceCodeSequenceCodeValue(0),DerivationDescription() {}
+ FileDerivationInternals():References(),DerivationCodeSequenceCodeValue(0),PurposeOfReferenceCodeSequenceCodeValue(0),DerivationDescription(),
+ AppendDerivationHistory(false) {}
std::vector< std::pair< std::string, std::string > > References;
unsigned int DerivationCodeSequenceCodeValue;
unsigned int PurposeOfReferenceCodeSequenceCodeValue;
std::string DerivationDescription;
+ bool AppendDerivationHistory;
};
FileDerivation::FileDerivation():F(new File),Internals(new FileDerivationInternals)
@@ -247,6 +249,11 @@ bool FileDerivation::AddReference(const char *referencedsopclassuid, const char
return true;
}
+void FileDerivation::SetAppendDerivationHistory(bool b)
+{
+ Internals->AppendDerivationHistory = b;
+}
+
/*
PS 3.3 - 2008 C.7.6.1.1.3 Derivation Description
If an Image is identified to be a derived image (see C.7.6.1.1.2 Image Type), Derivation
@@ -268,16 +275,15 @@ bool FileDerivation::AddDerivationDescription()
ds.Replace( at1.GetAsDataElement() );
}
-// ADD_DERIV: should we append the derivation after any existing one ?
-// For compat reason: always override the existing one
-//#define ADD_DERIV
const Tag sisq(0x8,0x9215);
SmartPointer<SequenceOfItems> sqi;
sqi = new SequenceOfItems;
-#ifdef ADD_DERIV
- if( ds.FindDataElement( sisq ) )
- sqi = ds.GetDataElement( sisq ).GetValueAsSQ();
-#endif
+ // should we append the derivation after any existing one ?
+ if( Internals->AppendDerivationHistory )
+ {
+ if( ds.FindDataElement( sisq ) )
+ sqi = ds.GetDataElement( sisq ).GetValueAsSQ();
+ }
sqi->SetLengthToUndefined();
Item item;
@@ -328,23 +334,19 @@ Derivation Description (0008,2111) or Derivation Code Sequence (0008,9215).
bool FileDerivation::AddSourceImageSequence()
{
File &file = GetFile();
+ DataSet &ds = file.GetDataSet();
const Tag sisq(0x8,0x2112);
SmartPointer<SequenceOfItems> sqi;
sqi = new SequenceOfItems;
- DataElement de( sisq);
- de.SetVR( VR::SQ );
- de.SetValue( *sqi );
- de.SetVLToUndefined();
- DataSet &ds = file.GetDataSet();
- ds.Insert( de );
-
- //sqi = (SequenceOfItems*)ds.GetDataElement( sisq ).GetSequenceOfItems();
- sqi = ds.GetDataElement( sisq ).GetValueAsSQ();
+ if( ds.FindDataElement( sisq ) )
+ {
+ sqi = ds.GetDataElement( sisq ).GetValueAsSQ();
+ }
sqi->SetLengthToUndefined();
- if( sqi->GetNumberOfItems() )
+ if( !Internals->AppendDerivationHistory && sqi->GetNumberOfItems() )
{
gdcmWarningMacro( "Do not support appending Referenced Image" );
return false;
@@ -376,6 +378,11 @@ bool FileDerivation::AddSourceImageSequence()
sqi->AddItem( item1 );
}
+ DataElement de( sisq);
+ de.SetVR( VR::SQ );
+ de.SetValue( *sqi );
+ de.SetVLToUndefined();
+ ds.Replace( de );
return true;
}
diff --git a/Source/MediaStorageAndFileFormat/gdcmFileDerivation.h b/Source/MediaStorageAndFileFormat/gdcmFileDerivation.h
index d3a3167..2a80290 100644
--- a/Source/MediaStorageAndFileFormat/gdcmFileDerivation.h
+++ b/Source/MediaStorageAndFileFormat/gdcmFileDerivation.h
@@ -63,6 +63,11 @@ public:
/// Specify the Derivation Description. Eg "lossy conversion"
void SetDerivationDescription( const char *dd );
+ /// Specify if Derivation history should be appended (default false)
+ /// When false, this is an error if input already has a derivation history
+ /// When true, both Purpose of Reference Code Value and Derivation Code Sequence Code Value can have their history appended.
+ void SetAppendDerivationHistory(bool b);
+
/// Change
bool Derive();
diff --git a/Source/MediaStorageAndFileFormat/gdcmFileStreamer.cxx b/Source/MediaStorageAndFileFormat/gdcmFileStreamer.cxx
index 895de2e..c5a6de2 100644
--- a/Source/MediaStorageAndFileFormat/gdcmFileStreamer.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmFileStreamer.cxx
@@ -319,6 +319,7 @@ public:
// no attribute found, easy case !
}
}
+ assert( pFile == NULL );
pFile = fopen(outfilename, "r+b");
assert( pFile );
CurrentDataLenth = 0;
@@ -357,26 +358,10 @@ public:
return false;
}
// insert new data in between
- FSeeko(pFile, thepos, SEEK_SET);
- std::stringstream ss;
const Tag tag = t;
- if( TS.GetSwapCode() == SwapCode::BigEndian )
- tag.Write<SwapperDoOp>(ss);
- else
- tag.Write<SwapperNoOp>(ss);
- if( TS.GetNegociatedType() == TransferSyntax::Explicit )
- {
- VR un = VR::UN;
- un.Write(ss);
- }
const VL vl = 0; // will be updated later (UpdateDataElement)
- if( TS.GetSwapCode() == SwapCode::BigEndian )
- vl.Write<SwapperDoOp>(ss);
- else
- vl.Write<SwapperNoOp>(ss);
- const std::string dicomdata = ss.str();
- fwrite(dicomdata.c_str(), 1, dicomdata.size(), pFile);
- assert( dicomdata.size() == dicomlen );
+ const size_t ddsize = WriteHelper( thepos, tag, vl );
+ assert( ddsize == dicomlen );
thepos += dicomlen;
}
else
@@ -470,7 +455,11 @@ public:
cols.SetFromDataSet( ds );
ba.SetFromDataSet( ds );
nframes.SetFromDataSet( ds );
- assert( ba.GetValue() % 8 == 0 );
+ if( ba.GetValue() % 8 != 0 )
+ {
+ gdcmErrorMacro( "old ACR NEMA file: " << ba.GetValue() );
+ return false;
+ }
const size_t computedlength = spp.GetValue() * nframes.GetValue() * rows.GetValue() * cols.GetValue() * ( ba.GetValue() / 8 );
if( computedlength != currentdatalenth )
{
@@ -597,7 +586,9 @@ public:
}
const size_t pclen = dicomdata.size();
+ assert( pFile == NULL );
pFile = fopen(outfilename, "r+b");
+ assert( pFile );
if( !prepare_file( pFile, (off64_t)thepcpos, pclen ) )
{
@@ -726,30 +717,36 @@ private:
}
vlpos -= 4; // Tag
gdcmAssertAlwaysMacro( vlpos >= 0 );
- FSeeko(pFile, vlpos, SEEK_SET);
- std::stringstream ss;
const Tag tag = t;
- if( TS.GetSwapCode() == SwapCode::BigEndian )
- tag.Write<SwapperDoOp>(ss);
- else
- tag.Write<SwapperNoOp>(ss);
- if( TS.GetNegociatedType() == TransferSyntax::Explicit )
- {
- VR un = VR::UN;
- un.Write(ss);
- }
gdcmAssertAlwaysMacro( CurrentDataLenth < std::numeric_limits<uint32_t>::max() );
const VL vl = (uint32_t)CurrentDataLenth;
- if( TS.GetSwapCode() == SwapCode::BigEndian )
- vl.Write<SwapperDoOp>(ss);
- else
- vl.Write<SwapperNoOp>(ss);
- const std::string dicomdata = ss.str();
- fwrite(dicomdata.c_str(), 1, dicomdata.size(), pFile);
+ size_t ret = WriteHelper( vlpos, tag, vl );
+ (void)ret;
CurrentDataLenth = 0;
}
return true;
}
+ size_t WriteHelper( off64_t offset, const Tag & tag, const VL & vl )
+ {
+ FSeeko(pFile, offset, SEEK_SET);
+ std::stringstream ss;
+ if( TS.GetSwapCode() == SwapCode::BigEndian )
+ tag.Write<SwapperDoOp>(ss);
+ else
+ tag.Write<SwapperNoOp>(ss);
+ if( TS.GetNegociatedType() == TransferSyntax::Explicit )
+ {
+ VR un = VR::UN;
+ un.Write(ss);
+ }
+ if( TS.GetSwapCode() == SwapCode::BigEndian )
+ vl.Write<SwapperDoOp>(ss);
+ else
+ vl.Write<SwapperNoOp>(ss);
+ const std::string dicomdata = ss.str();
+ fwrite(dicomdata.c_str(), 1, dicomdata.size(), pFile);
+ return dicomdata.size();
+ }
};
FileStreamer::FileStreamer()
@@ -797,10 +794,13 @@ bool FileStreamer::InitializeCopy()
Reader reader;
reader.SetFileName( filename );
if( !reader.Read() ) return false;
- Writer writer;
- writer.SetFileName( outfilename );
- writer.SetFile( reader.GetFile() );
- if( !writer.Write() ) return false;
+ if( strcmp( filename, outfilename ) )
+ {
+ Writer writer;
+ writer.SetFileName( outfilename );
+ writer.SetFile( reader.GetFile() );
+ if( !writer.Write() ) return false;
+ }
}
else
{
@@ -808,10 +808,13 @@ bool FileStreamer::InitializeCopy()
assert( outfilename );
std::ifstream is( filename, std::ios::binary );
if( !is.good() ) return false;
- std::ofstream of( outfilename, std::ios::binary );
- if( !of.good() ) return false;
- of << is.rdbuf();
- of.close();
+ if( strcmp( filename, outfilename ) )
+ {
+ std::ofstream of( outfilename, std::ios::binary );
+ if( !of.good() ) return false;
+ of << is.rdbuf();
+ of.close();
+ }
is.close();
}
this->Internals->InitializeCopy = true;
diff --git a/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx b/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx
index 8489aae..bd4ece5 100644
--- a/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx
@@ -63,7 +63,8 @@ static bool GetOriginValueFromSequence(const DataSet& ds, const Tag& tfgs, std::
if( !subds.FindDataElement(tpms) ) return false;
//const SequenceOfItems * sqi2 = subds.GetDataElement( tpms ).GetSequenceOfItems();
SmartPointer<SequenceOfItems> sqi2 = subds.GetDataElement( tpms ).GetValueAsSQ();
- assert( sqi2 );
+ if( sqi2 && !sqi2->IsEmpty() )
+ {
const Item &item2 = sqi2->GetItem(1);
const DataSet & subds2 = item2.GetNestedDataSet();
//
@@ -79,6 +80,8 @@ static bool GetOriginValueFromSequence(const DataSet& ds, const Tag& tfgs, std::
ori.push_back( at.GetValue(2) );
return true;
+ }
+ return false;
}
static bool GetDirectionCosinesValueFromSequence(const DataSet& ds, const Tag& tfgs, std::vector<double> &dircos)
@@ -969,12 +972,14 @@ std::vector<double> ImageHelper::GetRescaleInterceptSlopeValue(File const & f)
const DataElement &priv_rescaleslope = ds.GetDataElement( tpriv_rescaleslope );
Element<VR::DS,VM::VM1> el_ri = {{ 0 }};
el_ri.SetFromDataElement( priv_rescaleintercept );
- Element<VR::DS,VM::VM1> el_rs = {{ 0 }};
+ Element<VR::DS,VM::VM1> el_rs = {{ 1 }};
el_rs.SetFromDataElement( priv_rescaleslope );
if( PMSRescaleInterceptSlope )
{
interceptslope[0] = el_ri.GetValue();
interceptslope[1] = el_rs.GetValue();
+ if( interceptslope[1] == 0 )
+ interceptslope[1] = 1;
gdcmWarningMacro( "PMS Modality LUT loaded for MR Image Storage: [" << interceptslope[0] << "," << interceptslope[1] << "]" );
}
}
diff --git a/Source/MediaStorageAndFileFormat/gdcmImageRegionReader.cxx b/Source/MediaStorageAndFileFormat/gdcmImageRegionReader.cxx
index 8db02ed..9ad6d91 100644
--- a/Source/MediaStorageAndFileFormat/gdcmImageRegionReader.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmImageRegionReader.cxx
@@ -79,7 +79,19 @@ void ImageRegionReader::SetRegion(Region const & region)
Region const &ImageRegionReader::GetRegion() const
{
- return *Internals->GetRegion();
+ if( Internals->GetRegion() )
+ {
+ return *Internals->GetRegion();
+ }
+ else
+ {
+ static BoxRegion full;
+ std::vector<unsigned int> dims = ImageHelper::GetDimensionsValue(GetFile());
+ full.SetDomain(0, dims[0] - 1,
+ 0, dims[1] - 1,
+ 0, dims[2] - 1 );
+ return full;
+ }
}
size_t ImageRegionReader::ComputeBufferLength() const
@@ -96,20 +108,20 @@ size_t ImageRegionReader::ComputeBufferLength() const
npixels = this->Internals->GetRegion()->Area();
}
else
- {
+ {
std::vector<unsigned int> dims = ImageHelper::GetDimensionsValue(GetFile());
BoxRegion full;
// Use BoxRegion to do robust computation
full.SetDomain(0, dims[0] - 1,
0, dims[1] - 1,
0, dims[2] - 1 );
- if( full.IsValid() )
+ if(! full.IsValid() )
{
gdcmDebugMacro( "Sorry not a valid extent. Giving up" );
return 0;
}
npixels = full.Area();
- }
+ }
const PixelFormat pixelInfo = ImageHelper::GetPixelFormatValue(GetFile());
const size_t bytesPerPixel = pixelInfo.GetPixelSize();
return npixels*bytesPerPixel;
diff --git a/Source/MediaStorageAndFileFormat/gdcmImageWriter.cxx b/Source/MediaStorageAndFileFormat/gdcmImageWriter.cxx
index 3a7d4d5..489782f 100644
--- a/Source/MediaStorageAndFileFormat/gdcmImageWriter.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmImageWriter.cxx
@@ -59,10 +59,13 @@ MediaStorage ImageWriter::ComputeTargetMediaStorage()
}
// double check for Grayscale since they need specific pixel type
if( ms == MediaStorage::MultiframeGrayscaleByteSecondaryCaptureImageStorage
- || ms == MediaStorage::MultiframeGrayscaleWordSecondaryCaptureImageStorage )
+ || ms == MediaStorage::MultiframeGrayscaleWordSecondaryCaptureImageStorage
+ || ms == MediaStorage::MultiframeSingleBitSecondaryCaptureImageStorage
+ || ms == MediaStorage::MultiframeTrueColorSecondaryCaptureImageStorage )
{
+ // Always pretend to use number of dimension = 3 here:
ms = ImageHelper::ComputeMediaStorageFromModality( ms.GetModality(),
- PixelData->GetNumberOfDimensions(),
+ 3 /*PixelData->GetNumberOfDimensions()*/,
PixelData->GetPixelFormat(),
PixelData->GetPhotometricInterpretation(),
GetImage().GetIntercept(), GetImage().GetSlope() );
diff --git a/Source/MediaStorageAndFileFormat/gdcmPixmapReader.cxx b/Source/MediaStorageAndFileFormat/gdcmPixmapReader.cxx
index b87eaed..192e133 100644
--- a/Source/MediaStorageAndFileFormat/gdcmPixmapReader.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmPixmapReader.cxx
@@ -181,7 +181,7 @@ void DoIconImage(const DataSet& rootds, Pixmap& image)
//const SequenceOfItems* sq = iconimagesq.GetSequenceOfItems();
SmartPointer<SequenceOfItems> sq = iconimagesq.GetValueAsSQ();
// Is SQ empty ?
- if( !sq ) return;
+ if( !sq || sq->IsEmpty() ) return;
SequenceOfItems::ConstIterator it = sq->Begin();
const DataSet &ds = it->GetNestedDataSet();
diff --git a/Source/MediaStorageAndFileFormat/gdcmPixmapWriter.cxx b/Source/MediaStorageAndFileFormat/gdcmPixmapWriter.cxx
index 321e594..201e8da 100644
--- a/Source/MediaStorageAndFileFormat/gdcmPixmapWriter.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmPixmapWriter.cxx
@@ -496,9 +496,15 @@ bool PixmapWriter::PrepareWrite( MediaStorage const & ref_ms )
// Pixel Data
DataElement depixdata( Tag(0x7fe0,0x0010) );
- const Value &v = PixelData->GetDataElement().GetValue();
- depixdata.SetValue( v );
- const ByteValue *bvpixdata = depixdata.GetByteValue();
+ gdcm::DataElement & pde = PixelData->GetDataElement();
+ const ByteValue *bvpixdata = NULL;
+ // Sometime advanced user may use a gdcm::ImageRegionReader to feed an empty gdcm::Image
+ if( !pde.IsEmpty() )
+ {
+ const Value &v = PixelData->GetDataElement().GetValue();
+ depixdata.SetValue( v );
+ bvpixdata = depixdata.GetByteValue();
+ }
const TransferSyntax &ts = PixelData->GetTransferSyntax();
assert( ts.IsExplicit() || ts.IsImplicit() );
@@ -619,7 +625,11 @@ bool PixmapWriter::PrepareWrite( MediaStorage const & ref_ms )
depixdata.SetVR( VR::OB );
}
depixdata.SetVL( vl );
- ds.Replace( depixdata );
+ // Advanced user may have passed an empty image
+ if( !pde.IsEmpty() )
+ {
+ ds.Replace( depixdata );
+ }
// Do Icon Image
DoIconImage(ds, GetPixmap());
diff --git a/Source/MediaStorageAndFileFormat/gdcmSplitMosaicFilter.cxx b/Source/MediaStorageAndFileFormat/gdcmSplitMosaicFilter.cxx
index 15b56f7..1267ac2 100644
--- a/Source/MediaStorageAndFileFormat/gdcmSplitMosaicFilter.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmSplitMosaicFilter.cxx
@@ -144,7 +144,15 @@ bool SplitMosaicFilter::Split()
pixeldata.SetByteValue( &outbuf[0], outbufSize );
Image &image = GetImage();
-
+ const gdcm::TransferSyntax &ts = image.GetTransferSyntax();
+ if( ts.IsExplicit() )
+ {
+ image.SetTransferSyntax( gdcm::TransferSyntax::ExplicitVRLittleEndian );
+ }
+ else
+ {
+ image.SetTransferSyntax( gdcm::TransferSyntax::ImplicitVRLittleEndian );
+ }
image.SetNumberOfDimensions( 3 );
image.SetDimension(0, dims[0] );
image.SetDimension(1, dims[1] );
diff --git a/Testing/Source/Common/Cxx/TestMD5.cxx b/Testing/Source/Common/Cxx/TestMD5.cxx
index 51ceefe..bf22f26 100644
--- a/Testing/Source/Common/Cxx/TestMD5.cxx
+++ b/Testing/Source/Common/Cxx/TestMD5.cxx
@@ -238,6 +238,7 @@ static const char * const gdcmMD5SumFiles[][2] = {
{ "e49c403278663d9739014ad1d57c276f" , "IllegalGroup2ImplicitTS.dcm" },
{ "299df0175ea4d3ab1f02651f88ffe9f3" , "JPEG_LS_InvalidEscapeSequence_COM_padding.dcm" },
{ "9add5fd3c83cc0946633e792f448f732" , "LengthOfItemLarger.dcm" },
+{ "b9fdef839a6b6ab33486bfd6b35de3a8" , "GE_MR_0025xx1bProtocolDataBlockXML.dcm" },
{ NULL, NULL}
};
diff --git a/Testing/Source/Common/Cxx/TestSHA1.cxx b/Testing/Source/Common/Cxx/TestSHA1.cxx
index c383140..951dcd7 100644
--- a/Testing/Source/Common/Cxx/TestSHA1.cxx
+++ b/Testing/Source/Common/Cxx/TestSHA1.cxx
@@ -234,6 +234,7 @@ static const char * const gdcmSHA1SumFiles[][2] = {
{ "197e47b5afeeeb75eccafe04e5a1bb0af1a7957a" , "JPEGNote_empty.dcm" },
{ "08828e913a7a1ebbc0129c42974b64ce702814b6" , "JPEGNote_missing.dcm" },
{ "99c169688190a66100b61319eaeefb3db1936125" , "RLEDebianBug816607Orig.dcm" },
+{ "f18f91631b59f0242b5daca547878e4c5cbf6a5b" , "GE_MR_0025xx1bProtocolDataBlockXML.dcm" },
{ NULL, NULL}
};
diff --git a/Testing/Source/Common/Cxx/TestSystem1.cxx b/Testing/Source/Common/Cxx/TestSystem1.cxx
index b6b6d23..9e4f7ba 100644
--- a/Testing/Source/Common/Cxx/TestSystem1.cxx
+++ b/Testing/Source/Common/Cxx/TestSystem1.cxx
@@ -396,7 +396,7 @@ std::cerr << "found:" << ss2 << std::endl;
const char *codeset = gdcm::System::GetLocaleCharset();
if( !codeset )
{
-std::cerr << "Could nto find Charset on your system. Please report." << std::endl;
+std::cerr << "Could not find Charset on your system. Please report." << std::endl;
res++;
}
diff --git a/Testing/Source/Data/gdcmMD5DataImages.cxx b/Testing/Source/Data/gdcmMD5DataImages.cxx
index fbebb4d..afab7ff 100644
--- a/Testing/Source/Data/gdcmMD5DataImages.cxx
+++ b/Testing/Source/Data/gdcmMD5DataImages.cxx
@@ -698,6 +698,7 @@ static const char * const gdcmMD5DataImages[][2] = {
{ "464960d948dff0ded72b0380080f18a3" , "JPEGNote_missing.dcm" },
{ "161e9fd986ea87adf2596e8e16641f11" , "JPEGNote_bogus.dcm" },
+{ "ad8f1164f0517ee150bf510d5dba5cc6" , "GE_MR_0025xx1bProtocolDataBlockXML.dcm" },
/* Stopping condition */
diff --git a/Testing/Source/Data/gdcmMediaStorageDataFiles.cxx b/Testing/Source/Data/gdcmMediaStorageDataFiles.cxx
index b06982f..7c2fc68 100644
--- a/Testing/Source/Data/gdcmMediaStorageDataFiles.cxx
+++ b/Testing/Source/Data/gdcmMediaStorageDataFiles.cxx
@@ -248,6 +248,7 @@ static const char * const gdcmMediaStorageDataFiles[][2] = {
{ "IllegalGroup2ImplicitTS.dcm" , "1.2.840.10008.5.1.4.1.1.1" },
{ "JPEG_LS_InvalidEscapeSequence_COM_padding.dcm" , "1.2.840.10008.5.1.4.1.1.7" },
{ "LengthOfItemLarger.dcm" , "1.2.840.10008.5.1.4.1.1.4" },
+{ "GE_MR_0025xx1bProtocolDataBlockXML.dcm" , "1.2.840.10008.5.1.4.1.1.4" },
/* Stopping condition */
{ 0 ,0 }
diff --git a/Testing/Source/Data/gdcmSelectedPrivateGroupOffsetDataFiles.cxx b/Testing/Source/Data/gdcmSelectedPrivateGroupOffsetDataFiles.cxx
index 7cf3d7e..204f2f4 100644
--- a/Testing/Source/Data/gdcmSelectedPrivateGroupOffsetDataFiles.cxx
+++ b/Testing/Source/Data/gdcmSelectedPrivateGroupOffsetDataFiles.cxx
@@ -230,6 +230,7 @@ static const StreamOffset gdcmSelectedPrivateGroupOffsetDataFiles[] = {
{ "IllegalGroup2ImplicitTS.dcm", 1088 },
{ "JPEG_LS_InvalidEscapeSequence_COM_padding.dcm", 534 },
{ "LengthOfItemLarger.dcm", 1044 },
+{ "GE_MR_0025xx1bProtocolDataBlockXML.dcm",1358},
{ "dicomdir_With_embedded_icons",7125212 },
{ "dicomdir_Pms_WithVisit_WithPrivate_WithStudyComponents",37218 },
{ "dicomdir_Acusson_WithPrivate_WithSR",3826 },
diff --git a/Testing/Source/Data/gdcmSelectedTagsOffsetDataFiles.cxx b/Testing/Source/Data/gdcmSelectedTagsOffsetDataFiles.cxx
index add4b27..f921801 100644
--- a/Testing/Source/Data/gdcmSelectedTagsOffsetDataFiles.cxx
+++ b/Testing/Source/Data/gdcmSelectedTagsOffsetDataFiles.cxx
@@ -232,6 +232,7 @@ static const StreamOffset gdcmSelectedTagsOffsetDataFiles[] = {
{ "IllegalGroup2ImplicitTS.dcm", 2264 },
{ "JPEG_LS_InvalidEscapeSequence_COM_padding.dcm", 752 },
{ "LengthOfItemLarger.dcm", 12748 },
+{ "GE_MR_0025xx1bProtocolDataBlockXML.dcm",6462 },
{ "dicomdir_Acusson_WithPrivate_WithSR",3826 },
{ "dicomdir_Pms_WithVisit_WithPrivate_WithStudyComponents",37218 },
{ "dicomdir_Pms_With_heavy_embedded_sequence",3003414 },
diff --git a/Testing/Source/Data/gdcmStreamOffsetDataFiles.cxx b/Testing/Source/Data/gdcmStreamOffsetDataFiles.cxx
index f2b284d..a1c5336 100644
--- a/Testing/Source/Data/gdcmStreamOffsetDataFiles.cxx
+++ b/Testing/Source/Data/gdcmStreamOffsetDataFiles.cxx
@@ -237,6 +237,7 @@ static const StreamOffset gdcmStreamOffsetDataFiles[] = {
{ "IllegalGroup2ImplicitTS.dcm", 2272 },
{ "JPEG_LS_InvalidEscapeSequence_COM_padding.dcm", 764 },
{ "LengthOfItemLarger.dcm", 12748 },
+{ "GE_MR_0025xx1bProtocolDataBlockXML.dcm",6474 },
/* Stopping condition */
{ 0 ,0 },
diff --git a/Testing/Source/DataStructureAndEncodingDefinition/Cxx/TestAttribute7.cxx b/Testing/Source/DataStructureAndEncodingDefinition/Cxx/TestAttribute7.cxx
index 4b17670..25b96d2 100644
--- a/Testing/Source/DataStructureAndEncodingDefinition/Cxx/TestAttribute7.cxx
+++ b/Testing/Source/DataStructureAndEncodingDefinition/Cxx/TestAttribute7.cxx
@@ -15,6 +15,7 @@
int TestAttribute7(int, char *[])
{
+{
const char bytes[] = "\030\000e\020";
gdcm::DataElement de( gdcm::Tag(0x28,0x9) );
de.SetVR( gdcm::VR::INVALID );
@@ -27,6 +28,30 @@ int TestAttribute7(int, char *[])
gdcm::Attribute<0x3004, 0x0014> tissue;
//std::cout << tissue.GetVR() << std::endl;
if( tissue.GetVR() != gdcm::VR::CS ) return 1;
+}
+
+{
+ gdcm::Attribute<0x8,0x8> imagetype;
+ imagetype.SetNumberOfValues(0);
+ if( imagetype.GetNumberOfValues() != 0 ) return 1;
+
+ const char bytes[] = "ORIGINAL\\PRIMARY";
+ gdcm::DataElement de( gdcm::Tag(0x8,0x8) );
+ de.SetVR( gdcm::VR::INVALID );
+ de.SetByteValue( bytes, (uint32_t)strlen(bytes) );
+ gdcm::DataSet ds;
+ imagetype.SetFromDataSet( ds );
+ if( imagetype.GetNumberOfValues() != 0 ) return 1;
+ ds.Insert( de );
+ imagetype.SetFromDataSet( ds );
+ if( imagetype.GetNumberOfValues() != 2 ) return 1;
+ imagetype.SetNumberOfValues(0);
+ if( imagetype.GetNumberOfValues() != 0 ) return 1;
+ imagetype.SetFromDataSet( ds );
+ if( imagetype.GetNumberOfValues() != 2 ) return 1;
+
+
+}
return 0;
diff --git a/Testing/Source/MediaStorageAndFileFormat/Cxx/TestPrinter1.cxx b/Testing/Source/MediaStorageAndFileFormat/Cxx/TestPrinter1.cxx
index 4d6595b..bad3457 100644
--- a/Testing/Source/MediaStorageAndFileFormat/Cxx/TestPrinter1.cxx
+++ b/Testing/Source/MediaStorageAndFileFormat/Cxx/TestPrinter1.cxx
@@ -238,6 +238,7 @@ static const char * const printmd5[][2] = {
{ "807bf2aef3bc1885217c8a12d2d2bc19" , "JPEGNote_bogus.dcm" },
{ "669cc0e807673ebe57124739a1874f35" , "RLEDebianBug816607Orig.dcm" },
{ "1daa9bb53a8ce090041472f528248686" , "IllegalGroup2ImplicitTS.dcm" },
+{ "49542e6002129f42f86f25e840b6beed" , "GE_MR_0025xx1bProtocolDataBlockXML.dcm" },
{ 0 ,0 }
@@ -272,6 +273,7 @@ int TestPrint(const char *filename, bool verbose= false)
&& strcmp(name, "SIEMENS_GBS_III-16-ACR_NEMA_1.acr" ) != 0
&& strcmp(name, "LIBIDO-24-ACR_NEMA-Rectangle.dcm" ) != 0
&& strcmp(name, "NM_Kakadu44_SOTmarkerincons.dcm" ) != 0
+ && strcmp(name, "GE_MR_0025xx1bProtocolDataBlockXML.dcm" ) != 0
)
{
std::cerr << "UNKNOWN Attribute with : " << name << std::endl;
diff --git a/Testing/Source/MessageExchangeDefinition/Cxx/TestSCUValidation.cxx b/Testing/Source/MessageExchangeDefinition/Cxx/TestSCUValidation.cxx
index e0baa6d..e8811a5 100644
--- a/Testing/Source/MessageExchangeDefinition/Cxx/TestSCUValidation.cxx
+++ b/Testing/Source/MessageExchangeDefinition/Cxx/TestSCUValidation.cxx
@@ -27,7 +27,8 @@
static const char AETitle[] = "ANY";
static const char PeerAETitle[] = "ANY";
-static const char ComputerName[] = "213.165.94.158"; // www.dicomserver.co.uk
+//static const char ComputerName[] = "213.165.94.158"; // www.dicomserver.co.uk
+static const char ComputerName[] = "88.202.185.144"; // www.dicomserver.co.uk
static int port = 11112;
static gdcm::network::ULConnectionManager *GetConnectionManager(gdcm::BaseRootQuery* theQuery)
diff --git a/Utilities/VTK/CMakeLists.txt b/Utilities/VTK/CMakeLists.txt
index c6e451e..8363e1e 100644
--- a/Utilities/VTK/CMakeLists.txt
+++ b/Utilities/VTK/CMakeLists.txt
@@ -16,7 +16,9 @@ if(GDCM_HAVE_PTHREAD_H AND CMAKE_USE_PTHREADS)
)
endif()
-include(${VTK_USE_FILE})
+#if( ${VTK_VERSION_MAJOR} LESS 7 )
+ include(${VTK_USE_FILE})
+#endif()
if( ${VTK_MAJOR_VERSION} GREATER 5 )
list(APPEND vtkgdcm_SRCS
diff --git a/Utilities/VTK/vtkGDCMPolyDataReader.cxx b/Utilities/VTK/vtkGDCMPolyDataReader.cxx
index b3f86ba..e1221dd 100644
--- a/Utilities/VTK/vtkGDCMPolyDataReader.cxx
+++ b/Utilities/VTK/vtkGDCMPolyDataReader.cxx
@@ -509,7 +509,9 @@ refinstanceuid.GetValue().c_str() );
if( contgeotype.GetValue() == "CLOSED_PLANAR " )
{
- assert( nestedds2.FindDataElement( gdcm::Tag(0x3006,0x0016) ) );
+ // http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.8.8.6.html
+ if( nestedds2.FindDataElement( gdcm::Tag(0x3006,0x0016) ) )
+ {
const gdcm::DataElement &contourimagesequence = nestedds2.GetDataElement( gdcm::Tag(0x3006,0x0016) );
gdcm::SmartPointer<gdcm::SequenceOfItems> contourimagesequence_sqi = contourimagesequence.GetValueAsSQ();
assert( contourimagesequence_sqi && contourimagesequence_sqi->GetNumberOfItems() == 1 );
@@ -524,6 +526,7 @@ refinstanceuid.GetValue().c_str() );
this->RTStructSetProperties->AddContourReferencedFrameOfReference( pd,
classat.GetValue(), instat.GetValue() );
}
+ }
//newPts->SetNumberOfPoints( at.GetNumberOfValues() / 3 );
//assert( at.GetNumberOfValues() % 3 == 0); // FIXME
diff --git a/Utilities/VTK/vtkImageMapToColors16.cxx b/Utilities/VTK/vtkImageMapToColors16.cxx
index 768b27b..c172a40 100644
--- a/Utilities/VTK/vtkImageMapToColors16.cxx
+++ b/Utilities/VTK/vtkImageMapToColors16.cxx
@@ -66,7 +66,12 @@ vtkImageMapToColors16::~vtkImageMapToColors16()
}
//----------------------------------------------------------------------------
-unsigned long vtkImageMapToColors16::GetMTime()
+#ifdef VTK_HAS_MTIME_TYPE
+vtkMTimeType
+#else
+unsigned long
+#endif
+vtkImageMapToColors16::GetMTime()
{
unsigned long t1, t2;
diff --git a/Utilities/VTK/vtkImageMapToColors16.h b/Utilities/VTK/vtkImageMapToColors16.h
index da68905..70b76ec 100644
--- a/Utilities/VTK/vtkImageMapToColors16.h
+++ b/Utilities/VTK/vtkImageMapToColors16.h
@@ -85,7 +85,11 @@ public:
// Description:
// We need to check the modified time of the lookup table too.
+#ifdef VTK_HAS_MTIME_TYPE
+ virtual vtkMTimeType GetMTime();
+#else
virtual unsigned long GetMTime();
+#endif
protected:
vtkImageMapToColors16();
diff --git a/Utilities/socketxx/socket++/fork.cpp b/Utilities/socketxx/socket++/fork.cpp
index 2ff27da..20de944 100644
--- a/Utilities/socketxx/socket++/fork.cpp
+++ b/Utilities/socketxx/socket++/fork.cpp
@@ -8,7 +8,7 @@
//
// Version: 12Jan97 1.11
-#ifndef WIN32
+#ifndef _WIN32
#include <config.h>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/gdcm.git
More information about the debian-med-commit
mailing list