Hi,<br><br>Thanks for the reply. This works.<br><br>However, I think the problem is with the renderer or the viewer.<br><br>So, I load an image and set that DICOM image to the viewer. Now, I update the DICOM reader with the new image and then the program crashes.
<br><br>I even tried using a vtkMutexLock, but it does not help. I also tried removing the renderer from the vtkRenderWindow object and it still does not help. However, I have a feeling that it is something to do with the vtkImageViewer renderer sharing the data still.
<br><br>I am not sure what else I could do. If someone has any ideas, please help!<br><br>Thanks,<br>Luca<br><br><div><span class="gmail_quote">On 7/14/06, <b class="gmail_sendername">Mathieu Malaterre</b> &lt;<a href="mailto:mathieu.malaterre@kitware.com">
mathieu.malaterre@kitware.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Luca,<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Can you try the following code:
<br><br>&nbsp;&nbsp; vtkDICOMImageReader *reader = vtkDICOMImageReader::New();<br>&nbsp;&nbsp; reader-&gt;SetDirectoryName(&quot;/home/luca/data/dicom/11089&quot;);<br>&nbsp;&nbsp; reader-&gt;Update();<br>&nbsp;&nbsp; reader-&gt;SetDirectoryName(&quot;/home/luca/data/dicom/11088&quot;);
<br>&nbsp;&nbsp; reader-&gt;Update();<br><br>If this crash, please open a bug in the bugtracker at:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://vtk.org/Bug">http://vtk.org/Bug</a><br><br>Thanks<br>Mathieu<br><br>Pankaj Daga wrote:<br>&gt; Hi everyone,
<br>&gt;<br>&gt; For the past few hours, I have been trying to find out why I get this<br>&gt; error on using vtkDICOMImageReader class. I am new to VTK and was<br>&gt; playing around with this class when I noticed this error.
<br>&gt;<br>&gt; I initialize a DICOM reader object and attach it to a<br>&gt; vtkDICOMImageViewer object. This works fine. The error happens when I<br>&gt; set the directory of the DICOM reader to point to another DICOM<br>
&gt; directory. Then, I get the error:<br>&gt;<br>&gt; libc detected: free() invalid pointer.<br>&gt;<br>&gt; Here is my code:<br>&gt;<br>&gt;&nbsp;&nbsp; vtkDICOMImageReader *reader = vtkDICOMImageReader::New();<br>&gt;&nbsp;&nbsp; vtkImageViewer* image_view = vtkImageViewer::New();
<br>&gt;&nbsp;&nbsp; image_view-&gt;SetInput(reader-<br>&gt;&nbsp;&nbsp;&gt;GetOutput());<br>&gt;<br>&gt;&nbsp;&nbsp; reader-&gt;SetDirectoryName(&quot;/home/luca/data/dicom/11089&quot;);<br>&gt;&nbsp;&nbsp; reader-&gt;Update();<br>&gt;<br>&gt;&nbsp;&nbsp; widget.SetRenderWindow
(image_view-&gt;GetRenderWindow());<br>&gt;&nbsp;&nbsp; image_view-&gt;SetupInteractor(widget.GetRenderWindow ()-&gt;GetInteractor());<br>&gt;<br>&gt;&nbsp;&nbsp; // When I display this without the next lines, it works fine.<br>&gt;<br>&gt;&nbsp;&nbsp; // NOW I TRY TO UPDATE MY READER with a new input.
<br>&gt;<br>&gt;&nbsp;&nbsp; reader-&gt;SetDirectoryName(&quot;/home/luca/data/dicom/11088&quot;);<br>&gt;&nbsp;&nbsp; reader-&gt;Update();<br>&gt;<br>&gt;&nbsp;&nbsp; When I call the SetDirectoryName method, the program crashes with libc<br>&gt; error. I am new to VTK and maybe I am using it the way that it is not
<br>&gt; supposed to be used. Maybe, I have to pause the rendering or something.<br>&gt; If anyone has any ideas, please help.<br>&gt;<br>&gt; I have no idea what is going on! Please help! I wish this bug did not<br>&gt; happen on a Friday!
<br>&gt;<br>&gt; Thanks,<br>&gt;<br>&gt; Luca<br>&gt;<br>&gt;<br>&gt; ------------------------------------------------------------------------<br>&gt;<br>&gt; _______________________________________________<br>&gt; This is the private VTK discussion list.
<br>&gt; Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br>&gt; Follow this link to subscribe/unsubscribe:<br>&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers">
http://www.vtk.org/mailman/listinfo/vtkusers</a><br><br></blockquote></div><br>