原始 MediaWiki 页面

我知道编辑这个网站吗?

边界细化后的分割评估 - 脚本

自迁移出 MediaWiki 以来,本页内容尚未经过审查。如果您愿意帮忙,请查看帮助指南

# 介绍

下面的Beanshell script允许您在将图像片段的亲细化至1像素宽度后评估segmentation方法的性能。

对原始§§1§§§评分系统的回顾性评估表明,它对于神经突边界宽度的变化不够稳健。在评估所有这些指标和相关变体后,发现Rand errorVariation of information的特殊标准化版本最符合我们分割质量的定性判断:

  • 未知细化后前景限制的兰德评分:V兰德(细化)
  • 边界细化后的前景限制信息理论评分:V信息(细化)

此脚本计算输入图像的一组阈值(建议的分割)上的最佳VRand§§2§§§(细化)</sub>和VInfo§(细化)建议的标签可以是二进制图像或概率图像([0.0-1.0]值)。

相关指标的更多详细信息,请参见challenge publication

# 使用

将其复制/粘贴到Script Editor中或将其保存到.bsh文件中并运行它(FileOpen):

/**
 * Script to calculate the segmentation error between some 2D 
 * original (binary) labels and their corresponding proposed labels (binary or
 * probability -0-1- values).
 * 
 * The evaluation metrics are:
 *  - Maximal foreground-restricted Rand score after thinning
 *  - Maximal foreground-restricted information theoretic score after thinning
 * 
 * These are the final official metrics for the ISBI-2012 challenge
 * on segmentation of neuronal structures in EM stacks (http://brainiac2.mit.edu/isbi_challenge/).
  * 
 * @author Ignacio Arganda-Carreras (ignacio.arganda@ehu.eus)
 * @version January 12, 2016
 */
  
import trainableSegmentation.metrics.*;
import ij.WindowManager;
import ij.gui.GenericDialog;
import ij.IJ;
  
// Get the list of images that are open
ids = WindowManager.getIDList();
  
if ( ids == null || ids.length < 2 )
{
    IJ.showMessage( "You should have at least two images open." );
    return;
}
  
// Get all the titles of the open images        
titles = new String[ ids.length ];
for ( int i = 0; i < ids.length; ++i )
{
    titles[ i ] = ( WindowManager.getImage( ids[ i ] ) ).getTitle();
}
  
// Create dialog        
gd = new GenericDialog( "Evaluate segmentation results" );
          
gd.addMessage( "Image Selection:" );
current = WindowManager.getCurrentImage().getTitle();
gd.addChoice( "Original_labels", titles, current );
gd.addChoice( "Proposal", titles, current.equals( titles[ 0 ] ) ? titles[ 1 ] : titles[ 0 ] );
          
gd.addMessage( "Segmentation error metrics:" );
gd.addCheckbox( "Maximal foreground-restricted Rand score after thinning", true );
gd.addCheckbox( "Maximal foreground-restricted information theoretic score after thinning", true );

gd.addMessage( "Data selection:" );
gd.addCheckbox( "Binary proposal", false );
 
gd.showDialog();
          
if (gd.wasCanceled()) 
    return;
          
originalLabels = WindowManager.getImage( ids[ gd.getNextChoiceIndex() ] );
proposedLabels = WindowManager.getImage( ids[ gd.getNextChoiceIndex() ] );
  
calculateVRandAfterThinning = gd.getNextBoolean();
calculateVInfoAfterThinning = gd.getNextBoolean();

binaryProposal = gd.getNextBoolean();
  
IJ.log("---");
IJ.log("Evaluating segmentation...");
IJ.log("  Original labels: " + originalLabels.getTitle());
IJ.log("  Proposed labels: " + proposedLabels.getTitle() + "\n");

// Calculate segmentation error with the selected metrics
  
if( calculateVRandAfterThinning )
{   
    IJ.log("\nCalculating maximal foreground-restricted Rand score after thinning...");
    metric = new RandError( originalLabels, proposedLabels );
    maxThres = binaryProposal ? 0.0 : 1.0;
    maxScore = metric.getMaximalVRandAfterThinning( 0.0, maxThres, 0.1, true );  
    IJ.log("  Maximum foreground-restricted Rand score after thinning: " + maxScore );     
}

if( calculateVInfoAfterThinning )
{   
    IJ.log("\nCalculating maximal foreground-restricted information theoretic score after thinning...");
    metric = new VariationOfInformation( originalLabels, proposedLabels );
    maxThres = binaryProposal ? 0.0 : 1.0;
    maxScore = metric.getMaximalVInfoAfterThinning( 0.0, maxThres, 0.1 );  
    IJ.log("  Maximum foreground-restricted information theoretic score after thinning: " + maxScore );     
}

如果在打开两个图像时运行它,将弹出以下对话框:

Script segmentation evaluation thinning dialog

在这里,您可以在打开的图像中选择哪些是原始标签,哪些是建议的标签,以及您想要应用来评估分割结果的具体指标。如果建议的标签是二进制的(不是概率图像),那么您可以单独“二进制建议”使用许多阈值。

单击“确定”后,将应用指标,结果将显示在“日志”窗口中:

Script segmentation evaluation thinning log

参考文献

  • Ignacio Arganda-Carreras、Srinivas C. Turaga、Daniel R. Berger、Dan Ciresan、Alessandro Giusti、Luca M. Gambardella、Jürgen Schmidhuber、Dmtry Laptev、Sarversh Dwivedi、Joachim M. Buhmann、刘婷、Mojtaba Seyedhosseini、Tolga Tasdizen、Lee Kamentsky、Radim Burget、 Vaclav Uher、Xiao Tan、Chanming Sun、Tuan D. Pham、Eran Bas、Mustafa G. Uzunbas、Albert Cardona、Johannes Schindelin 和 H. Sebastian Seung。Crowdsourcing the creation of image segmentation algorithms for connectomics。神经解剖学前沿,卷。9、不。142,2015。