About Orthanc and DCMDICTPATH

Hi, friends!

I’ve noticed something odd. When I run Orthanc without specifying the DCMDICTPATH environment variable, I get this:

2019-01-18T23:53:15.024560 INFO [7f65477f6700] PluginsManager.cpp:172 Tagging image with the following command: /usr/bin/dcmodify -i “(0069,0020)=RDSL” -i “(0069,2001)=131” /var/orthanc/tmp/d5dc-b3ee-1f98-4372
E: DcmDataDictionary: Cannot open file: /usr/share/libdcmtk12
W: no data dictionary loaded, check environment variable: DCMDICTPATH
W: DcmItem: Length of element (7fe0,0010) is not a multiple of 2 (VR=OW)

But when I do specify it, I get this:

2019-01-18T23:23:12.804872 INFO [7fccab845e40] FromDcmtkBridge.cpp:206 Using DCTMK version: 362
2019-01-18T23:23:12.856255 WARNING [7fccab845e40] FromDcmtkBridge.cpp:164 Loading the external DICOM dictionary “/usr/share/libdcmtk12/diconde.dic:/usr/share/libdcmtk12/acrnema.dic:/usr/share/libdcmtk12/private.dic:/usr/share/libdcmtk12/dicom.dic/dicom.dic”
E: DcmDataDictionary: Cannot open file: /usr/share/libdcmtk12/diconde.dic:/usr/share/libdcmtk12/acrnema.dic:/usr/share/libdcmtk12/private.dic:/usr/share/libdcmtk12/dicom.dic/dicom.dic
2019-01-18T23:23:12.857114 ERROR [7fccab845e40] main.cpp:1324 Uncaught exception, stopping now: [Internal error] (code -1)
2019-01-18T23:23:12.857236 WARNING [7fccab845e40] main.cpp:1357 Orthanc has stopped

The second time around, as it seems, Orthanc tries to append a “/dicom” to the value of DCMDICTPATH treating it as purely a directory only to abort right after that. But DCMTK itself will try to conform to its specification (ref: https://support.dcmtk.org/docs/file_envvars.html).

Upon close inspection of the FromDdcmtkBridge.cpp, I found this:

const char* env = std::getenv(DCM_DICT_ENVIRONMENT_VARIABLE);
if (env != NULL)
{
path = std::string(env);
}

LoadExternalDictionary(*locker, path, “dicom.dic”);

if (loadPrivateDictionary)
{
LoadExternalDictionary(*locker, path, “private.dic”);
}
else
{
LOG(INFO) << “The dictionary of private tags has not been loaded”;
}

And from Resources/WebAssembly/dcdict.h:

/// environment variable pointing to the data dictionary file
#define DCM_DICT_ENVIRONMENT_VARIABLE “DCMDICTPATH”

Oddly enough, it started after I switched to compiling Orthanc with USE_SYSTEM_DCMTK=ON.

Unfortunatelly, private tagging is paramount to our solution.

Was this corrected in later versions? Still, if this has been dealt with in more recent versions, then I’ll gladly switch to said version or even the mainline. For the record, I’m running 1.3.2 (yeppers old, but that’s for another day).

Thanks!

Hello,

This is a discrepancy about how Orthanc and DCMTK interpret the DCMDICTPATH environment variable.

Please introduce an issue so that we can work on a fix:
https://bitbucket.org/sjodogne/orthanc/issues?status=new&status=open

Sébastien-

Hi, Sébastien!

I just created the issue #126. Here’s the link:

https://bitbucket.org/sjodogne/orthanc/issues/126/orthanc-and-dcmdictpath

Thank you so much!