Closed alipairon closed 1 year ago
Many thanks for sharing this information! Moving it to the Discussion Board, as it's not a bug or issue.
Compiling the getdcmtags binary can be done using the following commands:
sudo apt-get update
sudo apt-get install qt5-qmake qtbase5-dev qtbase5-dev-tools libdcmtk-dev
cd /opt/mercure/app/getdcmtags
qmake
make
Could you please provide more information on the compilation of DCMTK process with libiconv? @tblock79 @alipairon @joshy @RoyWiggins
This is the output of my ccmake .
command:
BUILD_APPS ON
BUILD_SHARED_LIBS OFF
CMAKE_BUILD_TYPE Release
CMAKE_INSTALL_PREFIX /usr/local
DCMTK_DEFAULT_DICT external
DCMTK_ENABLE_CHARSET_CONVERSIO libiconv
DCMTK_ENABLE_LFS lfs64
DCMTK_ENABLE_PRIVATE_TAGS OFF
DCMTK_ENABLE_STL OFF
DCMTK_LINK_STATIC OFF
DCMTK_MODULES ofstd;oflog;dcmdata;dcmimgle;dcmimage;dcmjpeg;dcmjpls;dcmtls;dcmnet;dcmsr;dcmsign;dcmwlm;dcmqrdb;dcmpstat;dcmrt;dcmiod;dcmfg;dcmseg;dc
DCMTK_PORTABLE_LINUX_BINARIES OFF
DCMTK_WITH_DOXYGEN OFF
DCMTK_WITH_ICONV ON
DCMTK_WITH_ICU OFF
DCMTK_WITH_OPENSSL ON
DCMTK_WITH_PNG OFF
DCMTK_WITH_STDLIBC_ICONV OFF
DCMTK_WITH_THREADS ON
DCMTK_WITH_TIFF OFF
DCMTK_WITH_WRAP OFF
DCMTK_WITH_XML OFF
DCMTK_WITH_ZLIB ON
ICU_INCLUDE_DIR ICU_INCLUDE_DIR-NOTFOUND
OpenJPEG_DIR OpenJPEG_DIR-NOTFOUND
And this is the output of my dcmdump --version
command:
$dcmtk: dcmdump v3.6.7 2022-04-22 $
dcmdump: Dump DICOM file and data set
Host type: x86_64-Linux
Character encoding: UTF-8
Build options: shared threads lfs extern-dict dcmdictpath char-conv
External libraries used:
- ZLIB, Version 1.2.11
- LIBICONV, Version 1.16
If I try to execute dcmdump /vagrant/0.dcm --convert-to-utf8
I still get:
F: Cannot select source character set: SpecificCharacterSet (0008,0005) value 'ISO 2022 IR 100' not supported: converting file to UTF-8: /vagrant/0.dcm
Could you please provide more information on the compilation of DCMTK process? @tblock79 @alipairon @joshy @RoyWiggins
This is the output of my
ccmake .
command:BUILD_APPS ON BUILD_SHARED_LIBS OFF CMAKE_BUILD_TYPE Release CMAKE_INSTALL_PREFIX /usr/local DCMTK_DEFAULT_DICT external DCMTK_ENABLE_CHARSET_CONVERSIO libiconv DCMTK_ENABLE_LFS lfs64 DCMTK_ENABLE_PRIVATE_TAGS OFF DCMTK_ENABLE_STL OFF DCMTK_LINK_STATIC OFF DCMTK_MODULES ofstd;oflog;dcmdata;dcmimgle;dcmimage;dcmjpeg;dcmjpls;dcmtls;dcmnet;dcmsr;dcmsign;dcmwlm;dcmqrdb;dcmpstat;dcmrt;dcmiod;dcmfg;dcmseg;dc DCMTK_PORTABLE_LINUX_BINARIES OFF DCMTK_WITH_DOXYGEN OFF DCMTK_WITH_ICONV ON DCMTK_WITH_ICU OFF DCMTK_WITH_OPENSSL ON DCMTK_WITH_PNG OFF DCMTK_WITH_STDLIBC_ICONV OFF DCMTK_WITH_THREADS ON DCMTK_WITH_TIFF OFF DCMTK_WITH_WRAP OFF DCMTK_WITH_XML OFF DCMTK_WITH_ZLIB ON ICU_INCLUDE_DIR ICU_INCLUDE_DIR-NOTFOUND OpenJPEG_DIR OpenJPEG_DIR-NOTFOUND
And this is the output of my
dcmdump --version
command:$dcmtk: dcmdump v3.6.7 2022-04-22 $ dcmdump: Dump DICOM file and data set Host type: x86_64-Linux Character encoding: UTF-8 Build options: shared threads lfs extern-dict dcmdictpath char-conv External libraries used: - ZLIB, Version 1.2.11 - LIBICONV, Version 1.16
If I try to execute
dcmdump /vagrant/0.dcm --convert-to-utf8
I still get:F: Cannot select source character set: SpecificCharacterSet (0008,0005) value 'ISO 2022 IR 100' not supported: converting file to UTF-8: /vagrant/0.dcm
I've encountered a similar problem.
The SpecificCharacterSet is incorrect in this DICOM file, It can have 'ISO 2022 IR 100' value only when extensions are used. For example ISO 2022 IR 100 \ ISO 2022 IR 37 -> is correct bold ISO 2022 IR 100 -> is incorrect and this is causes the error. That's why dcmconv stumbles on such datasets.
In your case you need to either change the encoding to ISO_IR 100 in dataset manually, then dcmconv will work. Or create some workaround for such annoying problems in getdcmtags to mitigate such problems. I've done fix like that, it's not perfect but works for me:
if (tagSpecificCharacterSet.compare("ISO_IR 6") == 0)
{
// To prevent annoying DCMTK Warning in logs about charset
tagSpecificCharacterSet = "";
}
if (!charsetConverter.selectCharacterSet(tagSpecificCharacterSet).good())
{
// If the first attempt fails, try with "ISO_IR 100"
tagSpecificCharacterSet = "ISO_IR 100";
if (!charsetConverter.selectCharacterSet(tagSpecificCharacterSet).good())
{
std::cout << "ERROR: Unable to perform character set conversion with both character sets! " << std::endl;
std::cout << "ERROR: Incoming charset is " << tagSpecificCharacterSet << std::endl;
return 1;
}
}
Hello everyone! I've decided to contribute to community a little by creating this guide, which details how I compile getdcmtags after making some modifications. I hope I didn't forget anything.
getdcmtags with libiconv compilation Guide
This guide will help you to compile the
getdcmtags
application on Ubuntu 20.04 with libiconv. The steps may be similar for other Linux distributions. I prefer doing this on clean dedicated Ubuntu VM.Prerequisites
cmake
andccmake
installed on your Ubuntu 20.04 system.Installing libiconv
libiconv
archive.libiconv
:Installing DCMTK
DCMTK
archive.libiconv
is available and has been located correctly in the system.DCMTK
:dcmdump
.Building getdcmtags
With the prerequisites installed, you can now compile the
getdcmtags
application.getdcmtags
main.cpp
file.g++
:The compilation process should not take long. Once complete, you will have a
getdcmtags
binary ready for use.