<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello,<div><br></div><div>The classic gray scale watershed segmentation takes a gradient magnitude as an input, where the binary watershed takes a distance map. I put the filters together for the binary watershed method recently with SimpleITK. The basics of the SimpleITK python code was this:</div><div><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; font-size: 12px; font-family: Consolas, 'Liberation Mono', Courier, monospace; color: rgb(51, 51, 51); line-height: 16px; "><div class="line" id="LC157" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; "><span class="n" style="margin: 0px; padding: 0px; border: 0px; "><br></span></div><div class="line" id="LC157" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; "><span class="n" style="margin: 0px; padding: 0px; border: 0px; "><span class="n" style="margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255); ">l</span><span style="background-color: rgb(255, 255, 255); "> </span><span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; background-color: rgb(255, 255, 255); ">=</span><span style="background-color: rgb(255, 255, 255); "> </span><span class="n" style="margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255); ">sitk</span><span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; background-color: rgb(255, 255, 255); ">.</span><span class="n" style="margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255); ">BinaryThreshold</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255); ">(</span><span style="background-color: rgb(255, 255, 255); "> </span><span class="n" style="margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255); ">labelImage</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255); ">,</span><span style="background-color: rgb(255, 255, 255); "> </span><span class="n" style="margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255); ">labelID</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255); ">,</span><span style="background-color: rgb(255, 255, 255); "> </span><span class="n" style="margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255); ">labelID</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255); ">,</span><span style="background-color: rgb(255, 255, 255); "> </span><span class="mi" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 153, 153); background-color: rgb(255, 255, 255); ">1</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255); ">,</span><span style="background-color: rgb(255, 255, 255); "> </span><span class="mi" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 153, 153); background-color: rgb(255, 255, 255); ">0</span><span style="background-color: rgb(255, 255, 255); "> </span><span class="p" style="margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255); ">)</span></span></div><div class="line" id="LC157" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; "><span class="n" style="margin: 0px; padding: 0px; border: 0px; "><span class="p" style="margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255); "><br></span></span></div><div class="line" id="LC157" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; "><span class="n" style="margin: 0px; padding: 0px; border: 0px; ">d</span> <span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">=</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">sitk</span><span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">.</span><span class="n" style="margin: 0px; padding: 0px; border: 0px; ">SignedMaurerDistanceMap</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> l<span class="p" style="margin: 0px; padding: 0px; border: 0px; ">,</span></div><div class="line" id="LC158" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n" style="margin: 0px; padding: 0px; border: 0px; ">inInsideIsPositive</span> <span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">=</span> <span class="bp" style="margin: 0px; padding: 0px; border: 0px; color: rgb(153, 153, 153); ">False</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">,</span></div><div class="line" id="LC159" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n" style="margin: 0px; padding: 0px; border: 0px; ">inSquaredDistance</span> <span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">=</span> <span class="bp" style="margin: 0px; padding: 0px; border: 0px; color: rgb(153, 153, 153); ">False</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">,</span></div><div class="line" id="LC160" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n" style="margin: 0px; padding: 0px; border: 0px; ">inUseImageSpacing</span> <span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">=</span> <span class="bp" style="margin: 0px; padding: 0px; border: 0px; color: rgb(153, 153, 153); ">True</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">)</span></div></pre><div><span class="n" style="margin: 0px; padding: 0px; border: 0px; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">d</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "> </span><span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">=</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "> </span><span class="n" style="margin: 0px; padding: 0px; border: 0px; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">sitk</span><span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">.</span><span class="n" style="margin: 0px; padding: 0px; border: 0px; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">Threshold</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">(</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "> </span><span class="n" style="margin: 0px; padding: 0px; border: 0px; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">d</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">,</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "> </span><span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">-</span><span class="mf" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 153, 153); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">1e23</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">,</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "> </span><span class="mi" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 153, 153); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">0</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">,</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "> </span><span class="mi" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 153, 153); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">0</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "> </span><span class="p" style="margin: 0px; padding: 0px; border: 0px; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">)</span></div></div><div><span class="p" style="margin: 0px; padding: 0px; border: 0px; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "><br></span></div><div><span class="p" style="margin: 0px; padding: 0px; border: 0px; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "><span class="n" style="margin: 0px; padding: 0px; border: 0px; ">ws</span> <span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">=</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">sitk</span><span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">.</span><span class="n" style="margin: 0px; padding: 0px; border: 0px; ">MorphologicalWatershed</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">d</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">,</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">inMarkWatershedLine</span><span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">=</span><span class="bp" style="margin: 0px; padding: 0px; border: 0px; color: rgb(153, 153, 153); ">True</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">,</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">inLevel</span> <span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">=</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">level</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">)</span></span></div><div><br></div><div><br></div><div>It should be fairly straight forward to use ITK proper and create a pipeline based on the above.</div><div><br></div><div>Regarding the Ultimate Erode points. I don't believe we have a direct morphological filter to compute that. But it can be simply computed as the RegionalMaxima of a distance field from you binary image.</div><div><br></div><div>Brad</div><div><br><div><div>On Nov 6, 2012, at 3:11 PM, Ruben Neves &lt;<a href="mailto:ruben.m.neves@gmail.com">ruben.m.neves@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Greetings,<div><br></div><div>I have a 16-bit (signed short) vtk image of a MicroCT that I have already filtered and binarized.</div><div><br></div><div>I have been playing with some samples (taken from the original) in ImageJ and I reached the point were I really need to apply the Ultimate Erode Points and the Watershed segmentation to my binary original. To be clear, I want the separate outputs from each process, no mixes...</div>
<div><br></div><div>As for the watershed segmentation, I've got the&nbsp;algorithm taken from the examples of ITK, but I'm not very sure how to work with the input parameters. In my binary original I have shapes that are "overlapping", and became a single shape with the binary threshold, hence my need for watershed. I just need to separate them like ImageJ does.</div>
<div><br></div><div>As for the Ultimate Erode Points, I'm a bit clueless...</div><div><br></div><div>Can Anyone shed some light over these two issues?</div><div><br></div><div>Thanks in advance,&nbsp;</div><div>Best regards</div>
<div><br></div><div>Ruben Neves</div>
_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></blockquote></div><br></div></body></html>