Hi Jonathan,<div><br></div><div>In your original email you said that you need to select one island in your image (i.e. to keep only that island), and then fill the holes in that island.  When I said &quot;island removal&quot; in my last email, I actually just meant fill the holes.  I didn&#39;t mean to refer to the other islands.</div>

<div><br></div><div>If your data is 0 and 1, then you should be able to select white with:</div><div><br></div><div><meta charset="utf-8"><div>ThresholdBetween(1,1) // only fill pixels that have a value of 1 </div><div>SetOutValue(0) // set all other pixels black</div>

</div><div><br></div><div>ThresholdBetween(0,0) // only fill pixels that have a value of 0</div><div>SetOutValue(1) // set all other pixels white </div><div><br></div><div>  David</div><div><br></div><div><br><div class="gmail_quote">

On Mon, Dec 6, 2010 at 2:09 PM, Jonathan Morra <span dir="ltr">&lt;<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

My data is all either 0 or 1.  I&#39;m not sure why I have to know seed points in the other islands.  I don&#39;t know if I&#39;m going to be able to get those points.  Basically I want to keep the one island that has the mouse on it, that&#39;s how I know the one point I&#39;m interested in.<div>

<div></div><div class="h5"><br>
<br><div class="gmail_quote">On Mon, Dec 6, 2010 at 12:11 PM, David Gobbi <span dir="ltr">&lt;<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Hi Jonathan,<div><br></div><div>If you are setting the FloodExtent to a size that is larger than the region that will be selected by the fill, then it shouldn&#39;t have any effect.  As it says in the documentation, SetFloodExtent() is meant to restrict the flood fill to e.g. one slice of a 3D volume.</div>




<div><br></div><div>This filter will not automatically remove islands, it just floods each connected region that contains a seed.  For island removal, you would have to invert the threshold and then put a seed inside every island that you want to remove.</div>





<div><br></div><div>I suspect that the thresholds are not set correctly.  What is the data range of your image?  Is it [0,1]?  Or [0,255]?</div><div><br></div><font color="#888888"><div>  David</div></font><div><div></div>


<div><div><br><br><div class="gmail_quote">On Mon, Dec 6, 2010 at 12:38 PM, Jonathan Morra <span dir="ltr">&lt;<a href="mailto:jonmorra@gmail.com" target="_blank">jonmorra@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
While, I&#39;d love to use ITK, I haven&#39;t had luck getting ITK, VTK, and Java to play together, so I&#39;d like to stick with VTK for now.<div><br></div><div>David -- I&#39;m still having issues with the filter.</div>





<div>
1.  The filter has to run in real time because this is called on a mouse move event.  However, I know a bounding box outside of which all voxels are guaranteed to have a value of 0.  Therefore I went ahead and used the SetFloodExtent method and set it to my known bounding box, is this OK?</div>






<div>2  I&#39;m still seeing islands in the resulting binary mask, here is the latest version of what I&#39;m doing, any ideas?</div><div><br></div><div><div><div>            vtkPoints seedPoints = new vtkPoints();</div>





<div>            seedPoints.InsertNextPoint(panel.getPicker().GetPickPosition());</div>
<div>            vtkImageFloodFill fill = new vtkImageFloodFill();</div><div>            fill.SetInput(binaryImage);</div><div>            fill.SetSeedPoints(seedPoints);</div></div><div>            fill.ThresholdByLower(1);</div>






