<div dir="ltr">Yes, a histogram and a single pass on the data is the way to do this efficiently for the case in question.<div><br></div><div>I'll happily write one but wanted to avoid the effort if it already exists.</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 1, 2014 at 1:30 PM, Bradley Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
If I recall correctly this filter uses a sample list for the computation [1]. I Would think that the algorithm may be more efficient with a histogram type sample container. I would suspect that you could reuse many of the building blocks for the current filter but with the generation of a histogram instead of the adaptor.<br>


<br>
Hope that helps,<br>
Brad<br>
<br>
[1] <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Segmentation/Classifiers/include/itkScalarImageKmeansImageFilter.h#L96" target="_blank">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Segmentation/Classifiers/include/itkScalarImageKmeansImageFilter.h#L96</a><br>


<div><div class="h5"><br>
<br>
On Apr 1, 2014, at 12:59 PM, Simon Alexander <<a href="mailto:skalexander@gmail.com">skalexander@gmail.com</a>> wrote:<br>
<br>
> Hi,<br>
><br>
> I was using itk::ScalarImageKmeansImageFilter on some largish volumetric data, all unsigned 12 bit, and found it unusably slow for the particular task.<br>
><br>
> Is there an efficient k-means filter for constrained data ranges like this?<br>
><br>
> For this use it should be computable a couple of orders of magnitude faster than the general method, so I'm just trying to avoid re-implementing if possible.<br>
><br>
> - Simon<br>
</div></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://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br>
</blockquote></div><br></div>