[Insight-users] Bug reading DICOM Series with QApplication
Mathieu Malaterre
mathieu.malaterre at gmail.com
Thu Oct 22 07:58:25 EDT 2009
debian and ubuntu comes with a GDCM 2.0.12 version. ITK uses this
system installed GDCM.
You can check the version from the command line:
$ apt-cache policy libgdcm2-dev
HTH
On Thu, Oct 22, 2009 at 1:54 PM, Jesús Spínola <jspinola at gmail.com> wrote:
> Hi Luis,
> we've tried the beta version of the new ubuntu 9.10, which comes with itk
> version 3.14 linked against external gdcm 2.0.x, and now the problem has
> disappeared.
> Maybe the problem was with the built-in gdcm version that came with itk?
> But, well, it's only a supposition...
> Do you know which is the exact gdcm built-in version that comes with itk
> 3.10,.12,.14,...?
> Regarding point 4), ubuntu 9.04 has already the pathch 3.10.1 version
>
>
> Thanks a lot for your help!
> On Mon, Oct 19, 2009 at 7:32 PM, Luis Ibanez <luis.ibanez at kitware.com>
> wrote:
>>
>> Hi Jesus,
>>
>> Thanks for your detailed answer.
>>
>> 1) Yes, it make sense to use the ITK packages for Ubuntu first.
>>
>> 2) It really seems that this was a bug fixed before ITK 3.16.
>>
>> 3) I don't know exactly what but it is.
>> Good places to look for it would be:
>>
>> itkImageBase
>> itkImage
>> itkImageFileReader
>> itkGDCMImageIO
>>
>> It may take several hours to track that down...
>> So... we probably need a good justification (motivation)
>> for tracking the exact bug...
>>
>>
>> 4) I don't know in what exact version this behavior was
>> fixed, although I would suspect that it relates to the
>> release of ITK 3.10, which is the first one in which
>> we made the itkImage behave as an itkOrientedImage.
>>
>> If you go for ITK 3.10, then you should probably use
>> the patch ITK 3.10.1:
>>
>> Release 3.10.1 (patch 1) (December 8 2008)
>> http://www.itk.org/ITK/resources/legacy_releases.html
>>
>>
>> 5) However,... I'll still suggest that if you are not
>> using the specific Ubuntu package, you may
>> as well update to the most recent release of ITK.
>>
>>
>> 6) It still doesn't make much sense for the behavior
>> of the ITK class to change when you introduce
>> the QApplication.
>>
>> (again,... unless there is some shared library confusion...).
>>
>>
>>
>>
>>
>> Regards,
>>
>>
>> Luis
>>
>>
>> -------------------------------------------------------------------
>> On Tue, Oct 13, 2009 at 7:13 AM, Jesús Spínola <jspinola at gmail.com>
>> wrote:
>> > Hi Luis,
>> >
>> > thanks for your detailed explanations. I'll ask to your questions and
>> > ask
>> > you some more questions to the points you stated
>> >
>> > On Mon, Oct 12, 2009 at 9:14 PM, Luis Ibanez <luis.ibanez at kitware.com>
>> > wrote:
>> >>
>> >> Hi Jesús,
>> >>
>> >>
>> >> Thanks for the detailed description of your problem.
>> >>
>> >>
>> >> 1) ITK 2.8.1 is certainly an old version.
>> >> It is great that you are updating.
>> >>
>> >>
>> >> 2) Why have you decided to update to 3.10.1
>> >> instead of adopting the most recent release
>> >> of ITK 3.16 ?
>> >>
>> >
>> > Under linux, we are using ubuntu 9.04, and that's the official itk
>> > version
>> > that comes with this distribution, so we first try to use the version of
>> > the
>> > libraries that comes in the common repositories. If we see the provided
>> > packages are wrong or causes any problem, we then consider to make our
>> > own
>> > packages to solve that problems. So, before building new packages for a
>> > more
>> > recent library version, we want to be sure in which side the problem is.
>> > We
>> > want to discard if that's a problem of us or that's because some bug in
>> > the
>> > library.
>> >
>> > We also tried itk 3.14 (we used the packages found on
>> > http://apt.paulnovo.org/ubuntu/pool/main/i/insighttoolkit/ which are
>> > built
>> > for this linux distribution too), and we had unfortunately the same
>> > errors.
>> >
>> > So the question is, are we doing something wrong? or we can just put the
>> > blame on this itk versions?
>> > Before building a more recent version, we want to be sure what's the
>> > real
>> > problem.
>> >
>> >>
>> >>
>> >> 3) Thanks for posting the minimal example for
>> >> replicating the problem.
>> >>
>> >> I downloaded your .tar.gz file, and adapted
>> >> the bug.pro file in order to provide all the
>> >> necessary libraries.
>> >>
>> >
>> > I used your bug.pro file, but I had to change the location of the
>> > libraries
>> > for ours (/usr/lib/.. /usr/include/Insight...), and remove the linking
>> > to
>> >
>> > -litkpng \
>> >
>> > -litktiff \
>> >
>> > -litkzlib \
>> >
>> > but I guess this has to do with the way the libraries are built and has
>> > no
>> > influence in the final result
>> >
>> >>
>> >> 4) I build it against our current CVS version,
>> >> and Qt 4.5.0 and didn't received any error
>> >> message when running:
>> >>
>> >> ./bug-3.10.1 ./data
>> >>
>> >>
>> >> 5) To make the program more informative,
>> >> I added:
>> >>
>> >> ImageType::ConstPointer image = reader->GetOutput();
>> >>
>> >> image->Print( std::cout );
>> >>
>> >> and got the following (excerpt):
>> >>
>> >>
>> >> Direction:
>> >> 1 0 0
>> >> 0 0.956305 0.292372
>> >> 0 -0.292372 0.956305
>> >>
>> >
>> > This is the right direction because that's the one we get with 2.8.1,
>> > and
>> > that's the matrix you can compute from "Image Orientation Patient" dicom
>> > tag. In our case, we get the exception error I mentioned and the whole
>> > result of image->Print(std::cout) is
>> >
>> >
>> > Image (0x872edb0)
>> > RTTI typeinfo: itk::Image<short, 3u>
>> > Reference Count: 2
>> > Modified Time: 7
>> > Debug: Off
>> > Observers:
>> > none
>> > Source: (0x876cfb8)
>> > Source output index: 0
>> > Release Data: Off
>> > Data Released: False
>> > Global Release Data: Off
>> > PipelineMTime: 24
>> > UpdateMTime: 0
>> > LargestPossibleRegion:
>> > Dimension: 3
>> > Index: [0, 0, 0]
>> > Size: [0, 0, 0]
>> > BufferedRegion:
>> > Dimension: 3
>> > Index: [0, 0, 0]
>> > Size: [0, 0, 0]
>> > RequestedRegion:
>> > Dimension: 3
>> > Index: [0, 0, 0]
>> > Size: [0, 0, 0]
>> > Spacing: [1, 1, 1]
>> > Origin: [0, 0, 0]
>> > Direction:
>> > 1 0 0
>> > 0 1 0
>> > 0 0 1
>> >
>> > IndexToPointMatrix:
>> > 1 0 0
>> > 0 1 0
>> > 0 0 1
>> >
>> > PointToIndexMatrix:
>> > 1 0 0
>> > 0 1 0
>> > 0 0 1
>> >
>> > PixelContainer:
>> > ImportImageContainer (0x9fe0328)
>> > RTTI typeinfo: itk::ImportImageContainer<unsigned long, short>
>> > Reference Count: 1
>> > Modified Time: 4
>> > Debug: Off
>> > Observers:
>> > none
>> > Pointer: 0
>> > Container manages memory: true
>> > Size: 0
>> > Capacity: 0
>> >
>> >
>> > As you can see, we get a "blank" Image completely void.
>> >
>> > If I run the program without the QApplication it works ok and we get the
>> > right direction matrix and the resulting image is filled (Pointer, Size
>> > and
>> > Capacity are not null)
>> >
>> >>
>> >> 6) It would seem that you are being affected by
>> >> a bug that may now been fixed in ITK 3.16.
>> >>
>> >
>> > Do you know which bug is exactly? And do you know in wich version should
>> > this bug has been fixed?
>> >
>> >>
>> >> 7) The error message that your were reporting
>> >> can be generated from the method
>> >>
>> >> ::ComputeIndexToPhysicalPointMatrices()
>> >>
>> >> that is defined in the itkImageBase, and
>> >> overloaded in the itkImage class.
>> >>
>> >> This methods verifies that the Direction
>> >> matrix doesn't have a null determinant.
>> >>
>> >> In your case, it seems that the process
>> >> of reading these two DICOM slices was
>> >> generating a NULL-determinant Direction.
>> >>
>> >>
>> >> 8) There shouldn't be any relationship
>> >> with using QApplication or not.
>> >>
>> >> You should receive the same error message
>> >> when you don't use the QApplication class...
>> >>
>> >
>> > That's the way it should be, but in fact it only appears if we put the
>> > QApplication. It's really strange, truly.
>> >
>> >
>> >>
>> >> unless....
>> >>
>> >> you are somehow linking to ITK shared
>> >> libraries and may have different versions
>> >> of them in your installation.
>> >>
>> >
>> > We are linking to ITK shared libraries, but we have only one version
>> > installed at once (3.10.1).
>> >
>> >>
>> >> 9) Please run your program with :
>> >>
>> >> ldd ./bug-3.10.1 ./data
>> >>
>> >> and double check that the shared libraries
>> >> that the program is finding are indeed the
>> >> ones that you intended to link with.
>> >>
>> >
>> > We checked it, and they are linking to the right libraries.
>> >
>> >>
>> >> Please find attached the modified versions
>> >> of bug.pro and main.cpp.
>> >>
>> >>
>> >>
>> >> Regards,
>> >>
>> >>
>> >> Luis
>> >>
>> >>
>> >> ---------------------------------------------------------------
>> >> On Thu, Oct 8, 2009 at 5:51 AM, Jesús Spínola <jspinola at gmail.com>
>> >> wrote:
>> >> > Hello,
>> >> >
>> >> > I'm a developer of a cross platform DICOM Viewer application. It uses
>> >> > Qt
>> >> > libraries ( version 4.5.0 ) for the GUI, itk to read the images (with
>> >> > GDCMIO
>> >> > precisely) and vtk to display them.
>> >> >
>> >> > Until now, we were using itk 2.8.1 and all was quite fine. Now, we
>> >> > are
>> >> > looking forward to update the itk libraries to a more recent version
>> >> > but
>> >> > we
>> >> > have encountered a problem. We tried itk 3.10.1, and for some series
>> >> > of
>> >> > images, it gives an exception error when loading the files, and the
>> >> > data
>> >> > is
>> >> > not loaded in memory at all, so it's not possible to view any image.
>> >> >
>> >> > We have written a litlle program to reproduce the problem. It is very
>> >> > simple, it declares the itk image format and the dicom reader, and
>> >> > tries
>> >> > to
>> >> > read the files contained in a folder the user has provided as an
>> >> > argument in
>> >> > the command line.
>> >> > First, we only wrote the piece of code that reads the files, but it
>> >> > gave
>> >> > no
>> >> > error or exception at all.
>> >> > Later, we added the QApplication object in the main.cpp like you do
>> >> > in a
>> >> > typical Qt application. Then, when we run the program, the exception
>> >> > appeared again, so it seems there's some problem when using
>> >> > QApplication
>> >> > with this version of itk (3.10.1).
>> >> >
>> >> > We also tried with an earlier version of itk and a later version.
>> >> > With
>> >> > the
>> >> > earlier (3.6.0) the problem doesn't appear, and with the later (
>> >> > 3.14.0
>> >> > ) it
>> >> > continues appearing.
>> >> >
>> >> > The exception message we get is the following:
>> >> >
>> >> > itk::ERROR: Image(0x9ae0b78): Bad direction, determinant is 0.
>> >> > Direction
>> >> > is
>> >> > 1 0 0
>> >> > 0 0 0
>> >> > 0 0 0
>> >> >
>> >> > We tested this under a kubuntu 9.04
>> >> >
>> >> > You can download the source code of the program and additional data
>> >> > from http://www.box.net/shared/ctjvebgnr5
>> >> > All those files are compressed using gzip (bug.tar.gz) It contains
>> >> > the
>> >> > main.cpp to reproduce the problem, with the respective project file
>> >> > for
>> >> > qt
>> >> > (bug.pro) and a folder with two dicom images that reproduces the
>> >> > problem.
>> >> > To compile the program you will need qt 4.x libraries to be installed
>> >> > (
>> >> > 4.5
>> >> > preferably to better reproduce the problem ) and itk libraries too.
>> >> >
>> >> > Follow this steps to get and run the executable:
>> >> >
>> >> > 1. qmake bug.pro # generate the makefiles
>> >> > 2. make debug # compile the program with debug info
>> >> > 3. ./bug-3.10.1 data/ # run the program, passing the directory
>> >> > containing the image data to load
>> >> >
>> >> >
>> >> > It's a weird problem and we would like to know where is the problem
>> >> > exactly,
>> >> > because we don't know why is this error appearing when using the
>> >> > QApplication object.
>> >> > Kind regards,
>> >> >
>> >> > --
>> >> > Jesús Spínola
>> >> >
>> >> >
>> >> > --
>> >> > Jesús Spínola
>> >> >
>> >> > _____________________________________
>> >> > Powered by www.kitware.com
>> >> >
>> >> > Visit other Kitware open-source projects at
>> >> > http://www.kitware.com/opensource/opensource.html
>> >> >
>> >> > Please keep messages on-topic and check the ITK FAQ at:
>> >> > http://www.itk.org/Wiki/ITK_FAQ
>> >> >
>> >> > Follow this link to subscribe/unsubscribe:
>> >> > http://www.itk.org/mailman/listinfo/insight-users
>> >> >
>> >> >
>> >
>> >
>> >
>> > --
>> > Jesús Spínola
>> >
>
>
>
> --
> Jesús Spínola
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
--
Mathieu
More information about the Insight-users
mailing list