<div>            fill.SetFloodExtent(bounds);</div><div><div>            fill.Update();</div><div>            binaryImage = fill.GetOutput();</div></div></div><div><div></div><div><div><br><div class="gmail_quote">
On Mon, Dec 6, 2010 at 10:34 AM, Karthik Krishnan <span dir="ltr">&lt;<a href="mailto:karthik.krishnan@kitware.com" target="_blank">karthik.krishnan@kitware.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Or you could process the pipeline in ITK, if you are willing to<br>
incorporate another toolkit..<br>
<br>
itk::ConnectedThresholdImageFilter -&gt;<br>
VotingBinaryHoleFillingImageFilter (or its iterative version)<br>
<div><div></div><div><br>
<br>
On Mon, Dec 6, 2010 at 11:49 PM, David Gobbi &lt;<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>&gt; wrote:<br>
&gt; I think I made a mistake... I should have told you to use<br>
&gt; ThresholdByLower(1).  Other than that, your code looks fine.<br>
&gt;   David<br>
&gt;<br>
&gt; On Mon, Dec 6, 2010 at 11:13 AM, Jonathan Morra &lt;<a href="mailto:jonmorra@gmail.com" target="_blank">jonmorra@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; I just got your class in my version of vtk and up and running in Java, and<br>
&gt;&gt; it&#39;s not working for me.  I was wondering what I&#39;m doing wrong, could you<br>
&gt;&gt; help me out?<br>
&gt;&gt; Thanks<br>
&gt;&gt;             // We have to remove all the islands not connected to the<br>
&gt;&gt; center<br>
&gt;&gt;             // and then fill the holes in the resulting mask<br>
&gt;&gt;             vtkPoints seedPoints = new vtkPoints();<br>
&gt;&gt;<br>
&gt;&gt;  seedPoints.InsertNextPoint(panel.getPicker().GetPickPosition());<br>
&gt;&gt;             vtkImageFloodFill fill = new vtkImageFloodFill();<br>
&gt;&gt;             fill.SetInput(binaryImage);<br>
&gt;&gt;             fill.SetSeedPoints(seedPoints);<br>
&gt;&gt;             fill.ThresholdByUpper(1);<br>
&gt;&gt;             fill.Update();<br>
&gt;&gt;             binaryImage = fill.GetOutput();<br>
&gt;&gt; On Fri, Dec 3, 2010 at 11:27 AM, Jonathan Morra &lt;<a href="mailto:jonmorra@gmail.com" target="_blank">jonmorra@gmail.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Fantastic, thanks for your help!<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Fri, Dec 3, 2010 at 11:13 AM, David Gobbi &lt;<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>&gt;<br>
&gt;&gt;&gt; wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Hi Jonathan,<br>
&gt;&gt;&gt;&gt; I put my flood-fill filter on github, and tested it to make sure it<br>
&gt;&gt;&gt;&gt; still works:<br>
&gt;&gt;&gt;&gt; <a href="http://github.com/dgobbi/VTK/tree/flood-fill/Imaging/" target="_blank">http://github.com/dgobbi/VTK/tree/flood-fill/Imaging/</a><br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; The interface is just like the vtkThresholdFilter, except that it<br>
&gt;&gt;&gt;&gt; has a method called SetSeedPoints() to allow you to set your<br>
&gt;&gt;&gt;&gt; seeds.  For a binary image, call ThresholdByUpper(1) so that<br>
&gt;&gt;&gt;&gt; you can set seeds inside any non-zero islands that you want<br>
&gt;&gt;&gt;&gt; to keep in your output.<br>
&gt;&gt;&gt;&gt; I&#39;ll probably contribute this class to VTK after I have brought<br>
&gt;&gt;&gt;&gt; it up-to-date (it was originally written for VTK 4).<br>
&gt;&gt;&gt;&gt;   David<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On Thu, Dec 2, 2010 at 3:39 PM, Jonathan Morra &lt;<a href="mailto:jonmorra@gmail.com" target="_blank">jonmorra@gmail.com</a>&gt;<br>
&gt;&gt;&gt;&gt; wrote:<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Thanks, let me know where I can download it from.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; On Thu, Dec 2, 2010 at 2:36 PM, David Gobbi &lt;<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>&gt;<br>
&gt;&gt;&gt;&gt;&gt; wrote:<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; For Step 1, I have a VTK flood-fill class that do the job.  I&#39;ll<br>
&gt;&gt;&gt;&gt;&gt;&gt; upload it to<br>
&gt;&gt;&gt;&gt;&gt;&gt; gerrit so that you can try it out.  I don&#39;t think anything exists for<br>
&gt;&gt;&gt;&gt;&gt;&gt; your<br>
&gt;&gt;&gt;&gt;&gt;&gt; Step 2, though.<br>
&gt;&gt;&gt;&gt;&gt;&gt;   David<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; On Thu, Dec 2, 2010 at 3:14 PM, Jonathan Morra &lt;<a href="mailto:jonmorra@gmail.com" target="_blank">jonmorra@gmail.com</a>&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; wrote:<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; I have a binary vtkImageData class and I want to do 2 things with it,<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; and I don&#39;t know how.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; 1.  I want to remove all islands from the image except one.  I want<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; to identify the island not to be removed by a pixel location.  I have seen<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; vtkImageIslandRemoval2D, and I don&#39;t think that&#39;ll work for me, because I do<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; not know anything about the island&#39;s size that I want to keep (it could be<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; big, small, or in the middle), all that I know is one point which<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; is guaranteed to be interior to one island, and that&#39;s the island I want to<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; keep.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; 2.  I want to do hole filling on the output of step 1 and I don&#39;t<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; know how to do that.  I saw vtkFillHolesFilter but that appears only to work<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; on poly data.  I&#39;d like something analogous to that for vtkImageData.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; If anyone knows how to do these things, I&#39;d appreciate it.  Also, if<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; it matters, I&#39;m coding in Java.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Thanks<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br></div>