Skip to content

Commit

Permalink
Merge pull request InsightSoftwareConsortium#4275 from dzenanz/update…
Browse files Browse the repository at this point in the history
…GDCM

GDCM 2023-10-30 (b578ec5d)
  • Loading branch information
jhlegarreta authored Nov 3, 2023
2 parents b2ce962 + b4eac17 commit 2021303
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 31 deletions.
7 changes: 4 additions & 3 deletions Modules/ThirdParty/GDCM/src/gdcm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ option(GDCM_USE_SYSTEM_PAPYRUS3 "Use system papyrus3" OFF)
option(GDCM_USE_SYSTEM_SOCKETXX "Use system socket++" OFF)
option(GDCM_USE_SYSTEM_LJPEG "Use system ljpeg (ijg lib)" OFF)
option(GDCM_USE_SYSTEM_OPENJPEG "Use system openjpeg" OFF)
option(GDCM_USE_SYSTEM_CHARLS "Use system CharLS" OFF)
option(GDCM_USE_SYSTEM_CHARLS "Use system charls" OFF)
mark_as_advanced(
GDCM_USE_SYSTEM_ZLIB
GDCM_USE_SYSTEM_OPENSSL
Expand Down Expand Up @@ -352,8 +352,9 @@ else()
endif()

if(GDCM_USE_SYSTEM_CHARLS)
find_package(CharLS 2.0.0 REQUIRED)
set(GDCM_CHARLS_LIBRARIES ${CHARLS_LIBRARIES})
find_package(charls 2.2.0 REQUIRED)
set(GDCM_CHARLS_LIBRARIES charls)
message(STATUS "Found charls version " ${charls_VERSION})
else()
set(GDCM_CHARLS_LIBRARIES gdcmcharls)
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0019,0x00f0,"CANON_MEC_MR3^10",VR::SL,VM::VM1,"?",false },
{0x0019,0x00f1,"CANON_MEC_MR3^10",VR::FL,VM::VM1,"?",false },
{0x0019,0x00f1,"CANON_MEC_MR3^12",VR::LO,VM::VM1,"?",false },
{0x0019,0x00f1,"CANON_MEC_MR3^11",VR::SL,VM::VM3,"?",false },
{0x0019,0x00f1,"CANON_MEC_MR3^11",VR::SL,VM::VM3,"Diffusion b-value x Toshiba Orientation",false },
{0x0019,0x00f2,"CANON_MEC_MR3^10",VR::FL,VM::VM1,"?",false },
{0x0019,0x00f2,"CANON_MEC_MR3^11",VR::FL,VM::VM3,"?",false },
{0x0019,0x00f3,"CANON_MEC_MR3^10",VR::SL,VM::VM1,"?",false },
Expand Down Expand Up @@ -521,7 +521,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0021,0x001f,"CANON_MEC_MR3^10",VR::US,VM::VM1,"?",false },
{0x0021,0x0022,"CANON_MEC_MR3^10",VR::US,VM::VM1,"?",false },
{0x0021,0x0023,"CANON_MEC_MR3^10",VR::SS,VM::VM1,"?",false },
{0x0029,0x0001,"CANON_MEC_MR3^10",VR::SL,VM::VM1,"?",false },
{0x0029,0x0001,"CANON_MEC_MR3^10",VR::SL,VM::VM3,"Diffusion Gradient Orientation / Toshiba Orientation",false },
{0x0029,0x0005,"CANON_MEC_MR3^10",VR::SQ,VM::VM1,"?",false },
{0x0029,0x0006,"CANON_MEC_MR3^10",VR::FL,VM::VM1,"?",false },
{0x0029,0x0007,"CANON_MEC_MR3^10",VR::FL,VM::VM1,"?",false },
Expand All @@ -532,7 +532,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0029,0x0051,"CANON_MEC_MR3^10",VR::LO,VM::VM1,"?",false },
{0x0029,0x0052,"CANON_MEC_MR3^10",VR::LO,VM::VM1,"?",false },
{0x0029,0x0054,"CANON_MEC_MR3^10",VR::LO,VM::VM1,"?",false },
{0x0029,0x0067,"CANON_MEC_MR3^10",VR::FD,VM::VM4,"?",false },
{0x0029,0x0067,"CANON_MEC_MR3^10",VR::FD,VM::VM4,"Series Diffusion Info (b-value,x,y,z)",false },
{0x0029,0x0068,"CANON_MEC_MR3^10",VR::SS,VM::VM1,"?",false },
{0x0029,0x006e,"CANON_MEC_MR3^10",VR::OB,VM::VM1,"?",false },
{0x0029,0x0001,"CANON_MEC_MR3",VR::SQ,VM::VM1,"Other Private Data",false },
Expand Down Expand Up @@ -1025,7 +1025,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0019,0x00f0,"TOSHIBA_MEC_MR3^11",VR::SL,VM::VM4,"?",false },
{0x0019,0x00f1,"TOSHIBA_MEC_MR3^10",VR::FL,VM::VM1,"?",false },
{0x0019,0x00f1,"TOSHIBA_MEC_MR3^12",VR::LO,VM::VM1,"?",false },
{0x0019,0x00f1,"TOSHIBA_MEC_MR3^11",VR::SL,VM::VM3,"?",false },
{0x0019,0x00f1,"TOSHIBA_MEC_MR3^11",VR::SL,VM::VM3,"Diffusion b-value x Toshiba Orientation",false },
{0x0019,0x00f2,"TOSHIBA_MEC_MR3^10",VR::FL,VM::VM1,"?",false },
{0x0019,0x00f2,"TOSHIBA_MEC_MR3^11",VR::FL,VM::VM3,"?",false },
{0x0019,0x00f3,"TOSHIBA_MEC_MR3^10",VR::SL,VM::VM1,"?",false },
Expand Down Expand Up @@ -1077,7 +1077,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0021,0x001f,"TOSHIBA_MEC_MR3^10",VR::US,VM::VM1,"?",false },
{0x0021,0x0022,"TOSHIBA_MEC_MR3^10",VR::US,VM::VM1,"?",false },
{0x0021,0x0023,"TOSHIBA_MEC_MR3^10",VR::SS,VM::VM1,"?",false },
{0x0029,0x0001,"TOSHIBA_MEC_MR3^10",VR::SL,VM::VM1,"?",false },
{0x0029,0x0001,"TOSHIBA_MEC_MR3^10",VR::SL,VM::VM3,"Diffusion Gradient Orientation / Toshiba Orientation",false },
{0x0029,0x0005,"TOSHIBA_MEC_MR3^10",VR::SQ,VM::VM1,"?",false },
{0x0029,0x0006,"TOSHIBA_MEC_MR3^10",VR::FL,VM::VM1,"?",false },
{0x0029,0x0007,"TOSHIBA_MEC_MR3^10",VR::FL,VM::VM1,"?",false },
Expand All @@ -1088,7 +1088,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0029,0x0051,"TOSHIBA_MEC_MR3^10",VR::LO,VM::VM1,"?",false },
{0x0029,0x0052,"TOSHIBA_MEC_MR3^10",VR::LO,VM::VM1,"?",false },
{0x0029,0x0054,"TOSHIBA_MEC_MR3^10",VR::LO,VM::VM1,"?",false },
{0x0029,0x0067,"TOSHIBA_MEC_MR3^10",VR::FD,VM::VM4,"?",false },
{0x0029,0x0067,"TOSHIBA_MEC_MR3^10",VR::FD,VM::VM4,"Series Diffusion Info (b-value,x,y,z)",false },
{0x0029,0x0068,"TOSHIBA_MEC_MR3^10",VR::SS,VM::VM1,"?",false },
{0x0029,0x006e,"TOSHIBA_MEC_MR3^10",VR::OB,VM::VM1,"?",false },
{0x0029,0x0089,"TOSHIBA_MEC_MR3",VR::LO,VM::VM1,"?",false },
Expand Down Expand Up @@ -1770,7 +1770,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0021,0x001a,"PMTF INFORMATION DATA^10",VR::US,VM::VM1,"?num2?",false },
{0x0021,0x001d,"PMTF INFORMATION DATA^10",VR::IS,VM::VM1,"?num3?",false },
{0x0021,0x001f,"PMTF INFORMATION DATA^10",VR::US,VM::VM1,"?num?",false },
{0x0029,0x0001,"PMTF INFORMATION DATA^10",VR::SL,VM::VM3,"Diffusion Gradient Orientation / Toshiba Orientation ",false },
{0x0029,0x0001,"PMTF INFORMATION DATA^10",VR::SL,VM::VM3,"Diffusion Gradient Orientation / Toshiba Orientation",false },
{0x0029,0x0005,"PMTF INFORMATION DATA^10",VR::SQ,VM::VM1,"?seq?",false },
{0x0029,0x0006,"PMTF INFORMATION DATA^10",VR::FL,VM::VM1,"?num?",false },
{0x0029,0x0007,"PMTF INFORMATION DATA^10",VR::FL,VM::VM1,"?num?",false },
Expand Down Expand Up @@ -4045,7 +4045,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0x0011,0x0040,"GEMS_GDXE_FALCON_04",VR::SL,VM::VM1,"Pasting Overlap",false },
{0x0011,0x0041,"GEMS_GDXE_FALCON_04",VR::IS,VM::VM24,"Sub-image Collimator Vertices",false },
{0x0011,0x0042,"GEMS_GDXE_FALCON_04",VR::LO,VM::VM1,"View IP",false },
{0x0011,0x0043,"GEMS_GDXE_FALCON_04",VR::IS,VM::VM24,"Key-stone Co-ordinates",false },
{0x0011,0x0043,"GEMS_GDXE_FALCON_04",VR::IS,VM::VM24,"Key-stone Coordinates",false },
{0x0011,0x0044,"GEMS_GDXE_FALCON_04",VR::CS,VM::VM1,"Receptor Type",false },
{0x0011,0x0046,"GEMS_GDXE_FALCON_04",VR::LO,VM::VM1_n,"?",false },
{0x0011,0x0047,"GEMS_GDXE_FALCON_04",VR::DS,VM::VM1,"?",false },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3516,7 +3516,7 @@
<entry owner="GEMS_GDXE_FALCON_04" group="0011" element="xx40" vr="SL" vm="1" name="Pasting Overlap"/>
<entry owner="GEMS_GDXE_FALCON_04" group="0011" element="xx41" vr="IS" vm="24" name="Sub-image Collimator Vertices"/>
<entry owner="GEMS_GDXE_FALCON_04" group="0011" element="xx42" vr="LO" vm="1" name="View IP"/>
<entry owner="GEMS_GDXE_FALCON_04" group="0011" element="xx43" vr="IS" vm="24" name="Key-stone Co-ordinates"/>
<entry owner="GEMS_GDXE_FALCON_04" group="0011" element="xx43" vr="IS" vm="24" name="Key-stone Coordinates"/>
<entry owner="GEMS_GDXE_FALCON_04" group="0011" element="xx44" vr="CS" vm="1" name="Receptor Type"/>
<entry owner="GEMS_GDXE_FALCON_04" group="0011" element="xx46" vr="LO" vm="1-n" name="?"/>
<entry owner="GEMS_GDXE_FALCON_04" group="0011" element="xx47" vr="DS" vm="1" name="?"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class GDCM_EXPORT Preamble
}
Preamble& operator=(Preamble const &)
{
Internal = nullptr;
Create();
return *this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ class GDCM_EXPORT VR
// For some reason this seems slower on my linux box...
is.seekg(2, std::ios::cur );
#else
char dum[2];
is.read(dum, 2);
if( !(dum[0] == 0 && dum[1] == 0 ))
char dumb[2];
is.read(dumb, 2);
if( !(dumb[0] == 0 && dumb[1] == 0 ))
{
// JDDICOM_Sample4.dcm
gdcmDebugMacro( "32bits VR contains non zero bytes. Skipped" );
Expand All @@ -205,8 +205,8 @@ class GDCM_EXPORT VR
// See PS 3.5, Data Element Structure With Explicit VR
if( vrfield & VL32 )
{
const char dum[2] = {0, 0};
os.write(dum,2);
const char dumb[2] = {0, 0};
os.write(dumb,2);
}
return os;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Types specified in the Modules in Annex C shall be supported.
class GDCM_EXPORT IODEntry
{
public:
IODEntry(const char *name = "", const char *ref = "", const char *usag = ""):Name(name),Ref(ref),usage(usag) {
IODEntry(const char *name = "", const char *ref = "", const char *inUsage = ""):Name(name),Ref(ref),usage(inUsage) {
}
friend std::ostream& operator<<(std::ostream& _os, const IODEntry &_val);

Expand All @@ -64,7 +64,7 @@ class GDCM_EXPORT IODEntry
void SetRef(const char *ref) { Ref = ref; }
const char *GetRef() const { return Ref.c_str(); }

void SetUsage(const char *usag) { usage = usag; }
void SetUsage(const char *inUsage) { usage = inUsage; }
const char *GetUsage() const { return usage.c_str(); }
Usage::UsageType GetUsageType() const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ int StreamImageWriter::WriteRawHeader(RAWCodec* inCodec, std::ostream* inStream)
//Addition by Manoj
memcpy(&(tmpBuffer1[4*sizeof(uint16_t)]), &fifthTag, sizeof(uint32_t));// Data Element Length 4 bytes

// Basic OffSet Tabl with No Item Value
// Basic OffSet Table with No Item Value
memcpy(&(tmpBuffer1[4*sizeof(uint16_t)+sizeof(uint32_t)]), &sixthTag, sizeof(uint16_t)); //fffe
memcpy(&(tmpBuffer1[5*sizeof(uint16_t)+sizeof(uint32_t)]), &seventhTag, sizeof(uint16_t));//e000
memcpy(&(tmpBuffer1[6*sizeof(uint16_t)+sizeof(uint32_t)]), &eightthTag, sizeof(uint32_t));//00000000H
Expand Down
4 changes: 2 additions & 2 deletions Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcm_charls.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
/* Use the charls library configured for gdcm. */
#include "gdcmTypes.h"
#ifdef GDCM_USE_SYSTEM_CHARLS
// It is expected that version 2.0.0 is used
# include <CharLS/charls.h>
// It is expected that version >= 2.2.0 is used
# include <charls/charls.h>
#else
#include "gdcmcharls/charls.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmext/csa.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static bool read_info(struct app *self, struct csa_info *i) {
// syngodt (signed)
s = fread_mirror(&i->syngodt, sizeof i->syngodt, 1, self);
ERROR_RETURN(s, 1);
// numer of items
// number of items
s = fread_mirror(&i->nitems, sizeof i->nitems, 1, self);
if (self->csa_type == SV10) assert(i->nitems % 6 == 0);
ERROR_RETURN(s, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ static const struct mec_mr3_dict dict[] = {
{0x02, 0x0000a81c, 0xff003200, ""}, //
{0x02, 0x0000a81d, 0xff002a00, ""}, //
{0x02, 0x0000a822, 0x00000500, ""}, //
{0x02, 0x0000a823, 0xff002c00, "MR Acquition Type"}, //
{0x02, 0x0000a823, 0xff002c00, "MR Acquisition Type"}, //
{0x02, 0x0000a824, 0xff002400, ""}, //
{0x02, 0x0000a825, 0xff002400, ""}, //
{0x02, 0x0000a826, 0xff003200, ""}, //
Expand Down
16 changes: 11 additions & 5 deletions Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmext/mec_mr3_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
#include <stdlib.h>
#include <string.h>

#ifndef _MSC_VER
#if defined(_MSC_VER) || defined(__OpenBSD__)
#define GDCM_HAS_ICONV 0
#else
#define GDCM_HAS_ICONV 1
#endif

#if GDCM_HAS_ICONV
#include <iconv.h>
#endif
#if defined(_MSC_VER) && (_MSC_VER < 1900)
Expand Down Expand Up @@ -54,15 +60,15 @@ static size_t stream_read(void *ptr, size_t size, size_t nmemb,

struct app {
struct stream *in;
#ifndef _MSC_VER
#if GDCM_HAS_ICONV
iconv_t conv;
#endif
void *shift_jis_buffer;
};

static struct app *create_app(struct app *self, struct stream *in) {
self->in = in;
#ifndef _MSC_VER
#if GDCM_HAS_ICONV
self->conv = iconv_open("utf-8", "shift-jis");
assert(self->conv != (iconv_t)-1);
#endif
Expand Down Expand Up @@ -358,7 +364,7 @@ static char *shift_jis_to_utf8(char *str, size_t len, struct app *self) {
const size_t guesstimate = len < 128 ? 128 : len * 2;
self->shift_jis_buffer = realloc(self->shift_jis_buffer, guesstimate);
char *dest_str = self->shift_jis_buffer;
#ifndef _MSC_VER
#if GDCM_HAS_ICONV
char *in_str = str;
char *out_str = dest_str;
size_t inbytes = len;
Expand Down Expand Up @@ -842,7 +848,7 @@ bool mec_mr3_print(const void *input, size_t len) {
#else
free(data.buffer);
#endif
#ifndef _MSC_VER
#if GDCM_HAS_ICONV
iconv_close(self->conv);
#endif
free(self->shift_jis_buffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ patch -p0 < previous-gdcm.patch (5)


NOTE for later:
(shoud we disable getenv just as dcmtk ? there is a ijg flag for that NO_ENV or something similar
(should we disable getenv just as dcmtk ? there is a ijg flag for that NO_ENV or something similar

0 comments on commit 2021303

Please sign in to comment.