Hi Luis,<br><br>thanks for your detailed explanations. I&#39;ll ask to your questions and ask you some more questions to the points you stated<br><br><div class="gmail_quote">On Mon, Oct 12, 2009 at 9:14 PM, Luis Ibanez <span dir="ltr">&lt;<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">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></blockquote><div> </div><div>Under linux, we are using ubuntu 9.04, and that&#39;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&#39;s a problem of us or that&#39;s because some bug in the library.<br>
<br>We also tried itk 3.14 (we used the packages found on <a href="http://apt.paulnovo.org/ubuntu/pool/main/i/insighttoolkit/">http://apt.paulnovo.org/ubuntu/pool/main/i/insighttoolkit/</a> which are built 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 blame on this itk versions?<br>Before building a more recent version, we want to be sure what&#39;s the real problem.<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

 </blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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></blockquote><div><br>I used your <a href="http://bug.pro">bug.pro</a> file, but I had to change the location of the libraries for ours (/usr/lib/.. /usr/include/Insight...), and remove the linking to 
<meta name="qrichtext" content="1"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style="margin: 0px; text-indent: 0px;">-litkpng \<br><style type="text/css">
p, li { white-space: pre-wrap; </style></p><p style="margin: 0px; text-indent: 0px;">-litktiff \</p><p style="margin: 0px; text-indent: 0px;">-litkzlib \</p><p></p><p></p><br>but I guess this has to do with the way the libraries are built and has no influence in the final result<br>
 <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
4)  I build it against our current CVS version,<br>
     and Qt 4.5.0 and didn&#39;t received any error<br>
     message when running:<br>
<div class="im"><br>
             ./bug-3.10.1          ./data<br>
<br>
<br>
</div>5)  To make the program more informative,<br>
      I added:<br>
<br>
    ImageType::ConstPointer image = reader-&gt;GetOutput();<br>
<br>
    image-&gt;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></blockquote><div><br>This is the right direction because that&#39;s the one we get with 2.8.1, and that&#39;s the matrix you can compute from &quot;Image Orientation Patient&quot; dicom tag. In our case, we get the exception error I mentioned and the whole result of image-&gt;Print(std::cout) is<br>
<br><br><span style="font-family: courier new,monospace;">Image (0x872edb0)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  RTTI typeinfo:   itk::Image&lt;short, 3u&gt;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  Reference Count: 2                    </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  Modified Time: 7                      </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  Debug: Off                            </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  Observers:                            </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    none                                </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  Source: (0x876cfb8)                   </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  Source output index: 0</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  Release Data: Off</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  Data Released: False</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  Global Release Data: Off</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  PipelineMTime: 24</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  UpdateMTime: 0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  LargestPossibleRegion:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    Dimension: 3</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    Index: [0, 0, 0]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    Size: [0, 0, 0]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  BufferedRegion:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    Dimension: 3</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    Index: [0, 0, 0]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    Size: [0, 0, 0]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  RequestedRegion:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    Dimension: 3</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    Index: [0, 0, 0]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    Size: [0, 0, 0]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  Spacing: [1, 1, 1]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  Origin: [0, 0, 0]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  Direction:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">1 0 0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">0 1 0</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">0 0 1</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  IndexToPointMatrix:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  1 0 0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">0 1 0</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">0 0 1</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">PointToIndexMatrix:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  1 0 0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">0 1 0</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">0 0 1</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  PixelContainer:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    ImportImageContainer (0x9fe0328)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">      RTTI typeinfo:   itk::ImportImageContainer&lt;unsigned long, short&gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      Reference Count: 1</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">      Modified Time: 4</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      Debug: Off</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">      Observers:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        none</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">      Pointer: 0</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      Container manages memory: true</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">      Size: 0</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      Capacity: 0</span><br><br></div><div><br>As you can see, we get a &quot;blank&quot; Image completely void.<br>
<br>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)<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

6) It would seem that you are being affected by<br>
    a bug that may now been fixed in ITK 3.16.<br>
 <br></blockquote><div><br>Do you know which bug is exactly? And do you know in wich version should this bug has been fixed?<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<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&#39;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&#39;t be any relationship<br>
     with using QApplication or not.<br>
<br>
     You should receive the same error message<br>
     when you don&#39;t use the QApplication class...<br>
