[Gdcm-hackers] gdcm-git:Grassroots DICOM branch master updated. 5712d7c867b5d5c092aa51f88f278577488
Cross-platform DICOM implementation
Brought to you by:
malat
|
From: Mathieu M. <ma...@us...> - 2018-10-05 13:25:21
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Grassroots DICOM".
The branch, master has been updated
via 5712d7c867b5d5c092aa51f88f278577488d32c4 (commit)
via 3c6384e031b461fc26220d13c4a468df7b33d050 (commit)
via ffd41562543200215540cab6af075ceaff167d05 (commit)
via 7b0f09501a7f0c3e1231555ed3dff1e252625f7c (commit)
from aad78fdc4df28a971f6956ed8c2c2cb3a730e3a5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceforge.net/p/gdcm/gdcm/ci/5712d7c867b5d5c092aa51f88f278577488d32c4/
commit 5712d7c867b5d5c092aa51f88f278577488d32c4
Merge: aad78fdc4 3c6384e03
Author: Mathieu Malaterre <mat...@gm...>
Date: Fri Oct 5 15:21:03 2018 +0200
Merge pull request #67 from erikced/fix-data-element-binary-input
Fix DataElement binary input
https://sourceforge.net/p/gdcm/gdcm/ci/3c6384e031b461fc26220d13c4a468df7b33d050/
commit 3c6384e031b461fc26220d13c4a468df7b33d050
Author: Erik Cederberg <eri...@am...>
Date: Fri Oct 5 11:10:29 2018 +0200
Change usage of SetByteValue to SetByteStringValue
diff --git a/Examples/Python/CreateRAWStorage.py b/Examples/Python/CreateRAWStorage.py
index c882d4691..9b204de30 100644
--- a/Examples/Python/CreateRAWStorage.py
+++ b/Examples/Python/CreateRAWStorage.py
@@ -33,7 +33,7 @@ if __name__ == "__main__":
# f = gdcm.File()
# ds = f.GetDataSet()
de = gdcm.DataElement( gdcm.Tag(0x0008,0x0016) )
- de.SetByteValue( uid, gdcm.VL(len(uid)) )
+ de.SetByteStringValue( uid )
vr = gdcm.VR( gdcm.VR.UI )
de.SetVR( vr )
ds.Replace( de )
@@ -138,7 +138,7 @@ if __name__ == "__main__":
#
# uid = gen.Generate()
# de.SetTag( gdcm.Tag(0x0008,0x0018) )
-# de.SetByteValue( uid, gdcm.VL(len(uid)) )
+# de.SetByteStringValue( uid )
# ds.Insert( de )
# init FMI now:
@@ -149,7 +149,7 @@ if __name__ == "__main__":
#print fmi.GetDataSetTransferSyntax()
#de.SetTag( gdcm.Tag(0x0002,0x0010) )
#uid = "1.2.840.10008.1.2"
- #de.SetByteValue( uid, gdcm.VL(len(uid)) )
+ #de.SetByteStringValue( uid )
#fmi.Insert( de )
# f.SetHeader( r.GetFile().GetHeader() )
diff --git a/Examples/Python/DecompressImage.py b/Examples/Python/DecompressImage.py
index 8d88bd3ea..c4e8aaff2 100644
--- a/Examples/Python/DecompressImage.py
+++ b/Examples/Python/DecompressImage.py
@@ -64,7 +64,7 @@ if __name__ == "__main__":
pixeldata = gdcm.DataElement( gdcm.Tag(0x7fe0,0x0010) )
str1 = ir.GetBuffer()
#print ir.GetBufferLength()
- pixeldata.SetByteValue( str1, gdcm.VL( len(str1) ) )
+ pixeldata.SetByteStringValue( str1 )
image.SetDataElement( pixeldata )
w.SetFileName( file2 )
diff --git a/Examples/Python/FindAllPatientName.py b/Examples/Python/FindAllPatientName.py
index 7bf4f101d..b110dd322 100644
--- a/Examples/Python/FindAllPatientName.py
+++ b/Examples/Python/FindAllPatientName.py
@@ -29,7 +29,7 @@ tag = gdcm.Tag(0x10,0x10)
de = gdcm.DataElement(tag)
# Search all patient name where string match 'F*'
-de.SetByteValue('F*',gdcm.VL(2))
+de.SetByteStringValue('F*')
ds = gdcm.DataSet()
ds.Insert(de)
diff --git a/Examples/Python/ManipulateSequence.py b/Examples/Python/ManipulateSequence.py
index 38766df3d..d40520348 100644
--- a/Examples/Python/ManipulateSequence.py
+++ b/Examples/Python/ManipulateSequence.py
@@ -64,7 +64,7 @@ if __name__ == "__main__":
if nestedds2.FindDataElement( tcm ):
cm = nestedds2.GetDataElement( tcm )
mystr = "GDCM was here"
- cm.SetByteValue( mystr, gdcm.VL( len(mystr) ) )
+ cm.SetByteStringValue( mystr )
w = gdcm.Writer()
w.SetFile( f )
diff --git a/Examples/Python/NewSequence.py b/Examples/Python/NewSequence.py
index df3879630..3e6ddbdbe 100644
--- a/Examples/Python/NewSequence.py
+++ b/Examples/Python/NewSequence.py
@@ -40,7 +40,7 @@ if __name__ == "__main__":
# Create a dataelement
de = gdcm.DataElement(gdcm.Tag(0x0010, 0x2180))
- de.SetByteValue("Occupation", gdcm.VL(len("Occupation")))
+ de.SetByteStringValue("Occupation")
de.SetVR(gdcm.VR(gdcm.VR.SH))
# Create an item
diff --git a/Testing/Source/MediaStorageAndFileFormat/Python/TestModifyFields.py b/Testing/Source/MediaStorageAndFileFormat/Python/TestModifyFields.py
index 675ef7d68..99f4a6c85 100644
--- a/Testing/Source/MediaStorageAndFileFormat/Python/TestModifyFields.py
+++ b/Testing/Source/MediaStorageAndFileFormat/Python/TestModifyFields.py
@@ -1,4 +1,4 @@
-############################################################################
+###########################################################################
#
# Program: GDCM (Grassroots DICOM). A DICOM library
#
@@ -35,15 +35,14 @@ def TestModifyFields(filename):
de = ds.GetDataElement( replacetag )
#print dir(de)
patname = "This^is^an^example"
- vl = gdcm.VL( len(patname) )
- de.SetByteValue( patname, vl )
+ de.SetByteStringValue( patname )
# let's insert a new dataelement
# <entry group="0012" element="0062" vr="CS" vm="1" name="Patient Identity Removed"/>
pir = gdcm.DataElement( gdcm.Tag(0x0012,0x0062) )
pir.SetVR( gdcm.VR( gdcm.VR.CS ) ) # specify the VR explicitly
yes = "YES"
- pir.SetByteValue( yes, gdcm.VL(len(yes)) )
+ pir.SetByteStringValue( yes )
ds.Insert( pir )
# try again but pretend we don't know the VR
@@ -56,8 +55,8 @@ def TestModifyFields(filename):
deid = gdcm.DataElement( deidmethod )
deid.SetVR( dictel.GetVR() )
methodstr = "Well known Company"
- #deid.SetByteValue( methodstr, gdcm.VL(len(methodstr)) )
- deid.SetByteValue( methodstr, gdcm.VL(len(methodstr)) )
+ #deid.SetByteStringValue( methodstr )
+ deid.SetByteStringValue( methodstr )
ds.Insert( deid )
#w = gdcm.Writer()
https://sourceforge.net/p/gdcm/gdcm/ci/ffd41562543200215540cab6af075ceaff167d05/
commit ffd41562543200215540cab6af075ceaff167d05
Author: Erik Cederberg <eri...@am...>
Date: Fri Oct 5 10:58:52 2018 +0200
Extend DataElement and CSAElement
Add a more pythonic single argument version of SetByteValue called
SetByteStringValue that takes a byte string (Python 2 str, Python 3 byte)
and extracts its length in the wrapper.
diff --git a/Wrapping/Python/gdcmswig.i b/Wrapping/Python/gdcmswig.i
index 21a71d8c8..0a2a6a1c2 100644
--- a/Wrapping/Python/gdcmswig.i
+++ b/Wrapping/Python/gdcmswig.i
@@ -328,7 +328,24 @@ EXTEND_CLASS_PRINT(gdcm::ByteValue)
%include "gdcmSmartPointer.h"
%template(SmartPtrSQ) gdcm::SmartPointer<gdcm::SequenceOfItems>;
%template(SmartPtrFrag) gdcm::SmartPointer<gdcm::SequenceOfFragments>;
+%typemap(in) (const char* array, uint32_t length) {
+ $1 = PyString_AsString($input);
+ if ($1 == NULL) {
+ SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '$symname', argument $argnum expected byte string.");
+ }
+ Py_ssize_t length = PyString_Size($input);
+ if (static_cast<size_t>(length) > std::numeric_limits<uint32_t>::max()) {
+ SWIG_exception_fail(SWIG_ArgError(SWIG_OverflowError), "in method '$symname', array in argument $argnum is too large.");
+ }
+ $2 = static_cast<uint32_t>(length);
+}
%include "gdcmDataElement.h"
+%extend gdcm::DataElement
+{
+ void SetByteStringValue(const char *array, uint32_t length) {
+ self->SetByteValue(array, gdcm::VL(length));
+ }
+}
EXTEND_CLASS_PRINT(gdcm::DataElement)
%include "gdcmItem.h"
EXTEND_CLASS_PRINT(gdcm::Item)
@@ -449,6 +466,12 @@ EXTEND_CLASS_PRINT(gdcm::PDBHeader)
EXTEND_CLASS_PRINT(gdcm::MrProtocol)
%include "gdcmCSAElement.h"
EXTEND_CLASS_PRINT(gdcm::CSAElement)
+%extend gdcm::CSAElement
+{
+ void SetByteStringValue(const char *array, uint32_t length) {
+ self->SetByteValue(array, gdcm::VL(length));
+ }
+}
%include "gdcmCSAHeader.h"
EXTEND_CLASS_PRINT(gdcm::CSAHeader)
%include "gdcmSequenceOfFragments.h"
https://sourceforge.net/p/gdcm/gdcm/ci/7b0f09501a7f0c3e1231555ed3dff1e252625f7c/
commit 7b0f09501a7f0c3e1231555ed3dff1e252625f7c
Author: Erik Cederberg <eri...@am...>
Date: Fri Oct 5 10:55:23 2018 +0200
Revert "Add python typemap for (const char *, gdcm::VL())"
Breaks current Python API.
This reverts commit 3c435a4939c81d5abd6fd964babcf8a9a8a56208.
diff --git a/Wrapping/Python/gdcmswig.i b/Wrapping/Python/gdcmswig.i
index 3b28757b9..21a71d8c8 100644
--- a/Wrapping/Python/gdcmswig.i
+++ b/Wrapping/Python/gdcmswig.i
@@ -22,19 +22,6 @@
// http://matt.eifelle.com/2008/11/04/exposing-an-array-interface-with-swig-for-a-cc-structure/
%module(docstring="A DICOM library",directors=1) gdcmswig
-
-%typemap(in) (const char* array, gdcm::VL length) {
- $1 = PyString_AsString($input);
- if ($1 == NULL) {
- SWIG_exception_fail(SWIG_TypeError, "in method '$symname', argument $argnum expected byte string.");
- }
- Py_ssize_t length = PyString_Size($input);
- if (length >= 0 && static_cast<uint32_t>(length) != static_cast<size_t>(length)) {
- SWIG_exception_fail(SWIG_OverflowError, "in method '$symname', array in argument $argnum is too large.");
- }
- $2 = gdcm::VL(length);
-}
-
// http://www.swig.org/Doc1.3/Warnings.html
// "There is no option to suppress all SWIG warning messages."
#pragma SWIG nowarn=302,303,312,362,383,389,401,503,504,509,510,514,516
-----------------------------------------------------------------------
Summary of changes:
Examples/Python/CreateRAWStorage.py | 6 ++--
Examples/Python/DecompressImage.py | 2 +-
Examples/Python/FindAllPatientName.py | 2 +-
Examples/Python/ManipulateSequence.py | 2 +-
Examples/Python/NewSequence.py | 2 +-
.../Python/TestModifyFields.py | 11 +++----
Wrapping/Python/gdcmswig.i | 36 ++++++++++++++--------
7 files changed, 35 insertions(+), 26 deletions(-)
hooks/post-receive
--
Grassroots DICOM
|