<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px"><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr"><span id="yui_3_16_0_1_1446832752234_6889">I guess I figured out what are real coordinates, but I still don't get my connected region. This is my code:</span></div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr"><span><br></span></div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">seed = vtk.vtkPoints()</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">i = (xyz[0] - origin[0]) / spacing[0]</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">j = (xyz[1] - origin[1]) / spacing[1]</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">k = (xyz[2] - origin[2]) / spacing[2]</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">seed.InsertNextPoint(i, j, k)</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class=""><br></div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">connectFilter = vtk.vtkImageThresholdConnectivity()</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">connectFilter.SetInputConnection(dilateFilter.GetOutputPort())</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">connectFilter.SetSeedPoints(seed)</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">connectFilter.ThresholdByUpper(1)</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">connectFilter.ReplaceInOn()</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">connectFilter.SetInValue(1)</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">connectFilter.ReplaceOutOn()</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">connectFilter.SetOutValue(0)</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr"></div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">connectFilter.Update()</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class=""><br></div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">My image is a vtkImageData CT head scan with values 0 and 1. The value 1 corresponds to segmented head and some artifacts, which I want to remove (they are disconnected from the head). My xyz point is a voxel that lies within the head region ( I checked, its value is 1 in the dilateFilter output). The output from vtkImageThresholdConnectivity is a image filled with 0. What am I doing wrong?</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class=""><br></div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">Thank you all in advance.</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class=""><br></div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">Best regards,</div><div id="yui_3_16_0_1_1446832752234_6878" dir="ltr" class="">Darya</div> <br><div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 13px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"> <font size="2" face="Arial"> On Friday, November 6, 2015 7:06 PM, Darya Yelshyna <darya.yelshyna@yahoo.com> wrote:<br> </font> </div> <br><br> <div class="y_msg_container"><div id="yiv8369362200"><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px;"><div id="yiv8369362200yui_3_16_0_1_1446832752234_3262"><span id="yiv8369362200yui_3_16_0_1_1446832752234_3484">Thank you so much for your reply!</span></div><div dir="ltr" id="yiv8369362200yui_3_16_0_1_1446832752234_3262"><span id="yiv8369362200yui_3_16_0_1_1446832752234_3266">I am using Python wrapping to access VTK and I don't know how to add vtkImageConnectivityFilter. I am trying to use vtkImageThresholdConnectivity and I am a little confused with setting the seed. </span>The seeds should be in real data coordinates, not in voxel index locations. How do I retrieve these coordinates from X, Y and Z indexes?</div><div dir="ltr" id="yiv8369362200yui_3_16_0_1_1446832752234_3262"><br clear="none"></div><div dir="ltr" id="yiv8369362200yui_3_16_0_1_1446832752234_3262">Sorry for inconveniece.</div><div dir="ltr" id="yiv8369362200yui_3_16_0_1_1446832752234_3262"><br clear="none"></div><div dir="ltr" id="yiv8369362200yui_3_16_0_1_1446832752234_3262">Best regards,</div><div dir="ltr" id="yiv8369362200yui_3_16_0_1_1446832752234_3262">Darya</div> <br clear="none"><div class="yiv8369362200qtdSeparateBR"><br clear="none"><br clear="none"></div><div class="yiv8369362200yqt7983134438" id="yiv8369362200yqt15826"><div class="yiv8369362200yahoo_quoted" style="display:block;"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px;"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div dir="ltr"> <font size="2" face="Arial"> On Friday, November 6, 2015 5:49 PM, David Gobbi <david.gobbi@gmail.com> wrote:<br clear="none"> </font> </div> <br clear="none"><br clear="none"> <div class="yiv8369362200y_msg_container"><div id="yiv8369362200"><div><div dir="ltr">Hi Darya,<div><br clear="none"></div><div>The vtkConnectivityFilter is meant for use on mesh data. It suspect</div><div>that when you used it on image data, it caused your computer to run</div><div>out of memory.</div><div><br clear="none"></div><div>I have a connectivity filter that I wrote specifically for images, but it</div><div>is on github. I haven't contributed it to VTK yet. But you can try it</div><div>if you are interested:</div><div><br clear="none"></div><div><a rel="nofollow" shape="rect" target="_blank" href="https://github.com/dgobbi/AIRS/tree/master/ImageSegmentation">https://github.com/dgobbi/AIRS/tree/master/ImageSegmentation</a><br clear="none"></div><div><br clear="none"></div><div>You can also try the vtkImageThresholdConnectivity filter that comes</div><div>with VTK:</div><div><a rel="nofollow" shape="rect" target="_blank" href="http://www.vtk.org/doc/nightly/html/classvtkImageThresholdConnectivity.html">http://www.vtk.org/doc/nightly/html/classvtkImageThresholdConnectivity.html</a><br clear="none"></div><div><br clear="none"></div><div> - David</div><div><br clear="none"></div><div><br clear="none"></div></div><div class="yiv8369362200gmail_extra"><br clear="none"><div class="yiv8369362200gmail_quote">On Fri, Nov 6, 2015 at 10:36 AM, Darya Yelshyna via vtkusers <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:vtkusers@vtk.org" target="_blank" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>></span> wrote:<br clear="none"><blockquote class="yiv8369362200gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="yiv8369362200yqt3289024020" id="yiv8369362200yqt36674"><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px;"><div>Hi everyone!</div><div><br clear="none"></div><div dir="ltr">I was trying to apply vtkConnectivityFilter to vtkImageData, but the program crashes at this step.</div><div dir="ltr">"This application has requested the Runtime to terminate it in an unusual way." This is this a part of my code:</div><div dir="ltr"><br clear="none"></div><div dir="ltr">dilateFilter = vtk.vtkImageContinuousDilate3D()</div><div dir="ltr">dilateFilter.SetKernelSize(5, 5, 5)</div><div dir="ltr">dilateFilter.SetInputConnection(logic2.GetOutputPort())</div><div dir="ltr">dilateFilter.Update()</div><div dir="ltr"><br clear="none"></div><div dir="ltr">connectFilter = vtk.vtkConnectivityFilter()</div><div dir="ltr">connectFilter.SetExtractionModeToLargestRegion()</div><div dir="ltr">connectFilter.SetInputConnection(dilateFilter.GetOutputPort())</div><div dir="ltr">connectFilter.Update()</div><div dir="ltr"><br clear="none"></div><div dir="ltr">I don't understand what is happening.. Can anybody help me?</div><div dir="ltr"><br clear="none"></div><div dir="ltr">Thank you in advance.</div><div dir="ltr"><br clear="none"></div><div dir="ltr">Best regards,</div><div dir="ltr">Darya</div></div></div></div><br clear="none">_______________________________________________<br clear="none">
Powered by <a rel="nofollow" shape="rect" target="_blank" href="http://www.kitware.com/">www.kitware.com</a><br clear="none">
<br clear="none">
Visit other Kitware open-source projects at <a rel="nofollow" shape="rect" target="_blank" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br clear="none">
<br clear="none">
Please keep messages on-topic and check the VTK FAQ at: <a rel="nofollow" shape="rect" target="_blank" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br clear="none">
<br clear="none">
Search the list archives at: <a rel="nofollow" shape="rect" target="_blank" href="http://markmail.org/search/?q=vtkusers">http://markmail.org/search/?q=vtkusers</a><br clear="none">
<br clear="none">
Follow this link to subscribe/unsubscribe:<br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="http://public.kitware.com/mailman/listinfo/vtkusers">http://public.kitware.com/mailman/listinfo/vtkusers</a><br clear="none">
<br clear="none"></blockquote></div><br clear="none"></div></div></div><br clear="none"><br clear="none"></div> </div> </div> </div></div></div></div></div><br><br></div> </div> </div> </div></div></body></html>