<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap:break-word"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Hi Stefanie,</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Wow, those results *do* look weird! =) Why are they not the same shape as the image? Could you send us the complete code you used?</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">In the meantime, there's a few things to change. `cut_threshold` is probably the single most fragile algorithm you can use with a RAG. You want to be using merge_hierarchical. You can do this either on a "color graph", which merges regions according to color similarity (and is most similar to the statistical region merging of Fiji):</div><div id="bloop_customfont" style="margin:0px"><a href="http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_rag_merge.html#sphx-glr-auto-examples-segmentation-plot-rag-merge-py">http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_rag_merge.html#sphx-glr-auto-examples-segmentation-plot-rag-merge-py</a></div><div id="bloop_customfont" style="margin:0px"><br></div><div id="bloop_customfont" style="margin:0px">or on a *boundary graph*, which first detects "edges" in the image and then merges regions progressively according to the mean edge value:</div><div id="bloop_customfont" style="margin:0px"><a href="http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_rag_boundary.html#sphx-glr-auto-examples-segmentation-plot-rag-boundary-py">http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_rag_boundary.html#sphx-glr-auto-examples-segmentation-plot-rag-boundary-py</a></div><div id="bloop_customfont" style="margin:0px"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><a href="http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_boundary_merge.html#sphx-glr-auto-examples-segmentation-plot-boundary-merge-py">http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_boundary_merge.html#sphx-glr-auto-examples-segmentation-plot-boundary-merge-py</a></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">My intuition about this image is that your best choice is to use a sobel filter:</div><div id="bloop_customfont" style="margin:0px"><a href="http://scikit-image.org/docs/dev/auto_examples/edges/plot_edge_filter.html#sphx-glr-auto-examples-edges-plot-edge-filter-py">http://scikit-image.org/docs/dev/auto_examples/edges/plot_edge_filter.html#sphx-glr-auto-examples-edges-plot-edge-filter-py</a></div><div id="bloop_customfont" style="margin:0px">followed by compact watershed:</div><div id="bloop_customfont" style="margin:0px"><a href="http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_compact_watershed.html#sphx-glr-auto-examples-segmentation-plot-compact-watershed-py">http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_compact_watershed.html#sphx-glr-auto-examples-segmentation-plot-compact-watershed-py</a></div><div id="bloop_customfont" style="margin:0px">then by region boundary merging:</div> <a href="http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_boundary_merge.html#sphx-glr-auto-examples-segmentation-plot-boundary-merge-py">http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_boundary_merge.html#sphx-glr-auto-examples-segmentation-plot-boundary-merge-py</a><div><br></div><div>The edges look pretty sharp, too. You might even get good results with Canny:</div><div><a href="http://scikit-image.org/docs/dev/auto_examples/edges/plot_canny.html#sphx-glr-auto-examples-edges-plot-canny-py">http://scikit-image.org/docs/dev/auto_examples/edges/plot_canny.html#sphx-glr-auto-examples-edges-plot-canny-py</a></div><div><br> <div id="bloop_sign_1479250023126507008" class="bloop_sign">I hope all this helps!</div><div id="bloop_sign_1479250023126507008" class="bloop_sign"><br></div><div id="bloop_sign_1479250023126507008" class="bloop_sign">Juan. <br></div> <br><p class="airmail_on">On 15 November 2016 at 7:11:14 pm, Stefanie Lück (<a href="mailto:luecks@gmail.com">luecks@gmail.com</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>


<title></title>


