chir.set
(SET)
February 17, 2021, 9:55am
1
Hi,
My environment’s locale is fr_FR.UTF-8, which does not always plays well with Slicer, rarely though.
While exporting DICOM series that have accented characters to filesystem, it fails on non-ascii characters as such:
Failed to copy
to
/tmp/Slicer/A10000711888-PATIENT_NAME/20210210-ANGIOSCANNER MEMBRE INF/201-Images trait�es/000000.dcm
Halting export
The directory <201-Images traitées> is created on storage.
I fear it’s an issue that can’t be resolved as it relates deeply to Slicer’s internals.
I’m posting here for any magic solution.
Regards.
lassoan
(Andras Lasso)
February 17, 2021, 11:33am
2
Since you use UTF8 and latest Slicer Stable Release (or preview releases) uses UTF8 everywhere, there should be no problems with special characters.
What Slicer version and operating system do you use? Can you send the full application log?
chir.set
(SET)
February 17, 2021, 1:29pm
3
I have the same failure on self built and factory built Slicer on Arch Linux. Here is the application log from factory built :
Session start time …: 2021-02-17 14:21:33
Slicer version …: 4.13.0-2021-02-16 (revision 29713 / b691c46) linux-amd64 - installed release
Operating system …: Linux / 5.10.15-arch1-1 / #1 SMP PREEMPT Wed, 10 Feb 2021 18:32:40 +0000 - 64-bit
Memory …: 16006 MB physical, 16383 MB virtual
CPU …: AuthenticAMD AMD Phenom™ II X6 1100T Processor, 6 cores, 6 logical processors
VTK configuration …: OpenGL2 rendering, Sequential threading
Qt configuration …: version 5.15.1, with SSL, requested OpenGL 3.2 (core profile)
Developer mode enabled …: yes
Prefer executable CLI …: yes
Application path …: /home/user/programs/Test/Slicer-4.13.0-2021-02-16-linux-amd64/bin
Additional module paths …: (none)
Reversing DICOM dictionary so can look up tag from a keyword…
Scripted subject hierarchy plugin registered: Annotations
Scripted subject hierarchy plugin registered: SegmentEditor
Scripted subject hierarchy plugin registered: SegmentStatistics
Switch to module: “Volumes”
Assertion this->Table->columnWidth(j) == newWidth
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 242
Assertion this->Table->columnWidth(j) == newWidth
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 242
Assertion this->Table->columnWidth(j) == newWidth
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 242
Assertion this->Table->columnWidth(j) == newWidth
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 242
Assertion this->Table->rowHeight(i) == newHeight
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 253
Assertion this->Table->rowHeight(i) == newHeight
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 253
Assertion this->Table->rowHeight(i) == newHeight
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 253
Assertion this->Table->rowHeight(i) == newHeight
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 253
Assertion this->Table->rowHeight(i) == newHeight
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 253
Assertion this->Table->rowHeight(i) == newHeight
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 253
Assertion this->Table->rowHeight(i) == newHeight
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 253
Assertion this->Table->rowHeight(i) == newHeight
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 253
Assertion this->Table->rowHeight(i) == newHeight
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 253
Assertion this->Table->rowHeight(i) == newHeight
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 253
Assertion this->Table->rowHeight(i) == newHeight
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 253
Assertion this->Table->rowHeight(i) == newHeight
failed in /work/Preview/Slicer-0-build/CTK/Libs/Widgets/ctkMatrixWidget.cpp line 253
Loading Slicer RC file [/home/user/.slicerrc.py]
Switch to module: “DICOM”
Not much informative about the failure.
Anyway, I can do without this being fixed. AFAIK, core libraries like VTK, CTK, ITK and others do not expect non-asciii characters.
Thanks.
lassoan
(Andras Lasso)
February 17, 2021, 1:51pm
4
chir.set:
Anyway, I can do without this being fixed. AFAIK, core libraries like VTK, CTK, ITK and others do not expect non-asciii characters.
We build Slicer with UTF8 application code page on Windows, and UTF8 encoding is used on Linux and macOS by default already. So everything, including VTK, CTK, ITK works well with non-ASCII characters.
If your Linux or macOS system is set to a non-UTF8 locale then you need to restrict yourself to ASCII characters or switch the locale in the environment where you launch Slicer.
There is still an issue in Windows passing command-line arguments from a non-UTF8 terminal to a UTF8 application, but this should be resolved as Windows is gradually moving towards UTF8 everywhere.
What is the output of locale
command on your system (in a terminal)?
What is the output of this command in Slicer’s Python console?
localeCodec = qt.QTextCodec().codecForLocale()
print(localeCodec.toUnicode(localeCodec.name()))
I meant the application log of a failed DICOM export. It may contain useful information - most importantly what and where exactly logged the error.
lassoan
(Andras Lasso)
February 17, 2021, 8:38pm
5
Update: I’ve found that there is an intentional stripping of special characters in the CTK DICOM exporter:
destinationDir += sep + seriesNumber; if (!seriesDescription.isEmpty()) { destinationDir += nameSep + seriesDescription; } destinationDir += sep; // make sure only ascii characters are in the directory path // (while special characters may be used on an internal hard disk, it may not be possible // to use special characters on file systems of an external drive or network storage) destinationDir = QString::fromLatin1(destinationDir.toLatin1()); // replace any question marks that were used as replacements for non ascii // characters with underscore destinationDir.replace("?", "_"); // create the destination directory if necessary if (!QDir().exists(destinationDir)) { if (!QDir().mkpath(destinationDir)) { QString errorString =
While the intent is good (you don’t want to create a folder that you may not be able to write to a DVD or USB stick later), but may lead to other complications. I’ve pushed a few fixes, you can try if it works better in the Slicer Preview Release that you download tomorrow or later.
chir.set
(SET)
February 18, 2021, 9:39am
6
Yes, this fixes the issue. Slicer-4.13.0-2021-02-17 can now export the series, stripping special characters with ‘_’.
Thank you.
1 Like