[med-svn] [Git][med-team/gdcm][upstream] New upstream version 3.0.12
Mathieu Malaterre (@malat)
gitlab at salsa.debian.org
Mon Apr 4 07:45:50 BST 2022
Mathieu Malaterre pushed to branch upstream at Debian Med / gdcm
Commits:
efc58a44 by Mathieu Malaterre at 2022-04-04T08:31:33+02:00
New upstream version 3.0.12
- - - - -
8 changed files:
- Applications/Cxx/CMakeLists.txt
- Applications/Cxx/gdcminfo.cxx
- Applications/Cxx/gdcmpdf.cxx
- CMakeLists.txt
- Source/Common/gdcmSwapper.txx
- Source/MediaStorageAndFileFormat/gdcmJPEGLSCodec.cxx
- Source/MediaStorageAndFileFormat/gdcmPGXCodec.cxx
- appveyor.yml
Changes:
=====================================
Applications/Cxx/CMakeLists.txt
=====================================
@@ -115,6 +115,12 @@ if(GDCM_USE_SYSTEM_POPPLER)
if(LIBPOPPLER_UNICODEMAP_HAS_CONSTMAPUNICODE)
list(APPEND libpoppler_flags -DLIBPOPPLER_UNICODEMAP_HAS_CONSTMAPUNICODE)
endif()
+ CHECK_CXX_SOURCE_COMPILES(
+ "\#include <poppler/PDFDoc.h>\nint main() { std::optional<GooString> ownerPW, userPW; PDFDoc d((BaseStream*)nullptr,ownerPW,userPW); return 0;}"
+ LIBPOPPLER_PDFDOC_HAS_OPTIONAL)
+ if(LIBPOPPLER_PDFDOC_HAS_OPTIONAL)
+ list(APPEND libpoppler_flags -DLIBPOPPLER_PDFDOC_HAS_OPTIONAL)
+ endif()
if(libpoppler_flags)
string(REPLACE ";" " " libpoppler_flags_string "${libpoppler_flags}")
set_source_files_properties(
=====================================
Applications/Cxx/gdcminfo.cxx
=====================================
@@ -497,9 +497,13 @@ static int ProcessOneFile( std::string const & filename, gdcm::Defs const & defs
#else
bv->GetLength(), &appearDict);
#endif
+#ifdef LIBPOPPLER_PDFDOC_HAS_OPTIONAL
+ std::optional<GooString> ownerPW, userPW;
+#else
GooString *ownerPW, *userPW;
ownerPW = NULL;
userPW = NULL;
+#endif
PDFDoc *doc;
doc = new PDFDoc(appearStream, ownerPW, userPW);
=====================================
Applications/Cxx/gdcmpdf.cxx
=====================================
@@ -25,6 +25,9 @@
#include <poppler/UnicodeMap.h>
#include <poppler/PDFDocEncoding.h>
#include <poppler/GlobalParams.h>
+#ifdef LIBPOPPLER_PDFDOC_HAS_OPTIONAL
+#include <poppler/PDFDocFactory.h>
+#endif
#endif
#include <string>
@@ -333,17 +336,27 @@ int main (int argc, char *argv[])
return 0;
}
+#ifdef LIBPOPPLER_PDFDOC_HAS_OPTIONAL
+ std::optional<GooString> ownerPW, userPW;
+#else
GooString *ownerPW, *userPW;
+#endif
GooString *fileName;
+#ifdef LIBPOPPLER_PDFDOC_HAS_OPTIONAL
+ std::unique_ptr<PDFDoc> doc;
+#else
PDFDoc *doc;
+#endif
Object info;
#ifdef LIBPOPPLER_UNICODEMAP_HAS_CONSTMAPUNICODE
const UnicodeMap *uMap;
#else
UnicodeMap *uMap;
#endif
+#ifndef LIBPOPPLER_PDFDOC_HAS_OPTIONAL
ownerPW = NULL;
userPW = NULL;
+#endif
#ifdef LIBPOPPLER_GLOBALPARAMS_CSTOR_HAS_PARAM
globalParams = new GlobalParams(0);
#else
@@ -376,7 +389,11 @@ int main (int argc, char *argv[])
#ifndef LIBPOPPLER_NEW_OBJECT_API
obj.initNull();
#endif
+#ifdef LIBPOPPLER_PDFDOC_HAS_OPTIONAL
+ doc = PDFDocFactory().createPDFDoc(*fileName, ownerPW, userPW);
+#else
doc = new PDFDoc(fileName, ownerPW, userPW);
+#endif
if (doc->isEncrypted())
{
@@ -405,8 +422,13 @@ return ch;
http://msdn.microsoft.com/en-us/library/078sfkak(VS.80).aspx
}
*/
+#ifdef LIBPOPPLER_PDFDOC_HAS_OPTIONAL
+ ownerPW = GooString( password.c_str() );
+ doc = PDFDocFactory().createPDFDoc(*fileName, ownerPW, userPW);
+#else
ownerPW = new GooString( password.c_str() );
doc = new PDFDoc(fileName, ownerPW, userPW);
+#endif
}
std::string title;
=====================================
CMakeLists.txt
=====================================
@@ -17,7 +17,7 @@ endif()
#----------------------------------------------------------------------------
project(GDCM
- VERSION 3.0.11
+ VERSION 3.0.12
LANGUAGES CXX C
)
## NOTE: the "DESCRIPTION" feature of project() was introduced in cmake 3.10.0
=====================================
Source/Common/gdcmSwapper.txx
=====================================
@@ -133,7 +133,10 @@ namespace gdcm
return tempF;
}
- template <> inline Tag SwapperNoOp::Swap<Tag>(Tag val);
+ template <> inline Tag SwapperNoOp::Swap<Tag>(Tag val)
+ {
+ return Tag( Swap(val.GetGroup()), Swap(val.GetElement()) );
+ }
template <> inline void SwapperNoOp::SwapArray(uint8_t *, size_t ) {}
@@ -206,7 +209,10 @@ namespace gdcm
return tempF;
}
- template <> inline Tag SwapperDoOp::Swap<Tag>(Tag val);
+ template <> inline Tag SwapperDoOp::Swap<Tag>(Tag val)
+ {
+ return Tag( Swap((uint32_t)val.GetElementTag()) );
+ }
template <> inline void SwapperDoOp::SwapArray(uint8_t *, size_t ) {}
=====================================
Source/MediaStorageAndFileFormat/gdcmJPEGLSCodec.cxx
=====================================
@@ -190,6 +190,10 @@ bool JPEGLSCodec::DecodeByStreamsCommon(const char *buffer, size_t totalLen, std
return false;
}
+ if( params.colorTransformation != charls::ColorTransformation::None )
+ {
+ gdcmWarningMacro( "APP8 marker found to contains a color transformation. This is an HP extension" );
+ }
// allowedlossyerror == 0 => Lossless
LossyFlag = params.allowedLossyError!= 0;
=====================================
Source/MediaStorageAndFileFormat/gdcmPGXCodec.cxx
=====================================
@@ -62,8 +62,16 @@ bool PGXCodec::Write(const char *filename, const DataElement &out) const
"You need to decompress first." );
return false;
}
+ gdcm::PhotometricInterpretation pi = this->GetPhotometricInterpretation();
+#if 0
+ if( pi != gdcm::PhotometricInterpretation::MONOCHROME2 ) {
+ gdcmErrorMacro( "Bogus PI" << pi );
+ return false;
+ }
+#endif
const unsigned int *dims = this->GetDimensions();
- size_t image_size = dims[0] * dims[1];
+ uint8_t pixelSize = pf.GetPixelSize ();
+ size_t image_size = dims[0] * dims[1] * pixelSize;
const char *img_buffer = bv->GetPointer();
for( unsigned int i = 0; i < num_images; ++i, img_buffer += image_size )
@@ -88,14 +96,55 @@ bool PGXCodec::Read(const char *filename, DataElement &out) const
{
(void)filename;
(void)out;
+ gdcmErrorMacro("TODO" );
return false;
}
-bool PGXCodec::GetHeaderInfo(std::istream &is, TransferSyntax &ts)
+bool PGXCodec::GetHeaderInfo(std::istream &is0, TransferSyntax &ts)
{
- (void)is;
- (void)ts;
- return false;
+ std::string str;
+ std::getline(is0, str);
+ {
+ std::istringstream is(str);
+ std::string str1, str2, sign;
+ int depth;
+ is >> str1;
+ if( str1 != "PG" ) {
+ gdcmErrorMacro("PGX Wrong header: " << str1 );
+ return false;
+ }
+ is >> str2;
+ if( str2 != "ML" ) {
+ gdcmErrorMacro("PGX Wrong header: " << str2 );
+ return false;
+ }
+ is >> sign;
+ if( sign != "+" && sign != "-" ) {
+ gdcmErrorMacro("PGX Wrong header: " << sign);
+ return false;
+ }
+ is >> depth;
+ if( depth <= 0 ) {
+ gdcmErrorMacro("PGX Wrong header: " << depth );
+ return false;
+ }
+ PhotometricInterpretation pi;
+ pi = PhotometricInterpretation::MONOCHROME2;
+ unsigned int dims[3] = {};
+ is >> dims[0]; is >> dims[1];
+ PixelFormat pf = GetPixelFormat();
+ unsigned int numbytes = ( depth + 7 ) / 8;
+ pf.SetBitsAllocated( numbytes * 8);
+ pf.SetBitsStored( depth );
+ if( sign[0] == '-' ) pf.SetPixelRepresentation(1);
+ ts = TransferSyntax::ExplicitVRLittleEndian;
+
+ SetPhotometricInterpretation( pi );
+ SetPixelFormat( pf );
+ SetDimensions( dims );
+ }
+
+ return true;
}
ImageCodec * PGXCodec::Clone() const
=====================================
appveyor.yml
=====================================
@@ -171,7 +171,7 @@ deploy:
artifact: nuget_package
- provider: GitHub
auth_token:
- secure: 7HmfZp9O7bVdQo2hRk6FjOUs7jJosftv2rZ6JPBNzjPcAOMXDTvLqv3lvzdAzBfy
+ secure: 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
release: $(appveyor_repo_tag_name)
description: 'Release of GDCM $(appveyor_repo_tag_name)'
# github automatically does source zip/tarball for us
View it on GitLab: https://salsa.debian.org/med-team/gdcm/-/commit/efc58a44c87d76d25ce42356fda685d7ef3b43e1
--
View it on GitLab: https://salsa.debian.org/med-team/gdcm/-/commit/efc58a44c87d76d25ce42356fda685d7ef3b43e1
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/20220404/780bac81/attachment-0001.htm>
More information about the debian-med-commit
mailing list