Open Mr-Blue-Sky-Candy opened 7 months ago
Thank you for contributing an issue! š
Welcome to the ITK community! š¤šāļø
We are glad you are here and appreciate your contribution. Please keep in mind our community participation guidelines. š Also, please check existing open issues and consider discussion on the ITK Discourse. š
This is an automatic message. Allow for time for the ITK community to be able to read the issue and comment on it.
I assume that this is not related to Python packaging, but to underlying GDCM code. Reproducing without data will probably be hard. Can you try anonymizing your DICOM file(s) and then sharing them? Use this or one of many other tools.
I agree it is due to binded cpp or c code but I cannot share the dicom files. I know how to code cpp as well but I don't know how to debug a python binding. If there is a way I can help about this, I would be happy to do so
Can you try C++ code from this example on your DICOM data? Does it also crash?
Hi, could you please try with itk-5.4rc4
? Do the same results occur?
Also,
image = itk.imread('path/to/dicom/dir/')
Hi, could you please try with
itk-5.4rc4
? Do the same results occur?
this also failed
Also,
image = itk.imread('path/to/dicom/dir/')
I already tried but forgot to mention. The outcome is the same
If you set up a debug build and get a backtrace, it will likely be evident where the issue exists. Please see Section 9.5.3 in The ITK Software Guide, Book 1 for guidance.
Hey, I had to refresh my cpp skills. I ran with debug mode but I always used qt creator run debug mode. So I can see this:
1 ?? 0x7ffff4cab32c
2 raise 0x7ffff4c5a6c8
3 abort 0x7ffff4c424b8
4 std::__glibcxx_assert_fail debug.cc 61 0x7ffff4edd3b2
5 ?? 0x7ffff654881e
6 gdcm::PixmapReader::ReadImageInternal(gdcm::MediaStorage const&, bool) 0x7ffff654ab16
7 gdcm::ImageReader::ReadImage(gdcm::MediaStorage const&) 0x7ffff654c880
8 gdcm::PixmapReader::Read() 0x7ffff65472da
9 gdcm::SerieHelper::AddFileName(std::string const&) 0x7ffff6522c7d
10 gdcm::SerieHelper::SetDirectory(std::string const&, bool) 0x7ffff6522f3c
11 itk::GDCMSeriesFileNames::SetInputDirectory(std::string const&) 0x7ffff698ebb4
12 itk::GDCMSeriesFileNames::SetDirectory itkGDCMSeriesFileNames.h 98 0x555555567b5d
13 main main.cpp 32 0x555555566dc5
Is this good? It also show disassembler output. If you need me to share something else, let me know. I don't know how to proceed from this point on:
Nice!
It would be helpful to build as Debug
CMAKE_BUILD_TYPE
and find out the line number that identifies which assert
is failing:
CC @malaterre
I can see this in the command line output:
$ ./test_itk ../../../../work/AIRTQA/r-008-023-2-corrupt/
/usr/include/c++/13.2.1/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = gdcm::Curve; _Alloc = std::allocator<gdcm::Curve>; reference = gdcm::Curve&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Aborted (core dumped)
@Mr-Blue-Sky-Candy I expect that there is a line number associated with gdcmPixmapReader.cxx that has an assert
statement when a Debug
build is created and it is debugged as described in the ITK Software Guide.
I am already building Debug builds but as it is described in ITK software guide I switched to RelWithDebInfo build anyway. Unsurprisingly, the result is the same.
@Mr-Blue-Sky-Candy there are no line numbers for the screenshot shared in the GDCM calls -- is ITK_USE_SYSTEM_GDCM
OFF
?
I added set(ITK_USE_SYSTEM_GDCM ON)
to the CMakeLists.txt but the result is the same
The setting should be:
set(ITK_USE_SYSTEM_GDCM OFF)
So GDCM with a Debug build is used. Examining with gdb
may be helpful as suggested in the ITK Software Guide.
I am already running in qtcreator with gdb.
@Mr-Blue-Sky-Candy there are no line numbers for the screenshot shared in the GDCM calls -- is
ITK_USE_SYSTEM_GDCM
OFF
?
Actually there is. I will share a different view with set(ITK_USE_SYSTEM_GDCM OFF)
:
We are looking for what is happening at Level 7:
Ahh OK. Thanks. I recompiled the system gdcm with debug symbols. Here you go:
All functions look better here
Thanks, closer!
You will need to step through the code in gdcmPixmapReader (set a breakpoint in QtCreater) to understand what content that is expected is not present.
Here return Curves[i]
in the file gdcmPixmap.h:47
, i
is 7 but it is larger than the size of Curves
@malaterre any suggestions?
@thewtex Curve module have been deprecated for years now. Without the actual DICOM DataSet there are plenty ways to create an illegal structure.
@Mr-Blue-Sky-Candy If you cannot share the DICOM file, I suggest building with 'Debug', you should at least get the proper behavior for 'assert' and hopefully track the root issue (not symptom).
I only get segmentation fault. I can share the code I wrote but not the Dicom series. The code I wrote works for all others but not for some particular CT scans. How can I help you resolve this?
The code I wrote is the following:
It gives segmentation fault at the line
names_generator.SetDirectory(folder)
This code also gives segmentation fault:
Pydicom is able to read it but its metadata is very messy and hard to format besides it cannot read other particular Dicom series of CT scans.
ITK version is 5.3 on both ubuntu 22 and archlinux