[med-svn] [Git][med-team/gdcm][upstream] New upstream version 3.0.8
Gert Wollny
gitlab at salsa.debian.org
Thu Nov 12 13:43:04 GMT 2020
Gert Wollny pushed to branch upstream at Debian Med / gdcm
Commits:
879e05ca by Gert Wollny at 2020-11-12T13:00:01+01:00
New upstream version 3.0.8
- - - - -
8 changed files:
- Applications/Cxx/gdcmtar.cxx
- CMakeLists.txt
- Source/Common/gdcmEvent.h
- Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
- Testing/Source/Data/gdcmMediaStorageDataFiles.cxx
- Testing/Source/MediaStorageAndFileFormat/Cxx/TestImageRegionReader1.cxx
- Testing/Source/MediaStorageAndFileFormat/Cxx/TestPixelFormat.cxx
- Wrapping/Python/docstrings.i
Changes:
=====================================
Applications/Cxx/gdcmtar.cxx
=====================================
@@ -813,15 +813,15 @@ static int MakeImageEnhanced( std::string const & filename, std::string const &o
namespace gdcm
{
-static const DataElement &GetNestedDataElement( const DataSet &ds, const Tag & t1, const Tag & t2 )
+static inline void ReplaceIf(DataSet &rootds, const DataSet &ds, const Tag & t1, const Tag & t2 )
{
- assert( ds.FindDataElement( t1 ) );
+ if( !ds.FindDataElement( t1 ) ) return ;
SmartPointer<SequenceOfItems> sqi1 = ds.GetDataElement( t1 ).GetValueAsSQ();
- assert( sqi1 );
+ if( !sqi1 || sqi1->IsEmpty() ) return ;
const Item &item1 = sqi1->GetItem(1);
const DataSet & ds1 = item1.GetNestedDataSet();
- assert( ds1.FindDataElement( t2 ) );
- return ds1.GetDataElement( t2 );
+ if( !ds1.FindDataElement( t2 ) ) return ;
+ rootds.Replace(ds1.GetDataElement( t2 ));
}
static bool RemapSharedIntoOld( gdcm::DataSet & ds,
@@ -837,53 +837,53 @@ static bool RemapSharedIntoOld( gdcm::DataSet & ds,
const DataSet & sfgs_ds = item1.GetNestedDataSet();
#if 1
// Repetition Time
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9112), Tag(0x0018,0x0080) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9112), Tag(0x0018,0x0080) );
// Echo Train Length
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9112), Tag(0x0018,0x0091) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9112), Tag(0x0018,0x0091) );
// Flip Angle
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9112), Tag(0x0018,0x1314) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9112), Tag(0x0018,0x1314) );
// Number of Averages
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9119), Tag(0x0018,0x0083) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9119), Tag(0x0018,0x0083) );
// Percent Sampling
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9125), Tag(0x0018,0x0093) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9125), Tag(0x0018,0x0093) );
// Percent Phase Field of View
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9125), Tag(0x0018,0x0094) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9125), Tag(0x0018,0x0094) );
// Receive Coil Name
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9042), Tag(0x0018,0x1250) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9042), Tag(0x0018,0x1250) );
// Transmit Coil Name
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9049), Tag(0x0018,0x1251) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9049), Tag(0x0018,0x1251) );
// InPlanePhaseEncodingDirection
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9125), Tag(0x0018,0x1312) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9125), Tag(0x0018,0x1312) );
// TransmitterFrequency
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9006), Tag(0x0018,0x9098) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9006), Tag(0x0018,0x9098) );
// InversionRecovery
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9115), Tag(0x0018,0x9009) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9115), Tag(0x0018,0x9009) );
// FlowCompensation
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9115), Tag(0x0018,0x9010) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9115), Tag(0x0018,0x9010) );
// ReceiveCoilType
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9042), Tag(0x0018,0x9043) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9042), Tag(0x0018,0x9043) );
// QuadratureReceiveCoil
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9042), Tag(0x0018,0x9044) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9042), Tag(0x0018,0x9044) );
// SlabThickness
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9107), Tag(0x0018,0x9104) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9107), Tag(0x0018,0x9104) );
// MultiCoilDefinitionSequence
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9042), Tag(0x0018,0x9045) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9042), Tag(0x0018,0x9045) );
// SlabOrientation
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9107), Tag(0x0018,0x9105) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9107), Tag(0x0018,0x9105) );
// MidSlabPosition
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9107), Tag(0x0018,0x9106) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9107), Tag(0x0018,0x9106) );
// OperatingModeSequence
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9112), Tag(0x0018,0x9176) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9112), Tag(0x0018,0x9176) );
// MRAcquisitionPhaseEncodingStepsOutOf
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9125), Tag(0x0018,0x9232) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9125), Tag(0x0018,0x9232) );
// SpecificAbsorptionRateSequence
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0018,0x9112), Tag(0x0018,0x9239) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0018,0x9112), Tag(0x0018,0x9239) );
// AnatomicRegionSequence
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0020,0x9071), Tag(0x0008,0x2218) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0020,0x9071), Tag(0x0008,0x2218) );
// Purpose of Reference Code Sequence
// FIXME what if there is multiple purpose of rcs ?
- ds.Replace( GetNestedDataElement(sfgs_ds, Tag(0x0008,0x1140), Tag(0x0040,0xa170) ) );
+ ReplaceIf(ds, sfgs_ds, Tag(0x0008,0x1140), Tag(0x0040,0xa170) );
#else
for(
DataSet::ConstIterator it = sfgs_ds.Begin();
@@ -898,44 +898,44 @@ static bool RemapSharedIntoOld( gdcm::DataSet & ds,
#if 1
// Effective Echo Time
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0018,0x9114), Tag(0x0018,0x9082) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0018,0x9114), Tag(0x0018,0x9082) );
// -> should also be Echo Time
// Nominal Cardiac Trigger Delay Time
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0018,0x9118), Tag(0x0020,0x9153) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0018,0x9118), Tag(0x0020,0x9153) );
// Metabolite Map Description
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0018,0x9152), Tag(0x0018,0x9080) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0018,0x9152), Tag(0x0018,0x9080) );
// IPP
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0020,0x9113), Tag(0x0020,0x0032) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0020,0x9113), Tag(0x0020,0x0032) );
// IOP
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0020,0x9116), Tag(0x0020,0x0037) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0020,0x9116), Tag(0x0020,0x0037) );
// Slice Thickness
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0028,0x9110), Tag(0x0018,0x0050) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0028,0x9110), Tag(0x0018,0x0050) );
// Pixel Spacing
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0028,0x9110), Tag(0x0028,0x0030) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0028,0x9110), Tag(0x0028,0x0030) );
// window level
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0028,0x9132), Tag(0x0028,0x1050) ) );
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0028,0x9132), Tag(0x0028,0x1051) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0028,0x9132), Tag(0x0028,0x1050) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0028,0x9132), Tag(0x0028,0x1051) );
// rescale slope/intercept
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0028,0x9145), Tag(0x0028,0x1052) ) );
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0028,0x9145), Tag(0x0028,0x1053) ) );
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0028,0x9145), Tag(0x0028,0x1054) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0028,0x9145), Tag(0x0028,0x1052) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0028,0x9145), Tag(0x0028,0x1053) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0028,0x9145), Tag(0x0028,0x1054) );
// FrameReferenceDateTime
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0020,0x9111), Tag(0x0018,0x9151) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0020,0x9111), Tag(0x0018,0x9151) );
// FrameAcquisitionDuration
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0020,0x9111), Tag(0x0018,0x9220) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0020,0x9111), Tag(0x0018,0x9220) );
// TemporalPositionIndex
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0020,0x9111), Tag(0x0020,0x9128) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0020,0x9111), Tag(0x0020,0x9128) );
// InStackPositionNumber
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0020,0x9111), Tag(0x0020,0x9057) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0020,0x9111), Tag(0x0020,0x9057) );
// FrameType
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0018,0x9226), Tag(0x0008,0x9007) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0018,0x9226), Tag(0x0008,0x9007) );
// DimensionIndexValues
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0020,0x9111), Tag(0x0020,0x9157) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0020,0x9111), Tag(0x0020,0x9157) );
// FrameAcquisitionDateTime
- ds.Replace( GetNestedDataElement(pffgs_ds, Tag(0x0020,0x9111), Tag(0x0018,0x9074) ) );
+ ReplaceIf(ds, pffgs_ds, Tag(0x0020,0x9111), Tag(0x0018,0x9074) );
// Nominal Cardiac Trigger Delay Time -> Trigger Time
//const DataElement &NominalCardiacTriggerDelayTime =
// GetNestedDataElement(pffgs_ds, Tag(0x0018,0x9226), Tag(0x0008,0x9007) );
@@ -1416,6 +1416,11 @@ int main (int argc, char *argv[])
const gdcm::DataElement &pixeldata = image.GetDataElement();
//const gdcm::ByteValue *bv = pixeldata.GetByteValue();
gdcm::SmartPointer<gdcm::ByteValue> bv = const_cast<gdcm::ByteValue*>(pixeldata.GetByteValue());
+ if( !bv )
+ {
+ std::cerr << "decompress first" << std::endl;
+ return 1;
+ }
unsigned long slice_len = image.GetBufferLength() / dims[2];
assert( slice_len * dims[2] == image.GetBufferLength() );
//assert( image.GetBufferLength() == bv->GetLength() );
@@ -1466,7 +1471,7 @@ int main (int argc, char *argv[])
char date[22];
const size_t datelen = 8;
- //int res = gdcm::System::GetCurrentDateTime(date);
+ gdcm::System::GetCurrentDateTime(date);
gdcm::Attribute<0x8,0x12> instcreationdate;
instcreationdate.SetValue( gdcm::DTComp( date, datelen ) );
ds.Replace( instcreationdate.GetAsDataElement() );
@@ -1514,6 +1519,7 @@ int main (int argc, char *argv[])
// gdcm::DataElement &pd = slice.GetDataElement();
const char *sliceptr = bv->GetPointer() + i * slice_len;
gdcm::DataElement newpixeldata( gdcm::Tag(0x7fe0,0x0010) );
+ newpixeldata.SetVR( pixeldata.GetVR() );
newpixeldata.SetByteValue( sliceptr, (uint32_t)slice_len); // slow !
ds.Replace( newpixeldata );
=====================================
CMakeLists.txt
=====================================
@@ -17,7 +17,7 @@ endif()
#----------------------------------------------------------------------------
project(GDCM
- VERSION 3.0.7
+ VERSION 3.0.8
LANGUAGES CXX C
)
## NOTE: the "DESCRIPTION" feature of project() was introduced in cmake 3.10.0
=====================================
Source/Common/gdcmEvent.h
=====================================
@@ -65,7 +65,7 @@ inline std::ostream& operator<<(std::ostream& os, Event &e)
typedef classname Self; \
typedef super Superclass; \
classname() {} \
- virtual ~classname() {} \
+ virtual ~classname() override = default; \
virtual const char * GetEventName() const { return #classname; } \
virtual bool CheckEvent(const ::gdcm::Event* e) const \
{ return dynamic_cast<const Self*>(e) ? true : false; } \
=====================================
Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
=====================================
@@ -1771,7 +1771,14 @@ bool JPEG2000Codec::DecodeExtent(
if( !raw_len.first || !raw_len.second ) return false;
// check pixel format *after* DecodeByStreamsCommon !
const PixelFormat & pf2 = this->GetPixelFormat();
- if( pf != pf2 ) return false;
+ if( pf.GetSamplesPerPixel() != pf2.GetSamplesPerPixel()
+ || pf.GetBitsAllocated() != pf2.GetBitsAllocated()
+ )
+ {
+ gdcmErrorMacro( "Invalid PixelFormat found (mismatch DICOM vs J2K)" );
+ return false;
+ }
+
char *raw = raw_len.first;
const unsigned int rowsize = xmax - xmin + 1;
=====================================
Testing/Source/Data/gdcmMediaStorageDataFiles.cxx
=====================================
@@ -260,6 +260,7 @@ static const char * const gdcmMediaStorageDataFiles[][2] = {
{ "Bug_Siemens_PrivateIconNoItem.dcm" , "1.2.840.10008.5.1.4.1.1.2" },
{ "HardcopyColor_YBR_RCT_J2K_PC1.dcm" , "1.2.840.10008.5.1.1.30" },
{ "PET-GE-dicomwrite-PixelDataSQUNv2.dcm" , "1.2.840.10008.5.1.4.1.1.128" },
+{ "PET-GE-dicomwrite-PixelDataSQUNv3.dcm" , "1.2.840.10008.5.1.4.1.1.128" },
/* Stopping condition */
{ nullptr ,nullptr }
=====================================
Testing/Source/MediaStorageAndFileFormat/Cxx/TestImageRegionReader1.cxx
=====================================
@@ -91,7 +91,7 @@ static int TestImageRegionRead(const char* filename, bool verbose = false)
if( verbose )
{
- std::cout << "ref=" << ref << std::endl;
+ if(ref) std::cout << "ref=" << ref << std::endl;
std::cout << "md5=" << digest << std::endl;
}
if( !ref )
=====================================
Testing/Source/MediaStorageAndFileFormat/Cxx/TestPixelFormat.cxx
=====================================
@@ -143,6 +143,7 @@ int TestPixelFormat(int , char *[])
if( pf4.GetScalarType() != gdcm::PixelFormat::INT16 ) return 1;
frame_info fi = {};
+ (void)fi;
return 0;
}
=====================================
Wrapping/Python/docstrings.i
=====================================
The diff for this file was not included because it is too large.
View it on GitLab: https://salsa.debian.org/med-team/gdcm/-/commit/879e05cae004551ebb92a7b1e679ae9aba847703
--
View it on GitLab: https://salsa.debian.org/med-team/gdcm/-/commit/879e05cae004551ebb92a7b1e679ae9aba847703
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20201112/e34a1a0c/attachment-0001.html>
More information about the debian-med-commit
mailing list