comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: reading pixels from images from automated XYpositions

Re: reading pixels from images from automated XYpositions
type: item
description: I think you'd better explain in detail the definition of your pos. I can't understand it from your code. But I think I may have a similiar question of how to extract features from an image. For example, let's define a 7X7 pixels area a molecule. And I have all N molecules' positions stored in a 2XN array pos. Thus, molecule No. i will be, Image[pos[0,i]-3:pos[0,i]+3,pos[1,i]-3:pos[1,i]+3] which is a 7X7 data. But if if I want to extract all the molecules at the same time without using a loop. Then I got, molecules=Image[pos[0,*]-3:pos[0,*]+3,pos[1,*]-3:pos[1,*]+3] % Expression must be a scalar or 1 element array in this context: <INT Array[1, N]>. Can anybody show me how to do this properly? Thanks! Yunxiang On Wed, 14 Apr 2004, Thomas Nehls wrote: > Hi folks, > > I want to get information(mean, stddev, median) about the values of > certain pixels(7x7 pixels areas) from an image. > The according XY positions should be read from a file, where a list of > positions is given. > > This is, what I thought could work: > >> PRO input,x >> >> FOR n=0,x-1 do grey_scale_value,n >> END >> >> PRO grey_scale_value, n,x >> file = DIALOG_PICKFILE(/READ) >> img = READ_TIFF(file) >> positions = DIALOG_PICKFILE(/READ) >> pos =bytarr(3,6) >> pos = READ_SYLK(positions,/ARRAY) >> pixels1 = img[0,23:26,35:38] >> pixels2 = img[0,(pos[1]-3 where pos[0]=n):(pos[1]+3 where pos[0]=n),(pos[2]-3 where pos[0]=n):(pos[2]+3 where pos[0]=n)] >> >> OPENW,1,'greyscale_data.dat',/APPEND >> PRINTF,1, (n+1),mean(pixels2),stddev(pixels2),median(pixels2) >> CLOSE,1 >> END > > first I tried pixels1, the scheme works, but I think I used the 'where' > command in the wrong way... > Do you have a hint for me? > Thanks > Tom > >
creator: Yunxiang Zhang
date: 2004-04-14T23:02:13-00:00

Re: reading pixels from images from automated XYpositions
type: item
description: Hi Yunxiang, thank you for showing me where my problem was! now I got a new one ;-) I have an 3 x 6 array. I looked through the IDL-help and then I found all the keywords for the read_tiff function and now I think that is one key to our problem: what do you think about that: > PRO gs > > image = DIALOG_PICKFILE(,/read) ;gets the image filename > position = DIALOG_PICKFILE(,/read) ;gets the according position filename > > pos = READ_SYLK(position, /ARRAY, /COLMAJOR, NROWS=n) > > output = DIALOG_PICKFILE(,/WRITE) > OPENW,1,output,/APPEND > PRINTF,1,image > CLOSE,1 > > FOR i=0,n-1 DO BEGIN > > img = READ_TIFF(image, R, G, B , ORIENTATION=1, SUB_RECT=[pos[1,i]-3,pos[2,i], 7, 7]) > > OPENW,1,'greyscale_data.dat',/APPEND > PRINTF,1, i+1, mean(R), stddev(R), median(R) > CLOSE,1 > ENDFOR > > END I thought, this would be a good idea, but unfortunately: > % READ_TIFF: Expression must be named variable in this context: > <INT ( 1)>. what does it mean? which expression? Can anybody help us/me? Thanks in advance Tom
creator: Thomas Nehls
date: 2004-04-15T16:23:06-00:00

Re: reading pixels from images from automated XYpositions
type: item
description: "Thomas Nehls" wrote in message... >> img = READ_TIFF(image, R, G, B , ORIENTATION=1, SUB_RECT=[pos[1,i]-3,pos[2,i], 7, 7]) >> >> OPENW,1,'greyscale_data.dat',/APPEND >> PRINTF,1, i+1, mean(R), stddev(R), median(R) >> CLOSE,1 >> ENDFOR >> >> END > > I thought, this would be a good idea, but unfortunately: >> % READ_TIFF: Expression must be named variable in this context: >> <INT ( 1)>. > > what does it mean? which expression? Even if you don't understand the error, check the clues. READ_TIFF is complaining about something to do with an integer value "1". Looking at your READ_TIFF call I see two places you are trying to pass "1". A check of the docs would reveal that ORIENTATION is supposed to be set "to a named variable which will contain the orientation value from the TIFF file." So READ_TIFF wants to *return* a value via the ORIENTATION keyword but it can't because "1" is not a valid variable. Changing "ORIENTATION=1" to "ORIENTATION=o" should fix this problem. -Rick
creator: Rick Towler
date: 2004-04-15T16:50:59-00:00

Re: reading pixels from images from automated XYpositions
type: item
description: Rick Towler wrote: > "Thomas Nehls" wrote in message... > > >>> img = READ_TIFF(image, R, G, B , ORIENTATION=1, > > SUB_RECT=[pos[1,i]-3,pos[2,i], 7, 7]) > >>> OPENW,1,'greyscale_data.dat',/APPEND >>> PRINTF,1, i+1, mean(R), stddev(R), median(R) >>> CLOSE,1 >>> ENDFOR >>> >>> END >> >> I thought, this would be a good idea, but unfortunately: >> >>> % READ_TIFF: Expression must be named variable in this context: >>> <INT ( 1)>. >> >> what does it mean? which expression? > > > Even if you don't understand the error, check the clues. READ_TIFF is > complaining about something to do with an integer value "1". Looking at > your READ_TIFF call I see two places you are trying to pass "1". A check of > the docs would reveal that ORIENTATION is supposed to be set "to a named > variable which will contain the orientation value from the TIFF file." So > READ_TIFF wants to *return* a value via the ORIENTATION keyword but it can't > because "1" is not a valid variable. Changing "ORIENTATION=1" to > "ORIENTATION=o" should fix this problem. > > -Rick > > Hi, you are completely right, sorry. some hours before I used the ORIENTATION keyword in connection with WRITE_TIFF, so my mistake was to think(to wish) ORIENTATION would have the same function in READ_TIFF. Is there any possibility to tell IDL that the XY coordinates I used to define the SUBRECT Portion are coordinates starting from the left hand top? (Thats what I wanted to tell IDL by using ORIENTATION = 1) I dont want to recalculate the coordinates... Thanks Tom
creator: Thomas Nehls
date: 2004-04-16T11:58:10-00:00