<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body 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="null" title="pastedImage.png" src="cid:beaa107f-9827-40b6-aac6-cdb30092e744">​<br>
</div>
<p><br>
</p>
</body>
</html>