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