Hi zhq,<br><br>To stream, the StreamingImageFilter must come at the end of the pipeline, and intermediate calls to Update() should be avoided. Here is an example [1].<br><br>Please keep messages on the list.<br><br>Thanks,<br>
Matt<br><br>[1] <a href="http://itk.org/ITKExamples/src/Core/Common/StreamAPipeline/Documentation.html">http://itk.org/ITKExamples/src/Core/Common/StreamAPipeline/Documentation.html</a><br><br><div class="gmail_quote">On Sun, Aug 4, 2013 at 2:04 AM, zhq <span dir="ltr"><<a href="mailto:15891495523@126.com" target="_blank">15891495523@126.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;font-size:14px;font-family:arial">Hello :<div> I have tried the StreamingImageFilter , it doesn't work ! The MR files are attached to the email (contains 50 files). And my code is :</div>
<div>(I want to know where is the problem at all ! I'm going mad . )</div><div><div class="im"><div>//use the itkHessian3DToVesselnessMeasureImageFilter method to segment</div><div>//bright blood vessel</div><div>#include "itkImage.h"</div>
<div>#include "itkImageSeriesReader.h"</div><div>#include "itkImageFileWriter.h"</div><div>#include "itkNumericSeriesFileNames.h"</div><div>#include "itkGDCMImageIO.h"</div><div>#include <Windows.h></div>
<div>#include "itkShiftScaleImageFilter.h"</div><div>#include "itkHessianRecursiveGaussianImageFilter.h"</div><div>#include "itkHessian3DToVesselnessMeasureImageFilter.h"</div></div><div>#include "itkStreamingImageFilter.h"</div>
<div class="im"><div>void main()</div><div>{</div><div><span style="white-space:pre-wrap">        </span>typedef unsigned short PixelType ; </div><div><span style="white-space:pre-wrap">        </span>const unsigned int Dimension = 3; </div>
<div><span style="white-space:pre-wrap">        </span>typedef itk::Image<PixelType , Dimension> ImageType ; </div><div><span style="white-space:pre-wrap">        </span>typedef itk::ImageSeriesReader<ImageType> ReaderType ; </div>
<div><span style="white-space:pre-wrap">        </span>//there still some parameters can be set</div><div><span style="white-space:pre-wrap">        </span>typedef itk::NumericSeriesFileNames NameGeneratorType ;</div><div><span style="white-space:pre-wrap">        </span>NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();</div>
<div><span style="white-space:pre-wrap">        </span>nameGenerator->SetSeriesFormat("C:\\Users\\zhq\\Desktop\\data\\SNAP_CR\\E403434298\\E403434298S1901I%3d.dcm");</div><div><span style="white-space:pre-wrap">        </span>nameGenerator->SetStartIndex(301);</div>
</div><div><span style="white-space:pre-wrap">        </span>nameGenerator->SetEndIndex(344);</div><div class="im"><div><span style="white-space:pre-wrap">        </span>nameGenerator->SetIncrementIndex(1);</div><div><span style="white-space:pre-wrap">        </span></div>
<div><span style="white-space:pre-wrap">        </span>ReaderType::Pointer reader = ReaderType::New();</div><div><span style="white-space:pre-wrap">        </span>reader->SetImageIO(itk::GDCMImageIO::New());</div><div><span style="white-space:pre-wrap">        </span>reader->SetFileNames(nameGenerator->GetFileNames());</div>
<div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>reader->Update();</div><div><span style="white-space:pre-wrap">        </span>std::cout<<"reader updata"<<std::endl;</div>
<div><br></div></div><div><span style="white-space:pre-wrap">        </span>typedef itk::StreamingImageFilter<ImageType,ImageType> StreamFilterType ; </div><div><span style="white-space:pre-wrap">        </span>StreamFilterType::Pointer StreamFilter = StreamFilterType::New();</div>
<div><span style="white-space:pre-wrap">        </span>StreamFilter->SetInput(reader->GetOutput());</div><div><span style="white-space:pre-wrap">        </span>StreamFilter->SetNumberOfStreamDivisions(10);</div><div><span style="white-space:pre-wrap">        </span>StreamFilter->Update();</div>
<div class="im"><div><br></div><div><span style="white-space:pre-wrap">        </span>typedef itk::Image<double,3> doubleImageType ; </div><div><span style="white-space:pre-wrap">        </span>typedef itk::ShiftScaleImageFilter<ImageType,doubleImageType> ShiftFilter ; </div>
<div><span style="white-space:pre-wrap">        </span>ShiftFilter::Pointer filter = ShiftFilter::New();</div></div><div><span style="white-space:pre-wrap">        </span>filter->SetInput(StreamFilter->GetOutput());</div><div class="im">
<div><span style="white-space:pre-wrap">        </span>filter->Update();</div><div><span style="white-space:pre-wrap">        </span>std::cout<<"filter updata"<<std::endl ; </div><div><br></div><div><span style="white-space:pre-wrap">        </span>typedef itk::HessianRecursiveGaussianImageFilter<doubleImageType> HessianFilterType;</div>
<div><span style="white-space:pre-wrap">        </span>HessianFilterType::Pointer hessianFilter = HessianFilterType::New();</div><div><span style="white-space:pre-wrap">        </span>hessianFilter->SetInput(filter->GetOutput());</div>
<div><span style="white-space:pre-wrap">        </span>hessianFilter->Update();</div><div><span style="white-space:pre-wrap">        </span>std::cout<<"hessian Filter"<<std::endl ; </div><div><br></div></div><div>
//if read 45 files , there is a error <span style="white-space:pre-wrap">        </span></div><div class="im"><div><span style="white-space:pre-wrap">        </span>typedef itk::Hessian3DToVesselnessMeasureImageFilter<float> VesselMeasureFilterType ; </div>
<div><span style="white-space:pre-wrap">        </span>VesselMeasureFilterType::Pointer vesselFilter = VesselMeasureFilterType::New();</div><div><span style="white-space:pre-wrap">        </span>vesselFilter->SetInput(hessianFilter->GetOutput());</div>
<div><span style="white-space:pre-wrap">        </span>vesselFilter->Update();</div><div><span style="white-space:pre-wrap">        </span>std::cout<<"vesselFilter update"<<std::endl;</div><div><br></div><div><span style="white-space:pre-wrap">        </span>typedef itk::ImageFileWriter< itk::Image<float,3> > WriterType ; </div>
<div><span style="white-space:pre-wrap">        </span>WriterType::Pointer writer = WriterType::New();</div><div><span style="white-space:pre-wrap">        </span>writer->SetInput(vesselFilter->GetOutput());</div></div><div><span style="white-space:pre-wrap">        </span>writer->SetFileName("C:\\Users\\zhq\\Desktop\\Hessiandata.vtk");</div>
<div class="im"><div><span style="white-space:pre-wrap">        </span>writer->Update();</div><div><span style="white-space:pre-wrap">        </span>std::cout<<"writer updata"<<std::endl ;</div><div><br></div><div>
<span style="white-space:pre-wrap">        </span>system("pause");</div><div>}</div><div><br></div></div></div><div><div class="h5"><br><br><br><div></div><div></div><br>At 2013-08-04 05:05:33,"Matt McCormick" <<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a>> wrote:<br>
<blockquote style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid">Hi zhq,<br><br>It may be that you are running out of memory. If that is the case, streaming can be applied to process the image in small chunks. This can be achived with the StreamingImageFilter [1] or SetNumberOfStreamDivisions [2] on ImageFileWriter.<br>
<br>Thanks,<br>Matt<br><br>[1] <a href="http://www.itk.org/Doxygen/html/classitk_1_1StreamingImageFilter.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1StreamingImageFilter.html</a><br>[2] <a href="http://www.itk.org/Doxygen/html/classitk_1_1ImageFileWriter.html#a3dc8330ca50ef60844a15c1a81cc6ade" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1ImageFileWriter.html#a3dc8330ca50ef60844a15c1a81cc6ade</a><br>
<br><div class="gmail_quote">On Fri, Aug 2, 2013 at 8:46 PM, zhq <span dir="ltr"><<a href="mailto:15891495523@126.com" target="_blank">15891495523@126.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="line-height:1.7;font-size:14px;font-family:arial">Hello :<div> I must make an apology for my yesterday email . </div><div> With referencing to the [1] , I can successfully segment blood vessels . Thank you very much . Although the result isn't very well , it help me a lot . </div>
<div> But , there still a problem . I have 100 dicom files , and I thought read 100 files , and then segment those files . But , if I read more then 43 files , an error happened . </div><div> My code and the error are shown as follow .</div>
<div><img src="cid:4970681a$1$1404711945e$Coremail$15891495523$126.com" style="min-height:388px;width:600px"><br>my code :</div><div><div>//use the itkHessian3DToVesselnessMeasureImageFilter method to segment</div><div>//bright blood vessel</div>
<div><div>#include "itkImage.h"</div><div>#include "itkImageSeriesReader.h"</div><div>#include "itkImageFileWriter.h"</div><div>#include "itkNumericSeriesFileNames.h"</div>
<div>#include "itkGDCMImageIO.h"</div><div>#include <Windows.h></div><div>#include "itkShiftScaleImageFilter.h"</div><div>#include "itkHessianRecursiveGaussianImageFilter.h"</div><div>
#include "itkHessian3DToVesselnessMeasureImageFilter.h"</div>
<div>void main()</div><div>{</div><div><span style="white-space:pre-wrap">        </span>typedef unsigned short PixelType ; </div><div><span style="white-space:pre-wrap">        </span>const unsigned int Dimension = 3; </div><div><span style="white-space:pre-wrap">        </span>typedef itk::Image<PixelType , Dimension> ImageType ; </div>
<div><span style="white-space:pre-wrap">        </span>typedef itk::ImageSeriesReader<ImageType> ReaderType ; </div></div><div><span style="white-space:pre-wrap">        </span>//there still some parameters can be set</div><div>
<div><span style="white-space:pre-wrap">        </span>typedef itk::NumericSeriesFileNames NameGeneratorType ;</div><div><span style="white-space:pre-wrap">        </span>NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();</div>
<div><span style="white-space:pre-wrap">        </span>nameGenerator->SetSeriesFormat("C:\\Users\\zhq\\Desktop\\data\\SNAP_CR\\E403434298\\E403434298S1901I%3d.dcm");</div><div><span style="white-space:pre-wrap">        </span>nameGenerator->SetStartIndex(301);</div>
</div><div><span style="white-space:pre-wrap">        </span>nameGenerator->SetEndIndex(350);</div><div><div><span style="white-space:pre-wrap">        </span>nameGenerator->SetIncrementIndex(1);</div><div><span style="white-space:pre-wrap">        </span></div>
<div><span style="white-space:pre-wrap">        </span>ReaderType::Pointer reader = ReaderType::New();</div><div><span style="white-space:pre-wrap">        </span>reader->SetImageIO(itk::GDCMImageIO::New());</div><div><span style="white-space:pre-wrap">        </span>reader->SetFileNames(nameGenerator->GetFileNames());</div>
<div><span style="white-space:pre-wrap">        </span>reader->Update();</div></div><div><span style="white-space:pre-wrap">        </span>std::cout<<"reader updata"<<std::endl;</div><div><div><br></div>
<div><span style="white-space:pre-wrap">        </span>typedef itk::Image<double,3> doubleImageType ; </div><div><span style="white-space:pre-wrap">        </span>typedef itk::ShiftScaleImageFilter<ImageType,doubleImageType> ShiftFilter ; </div>
<div><span style="white-space:pre-wrap">        </span>ShiftFilter::Pointer filter = ShiftFilter::New();</div><div><span style="white-space:pre-wrap">        </span>filter->SetInput(reader->GetOutput());</div><div><span style="white-space:pre-wrap">        </span>filter->Update();</div>
</div><div><span style="white-space:pre-wrap">        </span>std::cout<<"filter updata"<<std::endl ; </div><div><div><br></div><div><span style="white-space:pre-wrap">        </span>typedef itk::HessianRecursiveGaussianImageFilter<doubleImageType> HessianFilterType;</div>
<div><span style="white-space:pre-wrap">        </span>HessianFilterType::Pointer hessianFilter = HessianFilterType::New();</div><div><span style="white-space:pre-wrap">        </span>hessianFilter->SetInput(filter->GetOutput());</div>
</div><div><span style="white-space:pre-wrap">        </span>hessianFilter->Update();</div><div><span style="white-space:pre-wrap">        </span>std::cout<<"hessian Filter"<<std::endl ; </div><div>//if read 44 files , there is a error <span style="white-space:pre-wrap">        </span></div>
<div><div><span style="white-space:pre-wrap">        </span>typedef itk::Hessian3DToVesselnessMeasureImageFilter<float> VesselMeasureFilterType ; </div><div><span style="white-space:pre-wrap">        </span>VesselMeasureFilterType::Pointer vesselFilter = VesselMeasureFilterType::New();</div>
<div><span style="white-space:pre-wrap">        </span>vesselFilter->SetInput(hessianFilter->GetOutput());</div><div><span style="white-space:pre-wrap">        </span>vesselFilter->Update();</div><div><span style="white-space:pre-wrap">        </span>std::cout<<"vesselFilter update"<<std::endl;</div>
<div><br></div><div><span style="white-space:pre-wrap">        </span>typedef itk::ImageFileWriter< itk::Image<float,3> > WriterType ; </div><div><span style="white-space:pre-wrap">        </span>WriterType::Pointer writer = WriterType::New();</div>
<div><span style="white-space:pre-wrap">        </span>writer->SetInput(vesselFilter->GetOutput());</div><div><span style="white-space:pre-wrap">        </span>writer->SetFileName("C:\\Users\\zhq\\Desktop\\mydata.vtk");</div>
<div><span style="white-space:pre-wrap">        </span>writer->Update();</div></div><div><span style="white-space:pre-wrap">        </span>std::cout<<"writer updata"<<std::endl ;</div><div><br></div><div><span style="white-space:pre-wrap">        </span>system("pause");</div>
<div>}</div><div><br></div><br><br><br><div></div><div></div><br><pre><div><br>At <a href="tel:2013-08-02%C2%A011" value="+12013080211" target="_blank">2013-08-02 11</a>:24:29,"Matt McCormick" <<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a></div>
> wrote:
>Hi,
>
>Here[1] is a very simple brain vessel segmentation example.
>
>For more advanced vessel segmentation methods, you may want to try
>TubeTK[2], which supports analysis and visualization with the ITK and
>VTK based 3DSlicer[3].
>
>Thanks,
>Matt
>
>[1] <a href="http://itk.org/ITKExamples/src/Filtering/ImageFeature/SegmentBloodVessels/Documentation.html" target="_blank">http://itk.org/ITKExamples/src/Filtering/ImageFeature/SegmentBloodVessels/Documentation.html</a><div>
<div>
>[2] <a href="http://tubetk.org/" target="_blank">http://tubetk.org/</a>
>[3] <a href="http://slicer.org/" target="_blank">http://slicer.org/</a>
>
>On Fri, Jul 26, 2013 at 9:19 PM, 章强 <<a href="mailto:15891495523@126.com" target="_blank">15891495523@126.com</a>> wrote:
>> Hello :
>> there is a series of dcm format files which is the results of scanning
>> the brain . I want to segment blood vessels from these files with ITK , and
>> show it with VTK . Please give me a simple case . I have a problem with
>> this project .
>> how can I segment a specified region ? I know that ITK provide some
>> segmentation algorithm , but they need the Index of seeds . Can I show the
>> picture with VTK fristly ,and then point out a seed in the picture ? And if
>> there are some algorithms which can segment volume data ?
>>
>>
>> 来自网易手机号码邮箱了解更多
>>
>> _____________________________________
>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a>
>>
>> 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>
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a>
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a>
>>
>> Follow this link to subscribe/unsubscribe:
>> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a>
>>
</div></div></pre></div></div><br><br><span title="neteasefooter"><span><div><div style="border-top:#cccccc 1px solid;padding:10px 5px;font-size:12px;color:#666;line-height:22px">来自网易手机号码邮箱<a href="http://shouji.163.com" style="color:#0000ff" target="_blank">了解更多</a></div>
</div>
</span></span></blockquote></div><br>
</blockquote></div></div></div><br><br><span title="neteasefooter"><span><div><div style="border-top:#cccccc 1px solid;padding:10px 5px;font-size:12px;color:#666;line-height:22px">来自网易手机号码邮箱<a href="http://shouji.163.com" style="color:#0000ff" target="_blank">了解更多</a></div>
</div>
</span></span></blockquote></div><br>