[vtkusers] How to extract vtkImageData from vtkDICOMImageReader

Xiaofeng Z xf10036 at hotmail.com
Sun Mar 21 09:55:07 EDT 2010


Thanks for your reply.  I also found out that if I first create a 
vtkImageData object and pass it into vtkDICOMImageReader for it to use 
as output, the vtkImageData object will retain itself when 
vtkDICOMImageReader is deleted:



vtkImageData* image = vtkImageData::New();

reader.SetOutput(image);

...



Is this a safe way to do?



Thanks!

Xiaofeng




Date: Sun, 21 Mar 2010 13:11:50 +0900
Subject: Re: [vtkusers] How to extract vtkImageData from vtkDICOMImageReader
From: wangjunchen at gmail.com
To: xf10036 at hotmail.com; vtkusers at vtk.org

because when you delete the reader, the imagedate(reader->GetOutput()) has a reference count 0 , so it is also recycled. 
if you want to pertain the output of the reader, you can do either:
1. connect the output to the vtk pipeline

or 
2.  vtkImageData * img = vtkImageData::New();
    img->DeepCopy(reader->GetOutput());
    reader->Delete();
    // then you can access to the img...


2010/3/21 Xiaofeng Z <xf10036 at hotmail.com>


Hello,

I use vtkDICOMImageReader to load a CT series:

vtkDICOMImageReader* reader = vtkDICOMImageReader::New();
reader.SetDirectoryName("...");
reader->Update();
vtkImageData* image = reader->GetOutput();


I was able to load the CT series without issue.  The problem is as soon as I call reader::Delete(), the data in "image" appeared to be wiped out.  Is there anyway to retain the vtkImageData object without having to keep the vtkDICOMImageReader object?


Thanks!

Xiaofeng Zhao






Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox. Learn More.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html


Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers




-- 
人生就像一个刷牙缸,你可以认为它是杯具,也可以认为它是洗具
 		 	   		  
_________________________________________________________________
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID27925::T:WLMTAGL:ON:WL:en-US:WM_HMP:032010_1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100321/d852df1b/attachment.htm>


More information about the vtkusers mailing list