Skip to content

Commit

Permalink
GDCM 2020-02-12 (f1797c61)
Browse files Browse the repository at this point in the history
Code extracted from:

    http://git.code.sf.net/p/gdcm/gdcm.git

at commit f1797c61e24b4257b5059d56df38ee4d6a27302d (release).

Change-Id: I77b78b75f5f9d2beab0fa8980e95d00e6b3b7d5b
  • Loading branch information
GDCM Upstream authored and blowekamp committed Feb 12, 2020
1 parent 9c8a31d commit b49b0b8
Show file tree
Hide file tree
Showing 26 changed files with 3,587 additions and 3,567 deletions.
1 change: 1 addition & 0 deletions .gitattributes
@@ -0,0 +1 @@
* -whitespace
4 changes: 4 additions & 0 deletions CMakeLists.txt
Expand Up @@ -518,6 +518,10 @@ if(GDCM_STANDALONE)
mark_as_advanced(GDCM_USE_ACTIVIZ)
option(GDCM_USE_JPEGLS "Build GDCM with JPEG-LS support" ON)
mark_as_advanced(GDCM_USE_JPEGLS)
if(NOT DEFINED GDCM_DEFAULT_PYTHON_VERSION)
# override with cmake -DGDCM_DEFAULT_PYTHON_VERSION:STRING=2.7 if you dare
set(GDCM_DEFAULT_PYTHON_VERSION 3.2)
endif()
if(NOT DEFINED GDCM_DEFAULT_JAVA_VERSION)
# override with cmake -DGDCM_DEFAULT_JAVA_VERSION:STRING=1.5 if you dare
set(GDCM_DEFAULT_JAVA_VERSION 1.7)
Expand Down
1 change: 1 addition & 0 deletions Source/Common/gdcmOpenSSLCryptographicMessageSyntax.cxx
Expand Up @@ -288,6 +288,7 @@ bool OpenSSLCryptographicMessageSyntax::ParseCertificateFile( const char *keyfil
}
::BIO_free(in); in = NULL;
::sk_X509_push(recips, x509);
//::X509_free(x509);
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Common/gdcmWin32.h
Expand Up @@ -27,7 +27,7 @@
#define GDCM_EXPORT __declspec( dllimport )
#endif
#else
#if __GNUC__ >= 4
#if __GNUC__ >= 4 && defined(GDCM_BUILD_SHARED_LIBS)
#define GDCM_EXPORT __attribute__ ((visibility ("default")))
#define GDCM_LOCAL __attribute__ ((visibility ("hidden")))
#else
Expand Down
22 changes: 11 additions & 11 deletions Source/DataStructureAndEncodingDefinition/gdcmAttribute.h
Expand Up @@ -205,7 +205,7 @@ class Attribute

void SetFromDataElement(DataElement const &de) {
// This is kind of hackish but since I do not generate other element than the first one: 0x6000 I should be ok:
assert( GetTag() == de.GetTag() || GetTag().GetGroup() == 0x6000 || GetTag().GetGroup() == 0x5000 );
assert( Tag(Group,Element) == de.GetTag() || Group == 0x6000 || Group == 0x5000 );
assert( GetVR() != VR::INVALID );
assert( GetVR().Compatible( de.GetVR() ) || de.GetVR() == VR::INVALID ); // In case of VR::INVALID cannot use the & operator
if( de.IsEmpty() ) return;
Expand All @@ -224,13 +224,13 @@ class Attribute
}
}
void Set(DataSet const &ds) {
SetFromDataElement( ds.GetDataElement( GetTag() ) );
SetFromDataElement( ds.GetDataElement( Tag(Group,Element) ) );
}
void SetFromDataSet(DataSet const &ds) {
if( ds.FindDataElement( GetTag() ) &&
!ds.GetDataElement( GetTag() ).IsEmpty() )
if( ds.FindDataElement( Tag(Group,Element) ) &&
!ds.GetDataElement( Tag(Group,Element) ).IsEmpty() )
{
SetFromDataElement( ds.GetDataElement( GetTag() ) );
SetFromDataElement( ds.GetDataElement( Tag(Group,Element) ) );
}
}
protected:
Expand Down Expand Up @@ -416,7 +416,7 @@ class Attribute<Group,Element,TVR,VM::VM1>

