问题描述
我写的ImageJ插件,我需要一些想法。
我有生成堆栈中的每一个形象图的插件。所以,如果我有一个堆栈4图像时,它会产生从向量积4。
但我需要一个图形与4曲线。请帮帮我。 `
这是code。
公共无效的run(字符串ARG){
openImage();
如果(取消== FALSE){
选项();
}
如果(取消== FALSE){
对于(INT K = 0; K< imp.getStackSize(); K ++){
imp.setSlice第(k + 1);
generateESFArray(ESF图,小鬼,投资回报率);
generateLSFArray(LSF图,ESFArray);
calculateMax(); ESFArrayF = alignArray(ESFArray); 如果(取消== FALSE){
LSFArrayF = alignArray(LSFArray); }
如果(取消== FALSE){
ESFVector = averageVector(ESFArrayF);
} 如果(取消== FALSE){
LSFVector = averageVector(LSFArrayF);
INT光环=(LSFVector.length * 2);
LSFDVector =新的双[光环]
INT J = 0;
INT aura2 =(LSFVector.length); 对于(I = 0; I&≤(LSFDVector.length-3);我++){ 如果(ⅰ%2 == 0){
LSFDVector [I] = LSFVector [J]。
当J = J + 1;
}其他{
LSFDVector [I] =((0.375 * LSFVector [(J-1))+(0.75 * LSFVector [(J)]) - (0.125 * LSFVector [第(j + 1)])); } } LSFDVector [I] =((LSFVector [J-1] + LSFVector [J])* 0.5);
LSFDVector [I + 1] = LSFVector [J]。
LSFDVector第[i + 2] = LSFVector [J]。
INT indexMax = 0;
双valorMax = LSFDVector [0];
的for(int i = 0; I< LSFDVector.length;我++){
如果(valorMax< LSFDVector [I]){
indexMax = I;
valorMax = LSFDVector [I]
}
} I = indexMax;
LSFDVector [I-1] =((LSFDVector [I-2] + LSFDVector [I])* 0.5); MTFVector = fftConversion(LSFDVectorMTF);
最大= obtenerMax();
SPPVector = fftConversion(最大SPP);
LSFArrayF = alignArray(LSFArray);
如果(MTFButton.isSelected()){
generatePlot(MTFVectorMTF);
...
}无效generatePlot(双[]载体,弦乐图){ 双[] xValues;
字符串ejeX =像素;
串ejeY =;
串allTitle =;
ImageProcessor imgProc; xValues = calculateXValues(矢量,情节); //情节标题
如果(情节==ESF){
ejeY =灰值;
... allTitle =剧情+_+称号;
plotResult =新图(allTitle,ejeX,ejeY,xValues,矢量); //情节限制
如果(情节==ESF){
plotResult.setLimits(1,Vector.length,0,YMAX);
} plotResult.draw();
plotResult.show(); }
`
的有一个 addPoints
方法允许你添加多个数据系列一个阴谋。该脚本说明了它的用法。只要贴上code到ImageJ的的,选择的语言>的Groovy 的和preSS的运行来试试吧。
进口ij.gui.Plot剧情=新图(多线图,X值,Y值(双[])[0,1,2,3,4],(双[])[0.1,0.3,0.5, 0.6,0.7])
plot.addPoints((双[])[0,1,2,3,4],(双[])[0.2,0.15,0.1,0.05,0.05] Plot.LINE)
plot.setLimits(0,4,0,1)
plot.draw()
plot.show()
有关关于ImageJ的API的使用有任何疑问,你可能会在更好的帮助
I write a plugin in ImageJ, and I need some idea.I have a plugin which generate plots for every image in a stack. So if I have 4 image in a stack, it will generate 4 plot from a vector.But I need to be one plot with 4 curve. Please help me. `
This is the code.
public void run(String arg){
openImage();
if (cancel==false){
options();
}
if (cancel==false){
for (int k=0;k<imp.getStackSize();k++){
imp.setSlice(k+1);
generateESFArray("ESF Plot",imp,roi);
generateLSFArray("LSF Plot",ESFArray);
calculateMax();
ESFArrayF=alignArray(ESFArray);
if (cancel==false){
LSFArrayF=alignArray(LSFArray);
}
if (cancel==false){
ESFVector=averageVector(ESFArrayF);
}
if (cancel==false){
LSFVector=averageVector(LSFArrayF);
int aura = (LSFVector.length * 2);
LSFDVector = new double [aura];
int j = 0;
int aura2 = (LSFVector.length);
for(i=0;i<(LSFDVector.length-3); i++){
if(i % 2 == 0) {
LSFDVector[i]= LSFVector[j];
j=j+1;
}else {
LSFDVector[i]= ((0.375*LSFVector[(j-1)]) + (0.75*LSFVector[(j)]) - (0.125*LSFVector[(j+1)]));
}
}
LSFDVector[i] = ((LSFVector[j-1] + LSFVector[j])*0.5);
LSFDVector[i+1] = LSFVector[j];
LSFDVector[i+2] = LSFVector[j];
int indexMax = 0;
double valorMax = LSFDVector[0];
for(int i=0;i<LSFDVector.length;i++){
if(valorMax < LSFDVector[i]){
indexMax = i;
valorMax = LSFDVector[i];
}
}
i=indexMax;
LSFDVector[i-1]=((LSFDVector[i-2] + LSFDVector[i])*0.5);
MTFVector=fftConversion(LSFDVector, "MTF");
Max=obtenerMax();
SPPVector=fftConversion(Max,"SPP");
LSFArrayF=alignArray(LSFArray);
if (MTFButton.isSelected()){
generatePlot (MTFVector,"MTF");
...
}
void generatePlot(double[] Vector, String plot){
double[]xValues;
String ejeX="pixel";
String ejeY="";
String allTitle="";
ImageProcessor imgProc;
xValues=calculateXValues(Vector,plot);
//plot titles
if (plot=="ESF"){
ejeY="Grey Value";
...
allTitle=plot + "_" + title;
plotResult = new Plot(allTitle, ejeX, ejeY, xValues, Vector);
//plot limits
if (plot=="ESF"){
plotResult.setLimits(1,Vector.length,0,yMax);
}
plotResult.draw();
plotResult.show();
}
`
The ij.gui.Plot
class has an addPoints
method allowing you to add multiple data series to a plot. The Groovy script below illustrates its usage. Just paste the code into ImageJ's script editor, choose Language > Groovy and press Run to try it.
import ij.gui.Plot
plot = new Plot("Multiple Line Plot", "x values", "y values", (double[])[0,1,2,3,4], (double[])[0.1,0.3,0.5,0.6,0.7])
plot.addPoints((double[])[0,1,2,3,4], (double[])[0.2,0.15,0.1,0.05,0.05], Plot.LINE)
plot.setLimits(0, 4, 0, 1)
plot.draw()
plot.show()
For any further questions regarding the usage of the ImageJ API, you might get better help on the ImageJ forum.
这篇关于在ImageJ的一个图形矢量(JAVA)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!