Re: Antwort: Re: Antwort: PIXEL VALUE
Posted by smfmazz on Sep 10, 2010; 7:03pm
URL: http://imagej.273.s1.nabble.com/PIXEL-VALUE-tp3686973p3686978.html
Hello everyone. Excuse me for my bad english. I take this topic for explain my problem: i want read the data pixel value into a software java (i don't want create a new plugin for image j). This is the code:
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int a[];
a=new int[4];
ImagePlus i = new ImagePlus("test.dcm");
//Image img = i.getImage();
for (int ii=0; ii<=512; ii++){
for (int jj=0; jj<=512; jj++){
a=(int[])i.getPixel(ii,jj);
System.out.println(a[0]);
System.out.println(ii);
System.out.println(jj);
}
}
}
The program run correctly and print the value in grayscale 16 bit. Example in the imageJ toolbar with the coordinates x=103.8 mm y=128.9 mm value=361 (33129). The program java print the correct value 33129 corresponding this coordinates. My question is: why this value 33129 doesn't corresponding to negative value? I think the positive numbers should go from 0 to 32767 and the negative from 32768 to forward. Is correct? The code is wrong? Thanks for help me.
corresponding to value