Dear Xiaofeng,<br>If you want to break the pipeline, you'd better create a _shallow_, not deep copy of the output. It prevents from creating a new physical copy of the image.<br>Snippet:<br>//...<br>dicomReader->Update();<br>
vtkImageData* output = vtkImageData::New();<br>output->ShallowCopy(dicomReader->GetOutput() );<br>dicomReader->Delete();<br>//...<br><br>Dear Prashanth,<br>Functions Register() and Unregister() are intended to object internal use, if you don't have to, don't use them.<br>
<br>Regards,<br>Pawel~<font color="#006600"><font size="4"><font face="garamond,serif"><br clear="all"></font></font></font>_________________<br>Paweł~~Łubniewski<br>__________________________________________________________________________<br>
<br><br><div class="gmail_quote">2010/3/21 Prashanth Udupa <span dir="ltr"><<a href="mailto:prashanth.udupa@gmail.com" target="_blank">prashanth.udupa@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
You could also do this..<br>
<br>
vtkDICOMImageReader* reader = vtkDICOMImageReader::New();<br>
reader->...<br>
<div>reader->Update();<br>
<br>
vtkImageData* image = reader->GetOutput();<br>
</div>image->Register();<br>
<br>
reader->Delete();<br>
<br>
This way image will exist even after the reader is deleted...<br>
<br>
/ Prashanth<br>
<br>
2010/3/21 Xiaofeng Z <<a href="mailto:xf10036@hotmail.com" target="_blank">xf10036@hotmail.com</a>>:<br>
<div><div></div><div>> Thanks for your reply. I also found out that if I first create a<br>
> vtkImageData object and pass it into vtkDICOMImageReader for it to use as<br>
> output, the vtkImageData object will retain itself when vtkDICOMImageReader<br>
> is deleted:<br>
><br>
> vtkImageData* image = vtkImageData::New();<br>
> reader.SetOutput(image);<br>
> ...<br>
><br>
> Is this a safe way to do?<br>
><br>
> Thanks!<br>
><br>
> Xiaofeng<br>
><br>
><br>
><br>
><br>
> ________________________________<br>
> Date: Sun, 21 Mar 2010 13:11:50 +0900<br>
> Subject: Re: [vtkusers] How to extract vtkImageData from vtkDICOMImageReader<br>
> From: <a href="mailto:wangjunchen@gmail.com" target="_blank">wangjunchen@gmail.com</a><br>
> To: <a href="mailto:xf10036@hotmail.com" target="_blank">xf10036@hotmail.com</a>; <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
><br>
> because when you delete the reader, the imagedate(reader->GetOutput()) has a<br>
> reference count 0 , so it is also recycled.<br>
> if you want to pertain the output of the reader, you can do either:<br>
> 1. connect the output to the vtk pipeline<br>
> or<br>
> 2. vtkImageData * img = vtkImageData::New();<br>
> img->DeepCopy(reader->GetOutput());<br>
> reader->Delete();<br>
> // then you can access to the img...<br>
><br>
> 2010/3/21 Xiaofeng Z <<a href="mailto:xf10036@hotmail.com" target="_blank">xf10036@hotmail.com</a>><br>
><br>
> Hello,<br>
><br>
> I use vtkDICOMImageReader to load a CT series:<br>
><br>
> vtkDICOMImageReader* reader = vtkDICOMImageReader::New();<br>
> reader.SetDirectoryName("...");<br>
> reader->Update();<br>
> vtkImageData* image = reader->GetOutput();<br>
><br>
> I was able to load the CT series without issue. The problem is as soon as I<br>
> call reader::Delete(), the data in "image" appeared to be wiped out. Is<br>
> there anyway to retain the vtkImageData object without having to keep the<br>
> vtkDICOMImageReader object?<br>
><br>
> Thanks!<br>
><br>
> Xiaofeng Zhao<br>
><br>
><br>
><br>
> ________________________________<br>
> Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.<br>
> Learn More.<br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
><br>
><br>
> --<br>
> 人生就像一个刷牙缸,你可以认为它是杯具,也可以认为它是洗具<br>
><br>
> ________________________________<br>
> Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.<br>
> Learn More.<br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
<br>
<br>
<br>
--<br>
</div></div>Thanks and Warm Regards,<br>
Prashanth N Udupa<br>
<font color="#888888"><br>
<a href="mailto:prashanth.udupa@gmail.com" target="_blank">prashanth.udupa@gmail.com</a><br>
<a href="http://www.prashanthudupa.com" target="_blank">http://www.prashanthudupa.com</a><br>
<a href="http://prashanthudupa.livejournal.com/" target="_blank">http://prashanthudupa.livejournal.com/</a><br>
</font><div><div></div><div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br>