我正在尝试将参数从宏传递到在宏中运行的插件,但是当我尝试检索传递的字符串参数时,插件返回错误。我相信这意味着我需要导入一个类,但我尝试过的所有东西都没有用。这是代码:
from ij import IJ, ImagePlus, WindowManager, ImageStack
from ij.process import FloatProcessor, ImageProcessor, ByteProcessor
from ij.gui import ProgressBar, PointRoi
from ij.measure import ResultsTable
import ij
import ij.macro.Interpreter
import java.util.ArrayList as ArrayList
#stackOpen = IJ.openImage("/home/srammie/Pictures/Chain_Demo1/chainStack1.tif")
imageOpen = WindowManager.getCurrentImage()
imageOpenTitle = imageOpen.getTitle()
imageOpenTitle = imageOpenTitle.split("-")
amplitude = imageOpenTitle[0]
#imageOpen = IJ.openImage("/home/srammie/Pictures/chain_slap_eval1/summaryImage1.tif")
summaryImage = imageOpen.getProcessor()
print amplitude + " image being analyzed!"
dupImageOpen = imageOpen.createImagePlus()
dupSummaryImage = imageOpen.getProcessor().duplicate()
dupSummaryImageTitle = amplitude + "_resultsImage"
dupImageOpen.setProcessor(dupSummaryImageTitle, dupSummaryImage)
lowerBoundArray = ArrayList()
lowerBoundArrayRight = ArrayList()
lowerBoundArrayLeft = ArrayList()
upperBoundArray = ArrayList()
upperBoundArrayRight = ArrayList()
upperBoundArrayLeft = ArrayList()
deltaArray = ArrayList()
deltaArrayRight = ArrayList()
deltaArrayLeft = ArrayList()
largestDelta = 0
smallestDelta = 100
#print "Break"
pRoi = ArrayList()
arguments = Macro.getOptions()
arg = arguments.split(" ")
for i in range(0, len(arg)-1):
argString = arg[i].split("=")
pRoi.add(argString[1])
这个脚本第一次创建时对我有用,但重启斐济后,脚本开始返回错误
NameError:未定义名称“宏”。
有什么建议吗?谢谢!
修改 再次重启斐济似乎已经解决了这个问题。
答案 0 :(得分:1)
您没有导入Macro类。我将导入更改为:
from ij import IJ, ImagePlus, WindowManager, ImageStack, Macro
from ij.process import FloatProcessor, ImageProcessor, ByteProcessor
from ij.gui import ProgressBar, PointRoi
from ij.measure import ResultsTable
from ij.macro import Interpreter
from java.util import ArrayList