<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hi Shen,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">using a recent version of <a href="https://github.com/InsightSoftwareConsortium/ITK/commit/90b04fba49007c300caba06f796fff6976424c40">ITK</a> (and using the attached C++ version of your code) I could not reproduce this problem. For me the output is:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><div class="gmail_default">[197, 378]</div><div class="gmail_default">[196, 378]</div><div class="gmail_default">[195, 379]</div><div class="gmail_default">[194, 379]</div><div class="gmail_default">[193, 379]</div><div class="gmail_default">[192, 380]</div><div class="gmail_default">[191, 380]</div><div class="gmail_default">[190, 380]</div><div class="gmail_default">[189, 380]</div><div class="gmail_default">[188, 380]</div><div class="gmail_default">[187, 381]</div><div><br></div><div>Regards,</div><div>Dženan</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 14, 2016 at 11:00 PM, 沈庄明 <span dir="ltr"><<a href="mailto:zhuangming.shen@sphic.org.cn" target="_blank">zhuangming.shen@sphic.org.cn</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi all,<br>
</p>
<p><br>
</p>
<p>I used itk::ContourExtractor2DImageFilter to extract contours from a binary image (i.e. only 0 or 255 for pixel intensity). Mostly, the code can work correctly. However, the code sometimes outputs very strange coordinates (e.g. (194.0, 5.36011819173e-320) ), which should
 represent the path of the contour. When I change the contour value from 0 to other number no less than 255 (i.e. 250), I got more strange coordinates. <span style="font-size:12pt">My code and results are listed as below. Has anyone met the same situation?</span><span style="font-size:12pt">​</span></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)"><br>
</span></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)"><br>
</span></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)">Regards,</span></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)"><br>
</span></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)">Zhuangming Shen</span></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)"><br>
</span></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)"><br>
</span></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)"><br>
</span></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)">Here is my code</span></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)">=======================================================================================</span></p>
<div>import itk</div>
<div><br>
</div>
<div>reader = itk.ImageFileReader[itk.Image.UC2].New()<br>
</div>
<div>reader.SetFileName("test.nii")<br>
</div>
<div>reader.Update()</div>
<div><br>
</div>
<div>contour_extractor = itk.ContourExtractor2DImageFilter[itk.Image.UC2].New()</div>
<div>contour_extractor.SetInput(reader.GetOutput())</div>
<div>contour_extractor.SetContourValue(0)</div>
<div>contour_extractor.Update()<br>
</div>
<div><br>
</div>
<div><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)">contour_number = contour_extractor.GetNumberOfOutputs()</span><br>
</div>
<div><br>
</div>
<div>print("There are "+str(contour_number)+" contours")<br>
</div>
<div><br>
</div>
<span style="font-size:12pt">for k in xrange(contour_number):</span>
<div>    print("================  Contour "+str(k)+" ================")</div>
<div>    </div>
<div>    point_number = contour_extractor.GetOutput(k).GetVertexList().Size()</div>
<div>    print("Point number: "+str(point_number))</div>
<div>    <br>
</div>
<div>    for i in xrange(point_number):</div>
<div>        print("("+str(contour_extractor.GetOutput(k).GetVertexList().GetElement(i)[0])+","+str(contour_extractor.GetOutput(0).GetVertexList().GetElement(i)[1])+")")<br>
</div>
<div>    <br>
</div>
<p><br>
</p>
<p><br>
</p>
<p>Here is my results<br>
</p>
<p>=========================================================================================<br>
</p>
<div>There are 2 contours</div>
<div>================  Contour 0 ================</div>
<div>Point number: 670</div>
<div>(373.0,380.0)</div>
<div>(372.0,380.0)</div>
<div>(371.0,380.0)</div>
<div>(370.0,380.0)</div>
<div>(369.0,380.0)</div>
<div>(368.0,380.0)</div>
<div>(367.0,380.0)<br>
</div>
<div>... <br>
</div>
<div>
<div>(375.0,379.0)</div>
<div>(374.0,379.0)</div>
<div>(373.0,380.0)</div>
<div>================  Contour 1 ================</div>
<div>Point number: 677</div>
<div>(188.0,380.0)</div>
<div>(187.0,380.0)</div>
<div>(186.0,380.0)</div>
<div>(185.0,380.0)<br>
</div>
<div>...<br>
</div>
<div>(198.0,379.0)</div>
<div>(197.0,379.0)</div>
<div>(196.0,379.0)</div>
<div>(195.0,380.0)</div>
<div>(194.0,5.36011819173e-320)</div>
<div>(193.0,382.0)</div>
<div>(192.0,382.0)</div>
<div>(191.0,382.0)</div>
<div>(190.0,382.0)</div>
<div>(189.0,382.0)</div>
<div>(188.0,382.0)<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
Here is the input test.nii<br>
</div>
<div>=============================================================================================<br>
</div>
<img name="1284244893028963136_null" title="pastedImage.png" src="cid:beaa107f-9827-40b6-aac6-cdb30092e744">​<br>
</div>
<p><br>
</p>
</div>

<br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div>