<div dir="ltr">Dear all,
<div><br>
<div>sorry about the worse problem description! I tried <a href="http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_rag_mean_color.html#sphx-glr-auto-examples-segmentation-plot-rag-mean-color-py">
this example</a> with different parameters for SLIC and
graph.cut_threshold  but none of them gave me satisfying
results.</div>
<div><br></div>
<div>I attached the original image, the ImageJ SRM (Q=25) output
and the RAG output (segmentation.slic(img, compactness=20;
n_segments=400), graph.cut_threshold(labels1, g, 10))</div>
<div><br></div>
<div>The results are quite different, obviously I am doing
something wrong. My aim is to segment each leaf separately. At the
moment I am using felzenszwalb, which gives me quite
reasonable results. However I would like to try everything possible
and therefore I would appreciate some tips.</div>
<div><br></div>
<div>Thank you for the explanation of the algorithm, that was
helpful.</div>
<div><br></div>
<div>Best regards,</div>
<div>Stefanie </div>
<div><br></div>
<div><br></div>
<div><br></div>
<div><br></div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2016-11-15 1:51 GMT+01:00 Juan
Nunez-Iglesias <span dir="ltr"><<a href="mailto:jni.soma@gmail.com" target="_blank">jni.soma@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div id="m_-5378289856703020245bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
Hi Stefanie,</div>
<div id="m_-5378289856703020245bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<br></div>
<div id="m_-5378289856703020245bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
Sorry, these responses should all be CCd to the list, so that
others can benefit from the discussion — my bad for dropping that
thread. Could you please:</div>
<div id="m_-5378289856703020245bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<br></div>
<div id="m_-5378289856703020245bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
- provide an example segmentation where skimage is doing worse than
Fiji</div>
<div id="m_-5378289856703020245bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
- provide the script and parameter settings for both</div>
<div id="m_-5378289856703020245bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<br></div>
<div id="m_-5378289856703020245bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
Then we can help troubleshoot. I don’t know what you mean by the
results “were very strange”, for example, so it’s hard to diagnose
the problem. =)</div>
<div id="m_-5378289856703020245bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<br></div>
<div id="m_-5378289856703020245bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
Starting to merge directly from pixels, as the Fiji plugin does, is
expensive and can be error prone. SLIC is a fast, initial pixel
merging step, from which we can merge regions according to various
criteria.  With the right parameters, SLIC + RAG mean color
agglomeration should give quite similar results to Fiji’s
approach…</div>
<div id="m_-5378289856703020245bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<span class="HOEnZb"><font color="#888888"><br></font></span></div>
<div id="m_-5378289856703020245bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<span class="HOEnZb"><font color="#888888">Juan.</font></span></div>
<div>
<div class="h5"><br>
<p class="m_-5378289856703020245airmail_on">On 15 November 2016 at
2:39:45 am, Stefanie Lück (<a href="mailto:luecks@gmail.com" target="_blank">luecks@gmail.com</a>) wrote:</p>
<blockquote type="cite" class="m_-5378289856703020245clean_bq">
<div>
<div>
<div dir="ltr"><span>Hi <span style="font-size:12.8px">Juan,</span></span>
<div><span style="font-size:12.8px"><br></span></div>
<div><span style="font-size:12.8px">thank you for your reply! I
have seen and tested the RAG examples but I did not understand the
SLIC step and the results were very strange... Is there any
advantage? I am using SLIC anyway at the moment but
the statistical region merging of ImageJ gives me better
results.</span></div>
<div><span style="font-size:12.8px"><br></span></div>
<div><span style="font-size:12.8px">Thanks</span></div>
<div><span style="font-size:12.8px">Stefanie</span></div>
<div><span style="font-size:12.8px"><br></span></div>
<div><span style="font-size:12.8px"><br></span></div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2016-11-14 13:44 GMT+01:00 Juan
Nunez-Iglesias <span dir="ltr"><<a href="mailto:jni.soma@gmail.com" target="_blank">jni.soma@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div id="m_-5378289856703020245m_-5052788908612005560bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
Hi Stefanie!</div>
<div id="m_-5378289856703020245m_-5052788908612005560bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<br></div>
<div id="m_-5378289856703020245m_-5052788908612005560bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
Have a look at skimage.future.graph! There are some relevant
examples in the gallery, too:</div>
<div id="m_-5378289856703020245m_-5052788908612005560bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<br></div>
<div id="m_-5378289856703020245m_-5052788908612005560bloop_customfont" style="margin:0px"><a href="http://scikit-image.org/docs/dev/auto_examples/#segmentation-of-objects" target="_blank">http://scikit-image.org/docs/d<wbr>ev/auto_examples/#segmentation<wbr>-of-objects</a></div>
<div id="m_-5378289856703020245m_-5052788908612005560bloop_customfont" style="margin:0px"><br></div>
<div id="m_-5378289856703020245m_-5052788908612005560bloop_customfont" style="margin:0px">The future.graph API is still experimental
(that’s why it’s in “future”), so we really appreciate any feedback
you have about it!</div>
<div id="m_-5378289856703020245m_-5052788908612005560bloop_customfont" style="margin:0px"><br></div>
<div id="m_-5378289856703020245m_-5052788908612005560bloop_customfont" style="margin:0px">Juan.</div>
<div>
<div class="m_-5378289856703020245h5"><br>
<div id="m_-5378289856703020245m_-5052788908612005560bloop_sign_1479127346176364800" class="m_-5378289856703020245m_-5052788908612005560bloop_sign">
 <br></div>
<br>
<p class="m_-5378289856703020245m_-5052788908612005560airmail_on">
On 14 November 2016 at 8:21:12 pm, Stefanie Lück (<a href="mailto:luecks@gmail.com" target="_blank">luecks@gmail.com</a>)
wrote:</p>
</div>
</div>
<blockquote type="cite" class="m_-5378289856703020245m_-5052788908612005560clean_bq">
<div>
<div>
<div>
<div class="m_-5378289856703020245h5">
<div dir="ltr"><span>Hi!</span>
<div><span><br></span></div>
<div><span>I am looking for a statistical region merging
segmentation. Is there anything like this in skimage?</span></div>
<div><span><br></span></div>
<div><span>Thanks in advance,</span></div>
<div><span>Stefanie</span></div>
</div>
</div>
</div>
<span>______________________________<wbr>_________________<br>
scikit-image mailing list<br>
<a href="mailto:scikit-image@python.org" target="_blank">scikit-image@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scikit-image" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/scikit-image</a><br>
</span></div>
</div>
</blockquote>
</div>
</blockquote>
</div>
<br></div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<br></div>


</div></div></span></blockquote></div></body></html>