Bonjour, je suis actuellement en stage de deuxieme année d'iut informatique et je developpe un plug in java pour le logiciel image J qui doit repère les maxima locaux seulement j'ai des problemes d'installation du plugin des problemes d'erreur au niveau du code et aussi des problemes d'exportation en .jar


Voici le code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
 
package maxloc;
 
import ij.IJ;
import ij.ImagePlus;
import ij.ImageStack;
import ij.plugin.PlugIn; 
import ij.WindowManager;
/*import java.util.ArrayList;
import mcib3d.geom.Voxel3D;
import mcib3d.geom.Voxel3DComparable;*/
import java.lang.Math;
 
public class Local_maxima implements PlugIn {
 
	public static void main(String[] args) {
		//IJ.runPlugIn("localmaxima","");
		IJ.runPlugIn(new ImagePlus(), "local_maxima", "");
	}
	public void  run (String args){
 
		//collect of every information about the rawImage
		ImagePlus image = WindowManager.getCurrentImage();
		//ImageStack maxima = exec(image);
		ImageStack maxima =  exec(image);
		if (null != maxima) {
			ImagePlus scaled = new ImagePlus("Local maxima 3D", maxima);
			scaled.show();
		}
	}
	public ImageStack exec (ImagePlus img)
	//public int[][][] exec (ImagePlus img)
	{
		//collect of every information about the image
		ImageStack im = img.getStack();
		int wi=im.getWidth();
		int he=im.getHeight();
		int dep=im.getSize();
		double bool;
		float dx = 0.645f;
		float dy= 0.645f;
		int dz= 1; //rawImage.getVoxel(10,10,10).getRoundZ();
 
		//creation of four tabs
		ImageStack gx = new ImageStack(wi, he);
		ImageStack gy = new ImageStack(wi, he);
		ImageStack gz = new ImageStack(wi, he);
		//float[][][] gx = new float[width][height][depth];
		//float[][][] gy = new float[width][height][depth];
		//float[][][] gz = new float[width][height][depth];
		double[][][] ng = new double[wi][he][dep];
 
		//calcul of the 3 components of the gradient and the norm of it
		for (int k=0;k<dep;k++){
			for (int i=0;i<wi;i++){
				for (int j=0;j<he;j++){
					gx.setVoxel(i,j,k,(im.getVoxel(i+1,j,k)-im.getVoxel(i,j,k))/dx);
					gy.setVoxel(i,j,k,(im.getVoxel(i,j+1,k)-im.getVoxel(i,j,k))/dy);
					gz.setVoxel(i,j,k,(im.getVoxel(i,j,k+1)-im.getVoxel(i,j,k))/dz);
					ng[i][j][k]=gx.getVoxel(i,j,k)*gx.getVoxel(i,j,k) + gy.getVoxel(i,j,k)*gy.getVoxel(i,j,k) + gz.getVoxel(i,j,k)*gz.getVoxel(i,j,k);
				}
			}
		}
 
		//creation of the image of local maxima
		//int [][][] maxloc = new int[wi][he][dep];
		ImageStack maxloc = new ImageStack();
 
		for(int k=2; k <= dep-1; k++){
			for (int i=2; i <= wi-1; i++){
				for (int j=2; j <= he-1; j++){
 
					if(Math.abs(gx.getVoxel(i,j,k))>=Math.abs(gy.getVoxel(i,j,k))&Math.abs(gx.getVoxel(i,j,k))> Math.abs(gz.getVoxel(i,j,k)))
					{
						if(ng[i][j][k]>=ng[i-1][j][k] && ng[i][j][k]>=ng[i+1][j][k])
						{
							bool=1;
						}
						else{
							bool=0;
						}
					}
					else if(Math.abs(gy.getVoxel(i,j,k))>Math.abs(gx.getVoxel(i,j,k))& Math.abs(gy.getVoxel(i,j,k))>= Math.abs(gz.getVoxel(i,j,k)))
					{
						if(ng[i][j][k]>=ng[i][j-1][k] && ng[i][j][k]>=ng[i][j+1][k])
						{
							bool=1;
						}
						else{
							bool=0;
						}
					}
					else if(Math.abs(gz.getVoxel(i,j,k))>=Math.abs(gx.getVoxel(i,j,k))&Math.abs(gz.getVoxel(i,j,k))> Math.abs(gy.getVoxel(i,j,k)))
					{
						if(ng[i][j][k]>=ng[i][j][k-1] && ng[i][j][k]>=ng[i][j][k+1]){
							bool=1;
						}
						else{
							bool=0;
						}
					}
					else{
						if(ng[i][j][k]>=ng[i-1][j][k] && ng[i][j][k]>=ng[i+1][j][k])
						{
							bool=1;
						}
						else{
							bool=0;
						}
 
					}
					maxloc.setVoxel(i,j,k,bool);
					//maxloc[i][j][k]=bool;
				}
			}
		} 
		return maxloc; 
	}
 
}
pour les erreurs qui me sont renvoyées c'est très étrange

(Fiji Is Just) ImageJ 1.47q; Java 1.6.0_45 [64-bit]; Mac OS X 10.8.3; 256MB of 2821MB (9%)

java.lang.ArrayIndexOutOfBoundsException: 278
at maxima.Local_maxima.exec(Local_maxima.java:102)
at maxima.Local_maxima.run(Local_maxima.java:24)
at fiji.scripting.java.PlugInExecutor.tryRun(PlugInExecutor.java:143)
at fiji.scripting.java.PlugInExecutor.tryRun(PlugInExecutor.java:104)
at fiji.scripting.java.PlugInExecutor.run(PlugInExecutor.java:85)
at fiji.scripting.java.PlugInExecutor.run(PlugInExecutor.java:79)
at fiji.scripting.java.PlugInExecutor.run(PlugInExecutor.java:75)
at fiji.scripting.java.Refresh_Javas.runPlugin(Refresh_Javas.java:375)
at fiji.scripting.java.Refresh_Javas.compileAndRun(Refresh_Javas.java:126)
at fiji.scripting.java.Refresh_Javas.runScript(Refresh_Javas.java:71)
at common.RefreshScripts.run(RefreshScripts.java:287)
at fiji.scripting.java.Refresh_Javas.run(Refresh_Javas.java:61)
at ij.IJ.runUserPlugIn(IJ.java:194)
at ij.IJ.runPlugIn(IJ.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at ij.Command.runPlugIn(Command.java:148)
at ij.Command.runCommand(Command.java:97)
at ij.Executer.run(Executer.java:64)
at java.lang.Thread.run(Thread.java:680)

il ne devrait pas y avoir de boundexception car ma boucle va de 2 a n-1 a chaque fois donc a la ligne 102 chercher l'élément i-1 et i+1 devrait fonctionner
qu'en pensez vous s'il vous plait ?
je dois presenter le plugin demain matin a 8heure