<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">p { margin: 0; }</style>
</head>
<body>
<div style="font-family: Times New Roman; font-size: 12pt; color: #000000">I have it open, but the chapter mainly applies to filters that produce images.
<br>
One of my filters does not produce images, and it's not clear to me how to handle the streaming.<br>
<br>
Le 05/06/2012 15:39, Bradley Lowekamp a écrit&nbsp;:
<blockquote cite="mid:EDF41E09-8DA4-4D2B-A8C0-4FEA28F2984B@mail.nih.gov">Hello,
<div><br>
</div>
<div>Writing streaming filters is rather complicated and having section 13.3 of the software guide open is quite useful.</div>
<div><br>
<div>
<div>On Jun 5, 2012, at 5:15 AM, Cyrille Faucheux wrote:</div>
<br class="Apple-interchange-newline">
<blockquote><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica;
              font-style: normal; font-variant: normal; font-weight:
              normal; letter-spacing: normal; line-height: normal;
              orphans: 2; text-align: -webkit-auto; text-indent: 0px;
              text-transform: none; white-space: normal; widows: 2;
              word-spacing: 0px; -webkit-border-horizontal-spacing: 0px;
              -webkit-border-vertical-spacing: 0px;
              -webkit-text-decorations-in-effect: none;
              -webkit-text-size-adjust: auto; -webkit-text-stroke-width:
              0px; font-size: medium; ">
<div>
<div style="font-family: 'Times New Roman'; font-size:
                  12pt; color: rgb(0, 0, 0); ">
Hum, too heavy for me.<br>
<br>
So, in my filter that computes the statistics on a region of an image, I've declared a function to specify the region to process. This filter extends ProcessObject. It works.<br>
<br>
To do things right, do I need to override GenerateInputRequestedRegion() (which by default, set the requested region to the largest possible region). Logically, I do.<br>
</div>
</div>
</span></blockquote>
<div><br>
</div>
<div>This is a very common thing to do, and there are example all over the tool-kit, it's still can be tricky to get just right.</div>
<div><br>
</div>
<br>
<blockquote><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica;
              font-style: normal; font-variant: normal; font-weight:
              normal; letter-spacing: normal; line-height: normal;
              orphans: 2; text-align: -webkit-auto; text-indent: 0px;
              text-transform: none; white-space: normal; widows: 2;
              word-spacing: 0px; -webkit-border-horizontal-spacing: 0px;
              -webkit-border-vertical-spacing: 0px;
              -webkit-text-decorations-in-effect: none;
              -webkit-text-size-adjust: auto; -webkit-text-stroke-width:
              0px; font-size: medium; ">
<div>
<div style="font-family: 'Times New Roman'; font-size:
                  12pt; color: rgb(0, 0, 0); ">
<br>
But...<br>
<br>
This filter may later also be used in a composite filter, whose purpose is to compute for each pixel on an image statistics on a region centered on this pixel. This filter will generate a VectorImage, so it will extend ImageToImageFilter, and will automatically
 take advantage of the streaming mecanism (through the output of the filter, which is an image, and has a requested region). But since my filter that is inside the composite one will specify for each processed pixel a new requested region, I have the impression
 that something is wrong (since the region processed by the composite filter is still the region specified by the output image).<br>
</div>
</div>
</span></blockquote>
<div><br>
</div>
<div>Composite filter are surprisingly tricky to implement. It sounds like you are proposing that for each file you are setting a requested region, and updating a mini-pipeline. This is not advise able and very in efficient.&nbsp;</div>
<div><br>
</div>
<div>I don't think I will be able to figure out the problem from your description.</div>
<div><br>
</div>
<div>I have implemented something similar to what it sounds like you are trying to do. I have been hoping to get time polish up the code and to write an Insight Journal article on it, but been too busy. Please look at the ImageFilters here, to get ideas for
 alternative is how to write a filter to compute local neighborhood statistics:</div>
<div><br>
</div>
<div><a href="https://github.com/blowekamp/itkTextureAnalysis/tree/master/include" target="_blank">https://github.com/blowekamp/itkTextureAnalysis/tree/master/include</a></div>
<div><br>
</div>
<br>
<blockquote>
<div>
<div style="font-family: 'Times New Roman'; font-size:
                12pt; color: rgb(0, 0, 0); ">
<br>
Do I still need to have the first filter propagating the requested region ?<br>
<br>
Thanks<br>
<br>
Cyrille<br>
<br>
Le 29/05/2012 02:11, Luis Ibanez a écrit&nbsp;:
<blockquote cite="mid:CABAUzPpoWMgJsuTNyrzOCxmoP24EYgt&#43;LMyRE3qU&#43;uVQD2tSFw@mail.gmail.com">
Hi Cyrille,<br>
<br>
<br>
mm, not quite the way to you describe it,...<br>
<br>
but,...<span class="Apple-converted-space">&nbsp;</span><br>
<br>
I'm wondering if you may find useful the<br>
Label Statistics image filter,<span class="Apple-converted-space">&nbsp;</span><br>
<br>
<br>
that will compute statistics from an image<span class="Apple-converted-space">&nbsp;</span><br>
by segregating them according to the labels<br>
of another image.<br>
<br>
You could then do this in parallel, if you<br>
happen to mark your regions with lablels<br>
in advance.<br>
<br>
<br>
You have this one:<br>
<a href="http://www.itk.org/Doxygen/html/classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html</a><br>
<br>
<br>
and this one:<br>
<a href="http://www.itk.org/Doxygen/html/itkLabelImageToStatisticsLabelMapFilter_8h_source.html" target="_blank">http://www.itk.org/Doxygen/html/itkLabelImageToStatisticsLabelMapFilter_8h_source.html</a><br>
<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Luis<br>
<br>
<br>
----------------------------------<br>
<div class="gmail_quote">On Mon, May 21, 2012 at 6:59 AM, Cyrille Faucheux<span class="Apple-converted-space">&nbsp;</span><span dir="ltr">&lt;<a href="mailto:cyrille.faucheux@etu.univ-tours.fr" target="_blank">cyrille.faucheux@etu.univ-tours.fr</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br>
<blockquote class="gmail_quote" style="margin-top:
                      0px; margin-right: 0px; margin-bottom: 0px;
                      margin-left: 0.8ex; border-left-width: 1px;
                      border-left-color: rgb(204, 204, 204);
                      border-left-style: solid; padding-left: 1ex; ">