<br></blockquote><div><br>That&#39;s the way it should be, but in fact it only appears if we put the QApplication. It&#39;s really strange, truly.<br><br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

     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></blockquote><div><br>We are linking to ITK shared libraries, but we have only one version installed at once (3.10.1).<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<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></blockquote><div><br>We checked it, and they are linking to the right libraries.<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<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>
<div><div></div><div class="h5">On Thu, Oct 8, 2009 at 5:51 AM, Jesús Spí­nola &lt;<a href="mailto:jspinola@gmail.com">jspinola@gmail.com</a>&gt; wrote:<br>
&gt; Hello,<br>
&gt;<br>
&gt; I&#39;m a developer of a cross platform DICOM Viewer application. It uses Qt<br>
&gt; libraries ( version 4.5.0 ) for the GUI, itk to read the images (with GDCMIO<br>
&gt; precisely) and vtk to display them.<br>
&gt;<br>
&gt; Until now, we were using itk 2.8.1 and all was quite fine. Now, we are<br>
&gt; looking forward to update the itk libraries to a more recent version but we<br>
&gt; have encountered a problem. We tried itk 3.10.1, and for some series of<br>
&gt; images, it gives an exception error when loading the files, and the data is<br>
&gt; not loaded in memory at all, so it&#39;s not possible to view any image.<br>
&gt;<br>
&gt; We have written a litlle program to reproduce the problem. It is very<br>
&gt; simple, it declares the itk image format and the dicom reader, and tries to<br>
&gt; read the files contained in a folder the user has provided as an argument in<br>
&gt; the command line.<br>
&gt; First, we only wrote the piece of code that reads the files, but it gave no<br>
&gt; error or exception at all.<br>
&gt; Later, we added the QApplication object in the main.cpp like you do in a<br>
&gt; typical Qt application. Then, when we run the program, the exception<br>
&gt; appeared again, so it seems there&#39;s some problem when using QApplication<br>
&gt; with this version of itk (3.10.1).<br>
&gt;<br>
&gt; We also tried with an earlier version of itk and a later version. With the<br>
&gt; earlier (3.6.0) the problem doesn&#39;t appear, and with the later ( 3.14.0 ) it<br>
&gt; continues appearing.<br>
&gt;<br>
&gt; The exception message we get is the following:<br>
&gt;<br>
&gt; itk::ERROR: Image(0x9ae0b78): Bad direction, determinant is 0. Direction is<br>
&gt; 1 0 0<br>
&gt; 0 0 0<br>
&gt; 0 0 0<br>
&gt;<br>
&gt; We tested this under a kubuntu 9.04<br>
&gt;<br>
&gt; You can download the source code of the program and additional data<br>
&gt; from <a href="http://www.box.net/shared/ctjvebgnr5" target="_blank">http://www.box.net/shared/ctjvebgnr5</a><br>
&gt; All those files are compressed using gzip (bug.tar.gz) It contains the<br>
&gt; main.cpp to reproduce the problem, with the respective project file for qt<br>
&gt; (<a href="http://bug.pro" target="_blank">bug.pro</a>) and a folder with two dicom images that reproduces the problem.<br>
&gt; To compile the program you will need qt 4.x libraries to be installed ( 4.5<br>
&gt; preferably to better reproduce the problem ) and itk libraries too.<br>
&gt;<br>
&gt; Follow this steps to get and run the executable:<br>
&gt;<br>
&gt; 1. qmake <a href="http://bug.pro" target="_blank">bug.pro</a>          # generate the makefiles<br>
&gt; 2. make debug              # compile the program with debug info<br>
&gt; 3. ./bug-3.10.1 data/     # run the program, passing the directory<br>
&gt; containing the image data to load<br>
&gt;<br>
&gt;<br>
&gt; It&#39;s a weird problem and we would like to know where is the problem exactly,<br>
&gt; because we don&#39;t know why is this error appearing when using the<br>
&gt; QApplication object.<br>
&gt; Kind regards,<br>
&gt;<br>
&gt; --<br>
&gt; Jesús Spínola<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Jesús Spínola<br>
&gt;<br>
</div></div>&gt; _____________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;<br>
&gt;<br>
</blockquote></div><br><br clear="all"><br>-- <br>Jesús Spínola<br>