DIADEM_metric不能运行及解决办法

有的时候运行DIADEM metric这个评价指标的时候会报错,报错的形式如下图所示,会提示在哪一行有错误,比如这个案例中说的是17行有错,然后发现问题在于17行的type为负数,没有办法处理。

java.util.zip.DataFormatException: Improper SWC format at line 17 of 080926a.tif.v3dpbd.swc
        at org.krasnow.cng.data.ReadSWC.convertSwcToSwcTreeList(ReadSWC.java:115)
        at org.krasnow.cng.data.ReadSWC.convertSwcToBinaryTreeList(ReadSWC.java:175)
        at org.krasnow.cng.diadem.DiademMetric.scoreReconstruction(DiademMetric.java:580)
        at org.krasnow.cng.diadem.DiademMetric.main(DiademMetric.java:3121)

解决的方案

refineGroundTruth.m

clear
clc
%净化swc,将所有负数和0的type改为正数3
%verson 1(2019.11.1)
ground_truth_folder='C:\Users\penglab\Desktop\data analyse\DiademMetric\ground_truth\mouseRGC\';

V3DIOPATH='D:\v3d_2013\v3d_external\matlab_io_basicdatatype';
addpath(V3DIOPATH)

swc_sufix= '*.swc' ;
after_refine_suffix= '_r.swc';
all_swc_name=dir(fullfile(ground_truth_folder,swc_sufix));
swcNames={all_swc_name.name}';
if isempty(swcNames)
    disp(['error , empty swcNames in ' ground_truth_folder])
end
for j=1:size(swcNames,1)
    swc=load_v3d_swc_file([ground_truth_folder swcNames{j}]);
    
    %function1 将所有负数和0的type修改为
    for i=1:size(swc,1)
        if(swc(i,2)<=0)
            swc(i,2)=3; 
        end

    end

    save_v3d_swc_file(swc,[ground_truth_folder swcNames{j} after_refine_suffix]);
    disp(['save file as ' swcNames{j} after_refine_suffix])
end



我的解决方案是读取指定路径下所有的swc,在同位置生成修正后的SWC,将所有负数和0的type改为正数3,也可以按照自己的需求进行修改。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值