Hi,<br>
<br>
I want to compute statistics (lets say for example, an histogram) on a region of an image.<br>
<br>
With an ImageToImageFilter, I know I have to specify the requested region at the end of my pipeline, and everything gets magically propagated upstream through the pipeline.<br>
<br>
Is there a generic way of doing this with a filter that do not produce an image, or should the filter handle the region of interest &quot;manually&quot; (with internal region iterators) ?<br>
<br>
Note: I dont want to use a RegionOfInterestImageFilter nor an ExtractImageFilter because it's too heavy (because later I will need to compute lots of statistics on lots of tiny region of my image).<br>
<br>
Thanks in advance.<br>
<br>
Cyrille<br>
_____________________________________<br>
Powered by<span class="Apple-converted-space">&nbsp;</span><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://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote>
</div>
<br>
</blockquote>
</div>
_____________________________________<br>
Powered by<span class="Apple-converted-space">&nbsp;</span><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://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</div>
</blockquote>
</div>
<br>
<div><span class="Apple-style-span" style="border-collapse:
            separate; color: rgb(0, 0, 0); font-family: Helvetica;
            font-style: normal; font-variant: normal; font-weight:
            normal; letter-spacing: normal; line-height: normal;
            orphans: 2; text-align: -webkit-auto; text-indent: 0px;
            text-transform: none; white-space: normal; widows: 2;
            word-spacing: 0px; -webkit-border-horizontal-spacing: 0px;
            -webkit-border-vertical-spacing: 0px;
            -webkit-text-decorations-in-effect: none;
            -webkit-text-size-adjust: auto; -webkit-text-stroke-width:
            0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate;
              -webkit-border-horizontal-spacing: 0px;
              -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0);
              font-family: Helvetica; font-size: 12px; font-style:
              normal; font-variant: normal; font-weight: normal;
              letter-spacing: normal; line-height: normal;
              -webkit-text-decorations-in-effect: none; text-indent:
              0px; -webkit-text-size-adjust: auto; text-transform: none;
              orphans: 2; white-space: normal; widows: 2; word-spacing:
              0px; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode:
                space; -webkit-line-break: after-white-space; ">
<span class="Apple-style-span" style="border-collapse:
                  separate; -webkit-border-horizontal-spacing: 0px;
                  -webkit-border-vertical-spacing: 0px; color: rgb(0, 0,
                  0); font-family: Helvetica; font-size: 12px;
                  font-style: normal; font-variant: normal; font-weight:
                  normal; letter-spacing: normal; line-height: normal;
                  -webkit-text-decorations-in-effect: none; text-indent:
                  0px; -webkit-text-size-adjust: auto; text-transform:
                  none; orphans: 2; white-space: normal; widows: 2;
                  word-spacing: 0px; ">
<p style="margin-top: 0px; margin-right: 0px;
                    margin-bottom: 0px; margin-left: 0px; ">
<font style="font: normal normal normal 12px/normal
                      Helvetica; " face="Helvetica" size="3">========================================================</font></p>
<p style="margin-top: 0px; margin-right: 0px;
                    margin-bottom: 0px; margin-left: 0px; ">
<font style="font: normal normal normal 12px/normal
                      Helvetica; " face="Helvetica" size="3">Bradley Lowekamp<span class="Apple-converted-space">&nbsp;</span><span class="Apple-converted-space">&nbsp;</span></font></p>
<p style="margin-top: 0px; margin-right: 0px;
                    margin-bottom: 0px; margin-left: 0px; ">
<font style="font: normal normal normal 12px/normal
                      Helvetica; " face="Helvetica" size="3">Medical Science and Computing for</font></p>
<p style="margin-top: 0px; margin-right: 0px;
                    margin-bottom: 0px; margin-left: 0px; ">
<font style="font: normal normal normal 12px/normal
                      Helvetica; " face="Helvetica" size="3">Office of High Performance Computing and Communications</font></p>
<p style="margin-top: 0px; margin-right: 0px;
                    margin-bottom: 0px; margin-left: 0px; ">
<font style="font: normal normal normal 12px/normal
                      Helvetica; " face="Helvetica" size="3">National Library of Medicine<span class="Apple-converted-space">&nbsp;</span></font></p>
<p style="margin-top: 0px; margin-right: 0px;
                    margin-bottom: 0px; margin-left: 0px; ">
<font style="font: normal normal normal 12px/normal
                      Helvetica; " face="Helvetica" size="3"><a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a></font></p>
<br class="Apple-interchange-newline">
</span></div>
</span></span><br class="Apple-interchange-newline">
</div>
<br>
</div>
</blockquote>
</div>
</body>
</html>