Re: return value

Posted by Thomas Boudier on
URL: http://imagej.273.s1.nabble.com/Can-t-load-images-from-remote-directory-tp3693495p3693500.html

Hi,

Put your x,y,z values as class variables so they can be read everywhere
(an do not forget to supress the declaration in the function myread) :

class mean3DXYZ {

int x,y,z;

public int myread (String string) {

DO NOT WRITE int x ....

}



Thomas




m000an ZH a écrit :

> Hi, just a very easy question.
> I return a value x with myread.
> how can I use this value in an other method to use it in "run"?
> Thanks for your help
> Milan
>
>
>
>
> public int myread (String string) throws Exception {
>
> StringTokenizer st = new StringTokenizer (string, "\t");
>
> int count = st.countTokens ();
>
> int xyz[];
>
>
> int x;
>
> count = (count> 3) ? 3 : count;
>
> for (int l = 0; l < count; l++) {
>
> String token = st.nextToken ().trim ();
>
> xyz [l] = (new Integer (token)).intValue ();
>
> x = xyz [0];
>
> }
>
> return x;
>
> }
>
> public void run (ImageProcessor ip) {
> int i = myread ();
>
> tab = col.getNeighborhoodSphere (i, 2, 3, rad, rad, rad);
> }
> _________________________________________________________________
> Découvrez toutes les possibilités de communication avec vos proches
> http://download.live.com
>

--
   /**********************************************************/
      Thomas Boudier, MCU Université Pierre et Marie Curie,
      IFR 83. Bat B 7ème étage, porte 709, Jussieu.
      Tel : 01 44 27 20 11  Fax : 01 44 27 22 91
/*******************************************************/