<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hi Roman,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">you should not save the pointer the SmartPointer encapsulates, but rather the SmartPointer itself. The saving line of code should not be</div><div class="gmail_default"><font face="monospace, monospace">savedPointers.push_back(caster.GetPointer());</font><br></div><div class="gmail_default"><font face="verdana, sans-serif">but rather</font></div><div class="gmail_default"><font face="monospace, monospace">savedPointers.push_back(caster);</font><br></div><div class="gmail_default"><font face="verdana, sans-serif">and later usage should not be</font></div><div class="gmail_default"><font face="monospace, monospace">smoother->SetInput(dynamic_cast<ISType*>(savedPointers[i].GetPointer())->GetOutput());</font><br></div><div class="gmail_default"><font face="verdana, sans-serif">but rather</font></div><div class="gmail_default"><font face="monospace, monospace">smoother->SetInput(savedPointers[i]->GetOutput());</font><br></div><div class="gmail_default"><br></div><div class="gmail_default"><font face="verdana, sans-serif">Can you try this?</font></div><div class="gmail_default"><font face="verdana, sans-serif"><br></font></div><div class="gmail_default"><font face="verdana, sans-serif">Regards,</font></div><div class="gmail_default"><font face="verdana, sans-serif">Dženan</font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 9, 2016 at 8:29 AM, Grothausmann, Roman Dr. <span dir="ltr"><<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-hannover.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 22/07/16 14:49, Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
Who is holding the pointer to the newly created ImageFileReader outside of<br>
the loop? For that type of operation I’ll frequently just stash smart<br>
pointers into a std::vector or list.<br>
</blockquote>
<br>
I tried to change the resample example<br>
(<a href="https://itk.org/Doxygen/html/Examples_2Filtering_2ResampleVolumesToBeIsotropic_8cxx-example.html" rel="noreferrer" target="_blank">https://itk.org/Doxygen/html/<wbr>Examples_2Filtering_2ResampleV<wbr>olumesToBeIsotropic_8cxx-<wbr>example.html</a><br>
that uses itkRecursiveGaussianImageFilte<wbr>r for each dimension) such that it works<br>
for any dimensional image.<br>
Doing as Brad suggested and storing each smart-pointer of itkRecursiveGaussianImageFilte<wbr>r in a std::vector I get a program (<a href="https://github.com/romangrothausmann/ITK-CLIs/blob/0968dd25af2abc37ffb0c0503cc4c2972b3b2098/resample.cxx" rel="noreferrer" target="_blank">https://github.com/romangroth<wbr>ausmann/ITK-CLIs/blob/0968dd25<wbr>af2abc37ffb0c0503cc4c2972b3b20<wbr>98/resample.cxx</a>) that compiles but segfaults when used. I guess the way I'm trying to dereference a pointer from the list is not correct (<a href="https://github.com/romangrothausmann/ITK-CLIs/commit/0968dd25af2abc37ffb0c0503cc4c2972b3b2098#diff-cb1b1c6837c6074372c220250cfdbb36R80" rel="noreferrer" target="_blank">https://github.com/romangroth<wbr>ausmann/ITK-CLIs/commit/0968dd<wbr>25af2abc37ffb0c0503cc4c2972b3b<wbr>2098#diff-cb1b1c6837c6074372c2<wbr>20250cfdbb36R80</a>) but I could not find an example except the one referenced in the code line.<br>
So how to correctly dereference a pointer from the list of smart-pointers to get its output?<br>
<br>
Thank for any help or hints<br>
Roman<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Jul 22, 2016, at 6:00 AM, Grothausmann, Roman Dr.<br>
<<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-hannove<wbr>r.de</a>> wrote:<br>
<br>
Many thanks Brad for Your detailed reply. I understand now the problems<br>
concerning streaming TileImageFilter. However I still wonder why my<br>
non-streaming version also does not work any more after moving the creation<br>
of reader instances into the for-loop:<br>
<a href="https://github.com/romangrothausmann/ITK-CLIs/blob/ebfc0aea37d28cbbf2bb22c3f56be52453cebde9/tile.cxx#L46-L50" rel="noreferrer" target="_blank">https://github.com/romangrotha<wbr>usmann/ITK-CLIs/blob/ebfc0aea3<wbr>7d28cbbf2bb22c3f56be52453cebde<wbr>9/tile.cxx#L46-L50</a><br>
<br>
<br>
<br>
</blockquote></blockquote>
Is this construct inappropriate for the TileImageFilter?<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Why does it work for:<br>
<a href="https://itk.org/Doxygen/html/SphinxExamples_2src_2Filtering_2ImageGrid_2AppendTwo3DVolumes_2Code_8cxx-example.html#_a2" rel="noreferrer" target="_blank">https://itk.org/Doxygen/html/S<wbr>phinxExamples_2src_2Filtering_<wbr>2ImageGrid_2AppendTwo3DVolumes<wbr>_2Code_8cxx-example.html#_a2</a><br>
<br>
<br>
<br>
</blockquote></blockquote>
On 21/07/16 15:41, Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
The TileImageFilter does not fully stream [1]. The filter also has some<br>
odd behavior, and other older implementation details. If you are going to<br>
work on a streaming pipelines it is best practice to examine the filters<br>
to determine how the Requested regions behave.<br>
<br>
However, there is no reason that the TileImageFilter algorithm couldn’t<br>
support streaming. It is just a matter of code and a bunch of testing. A<br>
contribution for this issue would be welcomed! Also this filter is in<br>
need a refactoring and bring it up to several other best practices. There<br>
are several issue with the current implementation that would cause it not<br>
to work correctly with a streaming pipeline, and cause excessive<br>
execution.<br>
<br>
You can also use the PipelieMoniotorImageFilter to record and print the<br>
pipeline interaction during Update [2]. This information helps with<br>
debugging and diagnosing problems, but if the pipeline is mis-behaving (<br>
as the TileImageFilter may ), the information may not be correct.<br>
<br>
I have tried similar streaming with the JoinSeriesImageFilter. However I<br>
ran into many problems with having hundreds of ImageIO being utilized at<br>
the same time. There were problems with having too many files open at the<br>
same time along with ImageIO libraries that couldn’t handle single<br>
threaded access to multiple files.<br>
<br>
[1]<br>
<a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/ImageGrid/include/itkTileImageFilter.hxx#L125-L136" rel="noreferrer" target="_blank">https://github.com/InsightSoft<wbr>wareConsortium/ITK/blob/<wbr>master/Modules/Filtering/Image<wbr>Grid/include/itkTileImageFilte<wbr>r.hxx#L125-L136</a><br>
<br>
<br>
</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote></blockquote></blockquote>
[2] <a href="https://itk.org/Doxygen/html/classitk_1_1PipelineMonitorImageFilter.html" rel="noreferrer" target="_blank">https://itk.org/Doxygen/html/c<wbr>lassitk_1_1PipelineMonitorImag<wbr>eFilter.html</a><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Jul 21, 2016, at 6:41 AM, Grothausmann, Roman Dr.<br>
<<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-hannove<wbr>r.de</a>> wrote:<br>
<br>
Dear mailing list members,<br>
<br>
<br>
Based on the examples for TileImageFilter I've created a working CLI<br>
to append an arbitrary number of inputs<br>
(<a href="https://github.com/romangrothausmann/ITK-CLIs/blob/4fdf5778022598dcf83fb38e6002df72bd67bef3/tile.cxx" rel="noreferrer" target="_blank">https://github.com/romangroth<wbr>ausmann/ITK-CLIs/blob/4fdf5778<wbr>022598dcf83fb38e6002df72bd67be<wbr>f3/tile.cxx</a>).<br>
<br>
<br>
</blockquote></blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote></blockquote></blockquote></blockquote>
As there is an example that does not apply Update and DisconnectPipeline on the readers (<a href="https://itk.org/Doxygen/html/SphinxExamples_2src_2Filtering_2ImageGrid_2AppendTwo3DVolumes_2Code_8cxx-example.html#_a2" rel="noreferrer" target="_blank">https://itk.org/Doxygen/html/<wbr>SphinxExamples_2src_2Filtering<wbr>_2ImageGrid_2AppendTwo3DVolume<wbr>s_2Code_8cxx-example.html#_a2</a>) <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I changed my code such that a reader instance is created for each input<br>
in a for-loop:<br>
<a href="https://github.com/romangrothausmann/ITK-CLIs/commit/ebfc0aea37d28cbbf2bb22c3f56be52453cebde9" rel="noreferrer" target="_blank">https://github.com/romangrotha<wbr>usmann/ITK-CLIs/commit/ebfc0ae<wbr>a37d28cbbf2bb22c3f56be52453ceb<wbr>de9</a><br>
<br>
<br>
<br>
</blockquote></blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote></blockquote></blockquote></blockquote>
However, the update from the writer seems not to propagate to the readers whether streaming or not. Can the TileImageFilter not stream in such a case or are further modifications necessary?<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks for any help or hints Roman<br>
<br>
<br>
On 18/08/14 17:01, Michka Popoff wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi<br>
<br>
Going the way described in the CreateVolume example is the way to<br>
go.<br>
<br>
Why did you uncomment the DisconnectPipeline() call and Update() call<br>
in the for loop ? They need to stay there, else you will always use<br>
the last image. That’s why you see the same image, the single update<br>
call will be triggered at the end of the script and read only one<br>
image.<br>
<br>
You don’t need to call tileFilter->Update(), you can remove this<br>
line. The writer->Update() will take care of the pipeline update. As<br>
a bonus, you may wrap your writer->Update() call, to fetch errors at<br>
the end of the pipeline:<br>
<br>
try { writer->Update(); } catch( itk::ExceptionObject & error ) {<br>
std::cerr << "Error: " << error << std::endl; return EXIT_FAILURE; }<br>
<br>
I made a little Python prototype, the syntax is a little bit<br>
different than in C++ but it gives you the main idea.<br>
<br>
Michka<br>
<br>
</blockquote>
<br>
-- Dr. Roman Grothausmann<br>
<br>
Tomographie und Digitale Bildverarbeitung Tomography and Digital Image<br>
Analysis<br>
<br>
Institut für Funktionelle und Angewandte Anatomie, OE 4120<br>
Medizinische Hochschule Hannover Carl-Neuberg-Str. 1 D-30625 Hannover<br>
<br>
Tel. <a href="tel:%2B49%20511%20532-2900" value="+495115322900" target="_blank">+49 511 532-2900</a> ______________________________<wbr>_______ Powered by<br>
<a href="http://www.kitware.com" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://www.kitware.com/product<wbr>s/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_FA<wbr>Q</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/insight-users</a><br>
______________________________<wbr>_________________ Community mailing list<br>
<a href="mailto:Community@itk.org" target="_blank">Community@itk.org</a> <a href="http://public.kitware.com/mailman/listinfo/community" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/community</a><br>
</blockquote>
<br>
</blockquote>
<br>
-- Dr. Roman Grothausmann<br>
<br>
Tomographie und Digitale Bildverarbeitung Tomography and Digital Image<br>
Analysis<br>
<br>
Institut für Funktionelle und Angewandte Anatomie, OE 4120 Medizinische<br>
Hochschule Hannover Carl-Neuberg-Str. 1 D-30625 Hannover<br>
<br>
Tel. <a href="tel:%2B49%20511%20532-2900" value="+495115322900" target="_blank">+49 511 532-2900</a><br>
</blockquote>
<br>
</blockquote>
<br>
-- <br>
Dr. Roman Grothausmann<br>
<br>
Tomographie und Digitale Bildverarbeitung<br>
Tomography and Digital Image Analysis<br>
<br>
Institut für Funktionelle und Angewandte Anatomie, OE 4120<br>
Medizinische Hochschule Hannover<br>
Carl-Neuberg-Str. 1<br>
D-30625 Hannover<br>
<br>
Tel. <a href="tel:%2B49%20511%20532-2900" value="+495115322900" target="_blank">+49 511 532-2900</a><br>
______________________________<wbr>_______<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://www.kitware.com/product<wbr>s/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_FA<wbr>Q</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/insight-users</a><br>
</blockquote></div><br></div>