Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Re: Programmatically subset one image using ENVI routines.
Perhaps you should post the error message it gives you, that would be helpful. Or, if it doesn't give you an error, but the results are not what you expect, explain how the results are different. Jeff txominhermos@gmail.com wrote: > Hi mates, I have a big image, so I just can use ENVI routines to avoid > the RAM memory saturation. I would like to subset an image with a given > pixel coordinates. > > I would like to output the image to TIFF, so I have tried to do it > directly: > > > > ENVI_OUTPUT_TO_EXTERNAL_FORMAT, dims = [-1, min_s, max_s-min_s+1, > min_l, max_l-min_l+1], /TIFF, FID=fid,$ > pos=pos, out_name='c:\cir.tif' > > > where min_s, max_s, min_l, max_l are the pixels which are limits to > perform the subset. > > I thought that I had to indicate the limits in DIMS, but it seems not > to work. > > Do you know how to do it? I don't mind use ENVI_WRITE_ENVI_FILE if it > is not possible with ENVI_OUTPUT_TO_EXTERNAL_FORMAT. > > > Thanks for your attention > > > > -txomin
Your are right Jeff. IDL just hangs up and nothing happends. if I try saving the whole image: ENVI_OUTPUT_TO_EXTERNAL_FORMAT, dims = [-1, 0, ns-1, 0,nl-1], /TIFF, FID=fid,$ pos=pos, out_name='c:\cir.tif' it works properly, and the ENVI's processing window appears. So I think that I the way that I wrote is not the correct. Has someone done a subset before? thanks again -txo Jeff N. ha escrito: > Perhaps you should post the error message it gives you, that would be > helpful. Or, if it doesn't give you an error, but the results are not > what you expect, explain how the results are different. > > Jeff > > > txominhermos@gmail.com wrote: >> Hi mates, I have a big image, so I just can use ENVI routines to avoid >> the RAM memory saturation. I would like to subset an image with a given >> pixel coordinates. >> >> I would like to output the image to TIFF, so I have tried to do it >> directly: >> >> >> >> ENVI_OUTPUT_TO_EXTERNAL_FORMAT, dims = [-1, min_s, max_s-min_s+1, >> min_l, max_l-min_l+1], /TIFF, FID=fid,$ >> pos=pos, out_name='c:\cir.tif' >> >> >> where min_s, max_s, min_l, max_l are the pixels which are limits to >> perform the subset. >> >> I thought that I had to indicate the limits in DIMS, but it seems not >> to work. >> >> Do you know how to do it? I don't mind use ENVI_WRITE_ENVI_FILE if it >> is not possible with ENVI_OUTPUT_TO_EXTERNAL_FORMAT. >> >> >> Thanks for your attention >> >> >> >> -txomin
My guess is that the DIMS keyword is not to allow you to subset the image as it's being written out, but rather for you to give the dimensions of the input image so that the routine will know this info without needing extra code to find it out. I'm curious about a few things though. You say your machine hangs up...are you letting it sit long enough to make sure it's *really* hung? Sometimes for intensive operations screen updating gets stopped, you can get "not responding" messages, etc. but it's still running, and eventually the system will catch up. The other thing is, you seem to have the data already read into memory since you said you could use ENVI_WRITE_ENVI_FILE, and i believe that routine requires you pass it a variable containing the image data. If so, how are you reading the data into memory? Seems to me that this step, reading in the data, is where to look for how to subset the image while avoiding memory problems. The last time you posted about this I suggested you subscript an array to subset your image (something like output = input_image[min_s:max_s, min_l:max_l] ), and I believe you've been saying that this operation is what's giving you the memory problem - and I believe you - array subscripting can take up a lot of memory. BUT, though I could easily be wrong, it seems to me like ENVI is going to end up doing something like this anyway, so my suspicion is that by trying to use ENVI you're not really avoiding the memory problem like you think. You could certainly set up a tiling routine in ENVI that would definitely fix your memory trouble, but you can do this with pure IDL too. Have you looked at the ASSOC function in IDL? If you'd like, email me the code you're using so far and the image dimensions and I'll see what I can find. Jeff txominhermos@gmail.com wrote: > Your are right Jeff. IDL just hangs up and nothing happends. > > if I try saving the whole image: > > ENVI_OUTPUT_TO_EXTERNAL_FORMAT, dims = [-1, 0, ns-1, 0,nl-1], /TIFF, > FID=fid,$ > pos=pos, out_name='c:\cir.tif' > > it works properly, and the ENVI's processing window appears. So I think > that I the way that I wrote is not the correct. Has someone done a > subset before? > > > thanks again > > > -txo > > Jeff N. ha escrito: > >> Perhaps you should post the error message it gives you, that would be >> helpful. Or, if it doesn't give you an error, but the results are not >> what you expect, explain how the results are different. >> >> Jeff >> >> >> txominhermos@gmail.com wrote: >>> Hi mates, I have a big image, so I just can use ENVI routines to avoid >>> the RAM memory saturation. I would like to subset an image with a given >>> pixel coordinates. >>> >>> I would like to output the image to TIFF, so I have tried to do it >>> directly: >>> >>> >>> >>> ENVI_OUTPUT_TO_EXTERNAL_FORMAT, dims = [-1, min_s, max_s-min_s+1, >>> min_l, max_l-min_l+1], /TIFF, FID=fid,$ >>> pos=pos, out_name='c:\cir.tif' >>> >>> >>> where min_s, max_s, min_l, max_l are the pixels which are limits to >>> perform the subset. >>> >>> I thought that I had to indicate the limits in DIMS, but it seems not >>> to work. >>> >>> Do you know how to do it? I don't mind use ENVI_WRITE_ENVI_FILE if it >>> is not possible with ENVI_OUTPUT_TO_EXTERNAL_FORMAT. >>> >>> >>> Thanks for your attention >>> >>> >>> >>> -txomin