如何使用IADF-IAVFF 1.0斐济插件Java/python

如何使用IADF-IAVFF 1.0斐济插件Java/python,java,python-3.x,fiji,Java,Python 3.x,Fiji,一个新的斐济插件,用于可视化年内密度波动和 分析年内理论容积流量波动 沿木材横截面 大家好,我尝试使用这个新的斐济插件来分析我的管胞。图像处理(定位、treshold等)的前置步骤已完成。一旦插件被激活,java控制台中就会出现一条错误消息 控制台: 未能安装java.nio.charset.UnsupportedCharsetException:cp0。 [错误]空 接 [错误]空 回溯(最近一次呼叫最后一次): 文件“IADF-IAVFF_1.0.py”,第51行,在 NameError:未

一个新的斐济插件,用于可视化年内密度波动和 分析年内理论容积流量波动 沿木材横截面 大家好,我尝试使用这个新的斐济插件来分析我的管胞。图像处理(定位、treshold等)的前置步骤已完成。一旦插件被激活,java控制台中就会出现一条错误消息

控制台:

未能安装java.nio.charset.UnsupportedCharsetException:cp0。 [错误]空

[错误]空 回溯(最近一次呼叫最后一次): 文件“IADF-IAVFF_1.0.py”,第51行,在 NameError:未定义名称“ResultsTable”

我加入了python脚本 非常感谢你的帮助

import sys
import math
from ij import IJ
from ij.gui import GenericDialog

#Dialog for chosing the analysing mode
def getMode(): 
  gd = GenericDialog("Intra annual analyses")
  gd.addMessage("Please choose the analysing mode (picture requirements):\n \n[1] IADF-analysis (binary picture: white cell lumen, black cell walls)\n \n[2] IAVFF-analysis (binary picture: white cell walls, black cell lumen)")
  types = ["IADF", "IAVFF"]
  gd.addChoice("        analysing mode:", types, types[0])
  gd.showDialog()
  if gd.wasCanceled():
    sys.exit();
  IA = gd.getNextChoice()
  return IA

#Dialog for entering Hagen-Poiseuille equation parameter
def getParameter():
  gd = GenericDialog("Hagen-Poiseuille equation parameter")
  gd.addNumericField("dynamic fluid viscosity eta [mPa*s]", 1, 0)   
  gd.addNumericField("length of pipe L [m]", 1, 0)  
  gd.addNumericField("pressure difference delta p [MPa]", 1, 0)   
  gd.showDialog()
  if gd.wasCanceled():
    sys.exit();
  nu = gd.getNextNumber() 
  L = gd.getNextNumber() 
  p = gd.getNextNumber() 
  return nu, L, p

#Obtain Image, Image Processor, height and width
imp = IJ.getImage()
ip = imp.getProcessor().convertToFloat()
x = imp.getWidth()
y = imp.getHeight()
j = 1
i = 1
row = 0
grey = 1.0
sapf_list = []
sapf_pix_list = []

#Chosing analysing mode
mode = getMode()
IA = mode

# IADF-analysis
IJ.run("Set Measurements...", "area centroid perimeter shape feret's area_fraction redirect=None decimal=0")
if IA == "IADF":  
  table = ResultsTable()
  for j in range(x):
    su = 0
    sup = 0
    for i in range(y):  
      if ip.getPixelValue(j,i) > 0:
        su = su + 1
      else:
        su = su + 0  
    sup = round(float(su) / y * 100, 2)
    table.incrementCounter()
    table.addValue("sum of black pixel", su)
    table.addValue("percent of black pixel", sup)

  table.show("Results")

# IAVFF-analysis
else: 
  parameter = getParameter()
  nu, L, p = parameter
  IJ.run("Set Measurements...", "area centroid perimeter shape feret's area_fraction redirect=None decimal=3")
  IJ.run("Set Scale...")
  imp32 = imp.duplicate()
  IJ.run("Analyze Particles...")
  rt = ResultsTable.getResultsTable()
  IJ.run(imp32, "32-bit", "")


  for roi in RoiManager.getInstance().getRoisAsArray():

    ip = imp.getProcessor()
    a = rt.getValue("Feret", row)
    b = rt.getValue("MinFeret", row)
    sapf = (math.pi/4) * (1/(nu*L)) * math.pow(a/1000000, 3) * math.pow(b/1000000, 3) / (math.pow(a/1000000, 2) + math.pow(a/1000000, 2))*(p/1000000000)
    sapf_list.append(sapf)
    rt.setValue("ROI no.", row, row + 1)
    rt.setValue("Q", row, sapf)
    ip.setRoi(roi)
    stats = ImageStatistics.getStatistics(ip, Measurements.AREA, None)
    rt.setValue("Pixel count", row, stats.pixelCount)
    rt.setValue("Q per Pixel", row, sapf/stats.pixelCount)
    sapf_pix_list.append(sapf/stats.pixelCount)
    row = row + 1

    ip = imp32.getProcessor()
    ip.setRoi(roi)
    stats = ip.getStatistics()
    ip.setValue(grey)
    ip.fill(roi)
    ip.resetRoi() 
    grey = grey + 1.0

  imp32.show()
  rt.show("Results") 
  table = ResultsTable()
  sapf_pix_row_list = []

  for j in range(x):
    IJ.showProgress(j, x)
    sum_sapf_pix = 0
    for i in range(y):  
       if ip.getPixelValue(j, i) != 0.0:
         pos = int(ip.getPixelValue(j, i))-1
         sum_sapf_pix = sum_sapf_pix + sapf_pix_list[pos]       

    table.incrementCounter()
    table.addValue("Q pixel-row sum", sum_sapf_pix)
  IJ.showProgress(1)
  table.show("IAVFF-Results")

Jython-shaded-2.7.x.jar与斐济不兼容! 将其更改为Jython-shapde-2.5.3.jar

1) 下载Jython-shapde-2.5.3.jar,如下所示

2) 从Fuji.App/jars文件夹中删除Jython-shaded-2.7.0.jar(例如),并放置Jython-shapde-2.5.3.jar

3) 重新启动斐济

可能重复的