newbie question FILL_BLACK,FILL_WHITE 16bit

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

newbie question FILL_BLACK,FILL_WHITE 16bit

kostas-2
Hello,
i try to draw an image from some raw image data (16bit) that I have. I do the simple thing

img = NewImage.createShortImage("Sample Image",64,64,1,NewImage.FILL_BLACK)
proc = img.getProcessor()

for i in range(64): #// for (i=0;i<64;i++)
    for j in range(64):
           value = nf.sample(i,j,11,0,0)
           print "i: " + str(i)+ "\tj: " + str(j)+ "\tval: "+ str(value)
           proc.putPixelValue(i,j,value)

img.show()

(this is jython syntax but it is fairly straightfoward)
nf is a nifti(fmri) file that can be sampled in the 2-axis dimension i,j (the third is the z-axis, and so on)
nf.sample just samples the pixel

So, if my data's byteorder is big-endian and if i create the image with flag FILL_WHITE then the image appears in the imagewindow, although the colours are not the correct ones (grey instead of white,etc). I think this has something to do with the byteorder and propably is fixable. But if I create it it with the flag FILL_BLACK then I only get a black image. With img.getPIxel(i,j) I get the correct values for the pixels, that I have set, only that they don't appear.

At last if the byteorder of the raw data is little endian then in either case it appears either only white or only black with no other colour pixels.

PLease help me understand what is going on

Kostas