[vtkusers] again DICOM, how to read the data?
Amy Squillacote
amy.squillacote at kitware.com
Tue Sep 11 08:31:27 EDT 2007
Hi Mauro,
The problem is that you're calling
vtkImageData *tmpImage = vtkImageData::New();
and then immediately resetting the value of tmpImage with the following
call.
tmpImage = reader->GetOutput();
This means that the tmpImage pointer no longer points to the instance of
vtkImageData that you created; that memory is leaked. When you then call
Delete(), you're doing so to data you did not call New() on. You should
instead do the following and then NOT call tmpImage->Delete().
vtkImageData *tmpImage = reader->GetOutput();
Calling reader->Delete() is still OK since you did correctly call
vtkDICOMImageReader *reader = vtkDICOMImageReader::New();
- Amy
mauro maiorca wrote:
> On 9/11/07, Peter F Bradshaw <pfb at exadios.com> wrote:
>
>
>> What are you trying to do here? You have assigned tmpImage to a
>> vtkImageSource object and straight away you throw that away. I can
>> predict that the tmpImage->Delete() below will give you a seg fault.
>>
>
> actually I'm not getting the meaning of your comment!
> this is just a piece of code for testing, I cannot understand why you
> can predict the segmentation fault. Do you mean that I should put
> tmpImage->Delete() before of reader->Delete()? it gives segmentation
> fault anyway!
> How do you can predict that behaviour? I mean: I create an object, and
> afterwards I delete it, what's wrong with it?
>
> thanks!
> Mauro
> _______________________________________________
> 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
>
>
--
Amy Squillacote
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065
Phone: (518) 371-3971 x106
More information about the vtkusers
mailing list