// API to talk to the run-time layer: gdcm::DataElement
DataElement GetAsDataElement() const {
DataElement ret( GetTag() );
DataElement ret( Tag(Group,Element) );
std::ostringstream os;
// os.imbue(std::locale::classic()); // This is not required AFAIK
EncodingImplementation<VRToEncoding<TVR>::Mode>::Write(&Internal,
Expand All @@ -440,7 +440,7 @@ class Attribute<Group,Element,TVR,VM::VM1>

void SetFromDataElement(DataElement const &de) {
// This is kind of hackish but since I do not generate other element than the first one: 0x6000 I should be ok:
assert( GetTag() == de.GetTag() || GetTag().GetGroup() == 0x6000 || GetTag().GetGroup() == 0x5000 );
assert( Tag(Group,Element) == de.GetTag() || Group == 0x6000 || Group == 0x5000 );
assert( GetVR() != VR::INVALID );
assert( GetVR().Compatible( de.GetVR() ) || de.GetVR() == VR::INVALID ); // In case of VR::INVALID cannot use the & operator
if( de.IsEmpty() ) return;
Expand All @@ -459,13 +459,13 @@ class Attribute<Group,Element,TVR,VM::VM1>
}
}
void Set(DataSet const &ds) {
SetFromDataElement( ds.GetDataElement( GetTag() ) );
SetFromDataElement( ds.GetDataElement( Tag(Group,Element) ) );
}
void SetFromDataSet(DataSet const &ds) {
if( ds.FindDataElement( GetTag() ) &&
!ds.GetDataElement( GetTag() ).IsEmpty() )
if( ds.FindDataElement( Tag(Group,Element) ) &&
!ds.GetDataElement( Tag(Group,Element) ).IsEmpty() )
{
SetFromDataElement( ds.GetDataElement( GetTag() ) );
SetFromDataElement( ds.GetDataElement( Tag(Group,Element) ) );
}
}
protected:
Expand Down
3 changes: 2 additions & 1 deletion Source/MediaStorageAndFileFormat/gdcmPixelFormat.cxx
Expand Up @@ -130,6 +130,7 @@ void PixelFormat::SetScalarType(ScalarType st)
PixelFormat::ScalarType PixelFormat::GetScalarType() const
{
ScalarType type = PixelFormat::UNKNOWN;
gdcmAssertAlwaysMacro( BitsStored <= BitsAllocated );
switch( BitsAllocated )
{
case 0:
Expand Down Expand Up @@ -191,7 +192,7 @@ PixelFormat::ScalarType PixelFormat::GetScalarType() const
}
else
{
assert(0);
gdcmAssertAlwaysMacro(0);
}
}
return type;
Expand Down
11 changes: 11 additions & 0 deletions Source/MediaStorageAndFileFormat/gdcmRescaler.cxx
Expand Up @@ -146,6 +146,11 @@ static inline PixelFormat::ScalarType ComputeBestFit(const PixelFormat &pf, doub
{
st = PixelFormat::UINT32;
}
else if( max <= std::numeric_limits<uint64_t>::max() )
{
// very large value in Rescale Slope ?
return PixelFormat::FLOAT64;
}
else
{
gdcmErrorMacro( "Unhandled Pixel Format" );
Expand All @@ -169,6 +174,12 @@ static inline PixelFormat::ScalarType ComputeBestFit(const PixelFormat &pf, doub
{
st = PixelFormat::INT32;
}
else if( max <= std::numeric_limits<int64_t>::max()
&& min >= std::numeric_limits<int64_t>::min() )
{
// very large value in Rescale Slope ?
return PixelFormat::FLOAT64;
}
else
{
gdcmErrorMacro( "Unhandled Pixel Format" );
Expand Down

0 comments on commit b49b0b8

Please sign in to comment.