<div>Thank you!</div><div><div><br></div><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">------------------&nbsp;Original&nbsp;------------------</div><div style="font-size: 12px;background:#efefef;padding:8px;"><div><b>From: </b>&nbsp;"Bradley Lowekamp [via ITK - Users]"&lt;<a href="/user/SendEmail.jtp?type=node&node=31658&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>&gt;;</div><div><b>Date: </b>&nbsp;Thu, Jun 6, 2013 08:59 PM</div><div><b>To: </b>&nbsp;"zlf"&lt;<a href="/user/SendEmail.jtp?type=node&node=31658&i=1" target="_top" rel="nofollow" link="external">[hidden email]</a>&gt;; <wbr></div><div></div><div><b>Subject: </b>&nbsp;Re: Quickly get the Number of points ofConnectedThresholdImageFilter's output</div></div><div><br></div>

        Hello,
<br><br>I appears that you are using WrapITK perhaps in JAVA?
<br><br>You are not going to get good ITK iterator performance in that wrapped environment to perform efficient small operations per pixel. You should try to used existing algorithms and filters.
<br><br><br>You could use the LabelStatisticsImageFilter:
<br><br><a href="http://www.itk.org/Doxygen/html/classitk_1_1LabelStatisticsImageFilter.html" target="_top" rel="nofollow" link="external">http://www.itk.org/Doxygen/html/classitk_1_1LabelStatisticsImageFilter.html</a><br><br>You can use the StatisticsImageFilter:
<br><br><a href="http://www.itk.org/Doxygen/html/classitk_1_1StatisticsImageFilter.html" target="_top" rel="nofollow" link="external">http://www.itk.org/Doxygen/html/classitk_1_1StatisticsImageFilter.html</a><br><br>Or the BinaryImageToStatisticsLabelMapFilter:
<br><br><a href="http://www.itk.org/Doxygen/html/classitk_1_1BinaryImageToStatisticsLabelMapFilter.html" target="_top" rel="nofollow" link="external">http://www.itk.org/Doxygen/html/classitk_1_1BinaryImageToStatisticsLabelMapFilter.html</a><br><br><br><br>On Jun 6, 2013, at 5:19 AM, jerry z &lt;<a href="/user/SendEmail.jtp?type=node&amp;node=31648&amp;i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>&gt; wrote:
<br><div class="shrinkable-quote"><div class='shrinkable-quote'><br>&gt; Hi all,
<br>&gt; I need to know the number of points ConnectedThresholdImageFilter's output
<br>&gt; contains.
<br>&gt; 
<br>&gt; I am trying to get that from:
<br>&gt; 
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;itk.itkImageRegionIterator_ISS3 iterator = new
<br>&gt; itkImageRegionIterator_ISS3(
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;connectedThresholdOutput,
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;connectedThresholdOutput.LargestPossibleRegion);
<br>&gt; 
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int count = 0;
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (iterator.GoToBegin(); !iterator.IsAtEnd; iterator++)
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;short value = iterator.Get().ValueAsSS;
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (value == 1)
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;count++;
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
<br>&gt; 
<br>&gt; But it tooks 2 seconds while ConnectedThresholdImageFilter.GetOutput only
<br>&gt; took 153ms.
<br>&gt; Is there a faster way?
<br>&gt; 
<br>&gt; Regards,
<br>&gt; 
<br>&gt; Jerry
<br>&gt; 
<br>&gt; 
<br>&gt; 
<br>&gt; --
<br>&gt; View this message in context: <a href="http://itk-users.7.n7.nabble.com/Quickly-get-the-Number-of-points-of-ConnectedThresholdImageFilter-s-output-tp31646.html" target="_top" rel="nofollow" link="external">http://itk-users.7.n7.nabble.com/Quickly-get-the-Number-of-points-of-ConnectedThresholdImageFilter-s-output-tp31646.html</a><br>&gt; Sent from the ITK - Users mailing list archive at Nabble.com.
<br>&gt; _____________________________________
<br>&gt; Powered by www.kitware.com
<br>&gt; 
<br>&gt; Visit other Kitware open-source projects at
<br>&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_top" rel="nofollow" link="external">http://www.kitware.com/opensource/opensource.html</a><br>&gt; 
<br>&gt; Kitware offers ITK Training Courses, for more information visit:
<br>&gt; <a href="http://www.kitware.com/products/protraining.php" target="_top" rel="nofollow" link="external">http://www.kitware.com/products/protraining.php</a><br>&gt; 
<br>&gt; Please keep messages on-topic and check the ITK FAQ at:
<br>&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_top" rel="nofollow" link="external">http://www.itk.org/Wiki/ITK_FAQ</a><br>&gt; 
<br>&gt; Follow this link to subscribe/unsubscribe:
<br>&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_top" rel="nofollow" link="external">http://www.itk.org/mailman/listinfo/insight-users</a></div></div>_____________________________________
<br>Powered by www.kitware.com
<br><br>Visit other Kitware open-source projects at
<br><a href="http://www.kitware.com/opensource/opensource.html" target="_top" rel="nofollow" link="external">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="_top" rel="nofollow" link="external">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="_top" rel="nofollow" link="external">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="_top" rel="nofollow" link="external">http://www.itk.org/mailman/listinfo/insight-users</a><br>

        
        
        
        <br>
        <br>
        <hr noshade="noshade" size="1" color="#cccccc">
        <div style="color:#444; font: 12px tahoma,geneva,helvetica,arial,sans-serif;">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                <a href="http://itk-users.7.n7.nabble.com/Quickly-get-the-Number-of-points-of-ConnectedThresholdImageFilter-s-output-tp31646p31648.html" target="_top" rel="nofollow" link="external">http://itk-users.7.n7.nabble.com/Quickly-get-the-Number-of-points-of-ConnectedThresholdImageFilter-s-output-tp31646p31648.html</a>
        </div>
        <div style="color:#666; font: 11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                
                To unsubscribe from Quickly get the Number of points of ConnectedThresholdImageFilter's output, <a href="" target="_top" rel="nofollow" link="external">click here</a>.<br>
                <a href="http://itk-users.7.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_top" link="external">NAML</a>
        </div></div>

        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://itk-users.7.n7.nabble.com/Re-Quickly-get-the-Number-of-points-ofConnectedThresholdImageFilter-s-output-tp31658.html">Re: Quickly get the Number of points ofConnectedThresholdImageFilter's output</a><br/>
Sent from the <a href="http://itk-users.7.n7.nabble.com/">ITK - Users mailing list archive</a> at Nabble.com.<br/>