<div dir="ltr"><div><div>Check out the itk random iterators: <br>itkImageRandomNonRepeatingIteratorWithIndex<br>itkImageRandomIteratorWithIndex<br><br></div>there are some wiki examples here:<br><a href="http://itk.org/Wiki/ITK/Examples/Iterators/ImageRandomConstIteratorWithIndex">http://itk.org/Wiki/ITK/Examples/Iterators/ImageRandomConstIteratorWithIndex</a><br>
<a href="http://itk.org/Wiki/ITK/Examples/Iterators/ImageRandomNonRepeatingConstIteratorWithIndex">http://itk.org/Wiki/ITK/Examples/Iterators/ImageRandomNonRepeatingConstIteratorWithIndex</a><br><br></div>You can set the region of the iterator to the bounding box and then check for inside/outside in the spatial object.<br>
<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 20, 2013 at 4:19 PM, Luke Bloy <span dir="ltr"><<a href="mailto:luke.bloy@gmail.com" target="_blank">luke.bloy@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal">Hi All,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I am interested in randomly choosing locations from within a mask. Currently my mask is stored as a SpatialObject but I could change this if needed. My current plan is to <u></u><u></u></p><p class="MsoNormal">
<u></u> <u></u></p><p><u></u><span>1)<span style="font:7.0pt "Times New Roman""> </span></span><u></u>Get the bounding box of the spatial object.<u></u><u></u></p><p><u></u><span>2)<span style="font:7.0pt "Times New Roman""> </span></span><u></u>Call vnl_sample_uniform for x,y and z<u></u><u></u></p>
<p><u></u><span>3)<span style="font:7.0pt "Times New Roman""> </span></span><u></u>Repeat 2 until the point is inside the spatial Object<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">
Does anyone have any better ideas on how to go about this. Has this been implemented somewhere else within ITK?<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Thanks,<u></u><u></u></p><p class="MsoNormal">
Luke<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p></div></div><br>_____________________________________<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><br clear="all"><br>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>