[vtkusers] strange error while using SetDirectoryName twice on vtkDICOMImageReader

Pankaj Daga deluded.soul at gmail.com
Mon Jul 17 05:50:01 EDT 2006


Hi,

Thanks for the reply. This works.

However, I think the problem is with the renderer or the viewer.

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.

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.

I am not sure what else I could do. If someone has any ideas, please help!

Thanks,
Luca

On 7/14/06, Mathieu Malaterre <mathieu.malaterre at kitware.com> wrote:
>
> Luca,
>
>         Can you try the following code:
>
>    vtkDICOMImageReader *reader = vtkDICOMImageReader::New();
>    reader->SetDirectoryName("/home/luca/data/dicom/11089");
>    reader->Update();
>    reader->SetDirectoryName("/home/luca/data/dicom/11088");
>    reader->Update();
>
> If this crash, please open a bug in the bugtracker at:
>
>         http://vtk.org/Bug
>
> Thanks
> Mathieu
>
> Pankaj Daga wrote:
> > Hi everyone,
> >
> > For the past few hours, I have been trying to find out why I get this
> > error on using vtkDICOMImageReader class. I am new to VTK and was
> > playing around with this class when I noticed this error.
> >
> > I initialize a DICOM reader object and attach it to a
> > vtkDICOMImageViewer object. This works fine. The error happens when I
> > set the directory of the DICOM reader to point to another DICOM
> > directory. Then, I get the error:
> >
> > libc detected: free() invalid pointer.
> >
> > Here is my code:
> >
> >   vtkDICOMImageReader *reader = vtkDICOMImageReader::New();
> >   vtkImageViewer* image_view = vtkImageViewer::New();
> >   image_view->SetInput(reader-
> >  >GetOutput());
> >
> >   reader->SetDirectoryName("/home/luca/data/dicom/11089");
> >   reader->Update();
> >
> >   widget.SetRenderWindow(image_view->GetRenderWindow());
> >   image_view->SetupInteractor(widget.GetRenderWindow()->GetInteractor());
> >
> >   // When I display this without the next lines, it works fine.
> >
> >   // NOW I TRY TO UPDATE MY READER with a new input.
> >
> >   reader->SetDirectoryName("/home/luca/data/dicom/11088");
> >   reader->Update();
> >
> >   When I call the SetDirectoryName method, the program crashes with libc
> > error. I am new to VTK and maybe I am using it the way that it is not
> > supposed to be used. Maybe, I have to pause the rendering or something.
> > If anyone has any ideas, please help.
> >
> > I have no idea what is going on! Please help! I wish this bug did not
> > happen on a Friday!
> >
> > Thanks,
> >
> > Luca
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060717/61dce5f2/attachment.htm>


More information about the vtkusers mailing list