<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">You may find this method useful:<div><br><div><a href="http://www.itk.org/Doxygen/html/structitk_1_1ImageAlgorithm.html#a5ec5bcac992cb3b1302840636530ba20">http://www.itk.org/Doxygen/html/structitk_1_1ImageAlgorithm.html#a5ec5bcac992cb3b1302840636530ba20</a></div><div><br></div><div>Brad</div><div><br><div><div>On Mar 16, 2015, at 10:16 AM, Pol Monsó Purtí <<a href="mailto:lluna.nova@gmail.com">lluna.nova@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div>Mmh, I believe I misread the RegionOfInterestImageFilter documentation, confusing dimension with size. That should work.<br><br></div><div>I still have the computation of the splitting regions problem to handle, but maybe with this filter is easier than with the ExtractImageFilter. Or maybe it just removes step 7?<br><br></div><div>Is there a way to ease the repasting back to the original region with it? How should I use the physical space index?<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-03-16 14:25 GMT+01:00 Pol Monsó Purtí <span dir="ltr"><<a href="mailto:lluna.nova@gmail.com" target="_blank">lluna.nova@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hello Bradley,<br><br></div><div>Thank you for your answer and suggestion.<br></div><div><br></div>Answering your question: It's not for multi-threading purposes, I have to split the image due to memory limitations. <br><br>I would use extractImage directly and do streaming, but the client and the low-level libraries might not work correctly if I do that. I have to provide itk images disconnected from the pipeline and with proper indexes and sizes.<br><br></div>The RegionOfInterestImageFilter would have the same memory footprint, and it would still be tricky to compute the regions of interest, due to the overlapping.<div><div class="h5"><br><div><br><div class="gmail_extra"><br><div class="gmail_quote">2015-03-16 14:00 GMT+01:00 Bradley Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
The RegionOfInterestImageFilter[1] is very similar to the ExtractImageFilter, but returns an image whose starting index is always zeros.<br>
<br>
The process you described is remarkable close to what occur in each filter for the multi-threading process.  Also what occurs in the StreamingImageFilter is very similar, but just copies the region.<br>
<br>
As you didn't mention you motivation for chunking the data this way be it for threading or memory requirements, I can't fully advise.<br>
<br>
Brad<br>
<br>
<br>
[1 ]<a href="http://www.itk.org/Doxygen/html/classitk_1_1RegionOfInterestImageFilter.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1RegionOfInterestImageFilter.html</a><br>
[2] <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/b184194869ac6407fcbb4e309710894cfc84466f/Modules/Core/Common/include/itkStreamingImageFilter.hxx#L194-L213" target="_blank">https://github.com/InsightSoftwareConsortium/ITK/blob/b184194869ac6407fcbb4e309710894cfc84466f/Modules/Core/Common/include/itkStreamingImageFilter.hxx#L194-L213</a><br>
<div><br>
<br>
On Mar 16, 2015, at 7:37 AM, Pol Monsó Purtí <<a href="mailto:lluna.nova@gmail.com" target="_blank">lluna.nova@gmail.com</a>> wrote:<br>
<br>
> Hello everyone,<br>
><br>
> We need to split a volume into pieces, overlaped by a certain amount, do some computation and then repaste them.<br>
><br>
> The computation requires the pieces' region indexes to be set to zero. The original volume might not have index at zero, but be a subregion itself.<br>
><br>
> What is the best way to achieve this?<br>
><br>
> I've thought of the following pipeline:<br>
><br>
> 1. imageRegionSplitterSlowDimension<br>
> 2. Store the index and size of each region<br>
> 3. manually increase the size of each region (and modify index)<br>
> 4. crop with the largestPossibleRegion of the original volume (to prevent requesting more than available)<br>
> iterate over regions:<br>
>       5. extractImageFilter<br>
>       6. disconnect pipeline for each region<br>
>       7. reset indexes<br>
>       8. perform computation<br>
>       9. crop with the regions in step 1 to remove the added overlap<br>
>       10. restore indexes<br>
> 11. pasteImageFilter<br>
><br>
> I'll have to think of a smart way to deal with the index restore/cropping of steps 9 and 10.<br>
><br>
> I somehow feel somebody will have already dealt with this... And there's certainly a better way to do it.<br>
</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<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/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" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
<br>
</blockquote></div><br></div></div></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2015-03-16 14:00 GMT+01:00 Bradley Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
The RegionOfInterestImageFilter[1] is very similar to the ExtractImageFilter, but returns an image whose starting index is always zeros.<br>
<br>
The process you described is remarkable close to what occur in each filter for the multi-threading process.  Also what occurs in the StreamingImageFilter is very similar, but just copies the region.<br>
<br>
As you didn't mention you motivation for chunking the data this way be it for threading or memory requirements, I can't fully advise.<br>
<br>
Brad<br>
<br>
<br>
[1 ]<a href="http://www.itk.org/Doxygen/html/classitk_1_1RegionOfInterestImageFilter.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1RegionOfInterestImageFilter.html</a><br>
[2] <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/b184194869ac6407fcbb4e309710894cfc84466f/Modules/Core/Common/include/itkStreamingImageFilter.hxx#L194-L213" target="_blank">https://github.com/InsightSoftwareConsortium/ITK/blob/b184194869ac6407fcbb4e309710894cfc84466f/Modules/Core/Common/include/itkStreamingImageFilter.hxx#L194-L213</a><br>
<div><br>
<br>
On Mar 16, 2015, at 7:37 AM, Pol Monsó Purtí <<a href="mailto:lluna.nova@gmail.com" target="_blank">lluna.nova@gmail.com</a>> wrote:<br>
<br>
> Hello everyone,<br>
><br>
> We need to split a volume into pieces, overlaped by a certain amount, do some computation and then repaste them.<br>
><br>
> The computation requires the pieces' region indexes to be set to zero. The original volume might not have index at zero, but be a subregion itself.<br>
><br>
> What is the best way to achieve this?<br>
><br>
> I've thought of the following pipeline:<br>
><br>
> 1. imageRegionSplitterSlowDimension<br>
> 2. Store the index and size of each region<br>
> 3. manually increase the size of each region (and modify index)<br>
> 4. crop with the largestPossibleRegion of the original volume (to prevent requesting more than available)<br>
> iterate over regions:<br>
>       5. extractImageFilter<br>
>       6. disconnect pipeline for each region<br>
>       7. reset indexes<br>
>       8. perform computation<br>
>       9. crop with the regions in step 1 to remove the added overlap<br>
>       10. restore indexes<br>
> 11. pasteImageFilter<br>
><br>
> I'll have to think of a smart way to deal with the index restore/cropping of steps 9 and 10.<br>
><br>
> I somehow feel somebody will have already dealt with this... And there's certainly a better way to do it.<br>
</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<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/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" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</blockquote></div><br></div></div></body></html>