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