comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: subset an image by coordinates
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: subset an image by coordinates [message #68082 is a reply to message #68077] Sun, 20 September 2009 10:00 Go to previous messageGo to previous message
Alvaro Paredes L. is currently offline  Alvaro Paredes L.
Messages: 5
Registered: September 2009
Junior Member
On 20 sep, 10:24, Robert <robert.m...@gmail.com> wrote:
> On Sep 20, 8:12 am, Jeremy Bailin <astroco...@gmail.com> wrote:
>
>
>
>
>
>> On Sep 19, 11:14 pm, "Alvaro Paredes L." <alvaropared...@gmail.com>
>> wrote:
>
>>> Hi all
>
>>> I was searching on the web, but i didn't find an answer to my problem.
>>> I need to make asubseton animageusing
>
>>> coordinates, but i can't find a way to do it. I see this method
>
>>> http://groups.google.es/group/comp.lang.idl-pvwave/browse_fr m/thread/...
>>> and this other (very
>
>>> similar) http://www.mombu.com/programming/idl/t-subset-an-image-by-ro i-in-idl-...,
>>> but don't use
>
>>> coordinates, use an evf file.
>
>>> IDL/ENVI has a widget that use only two coordinates to cut (upper-left
>>> and lower-right coordinate), but it isn't
>
>>> fully automatically.
>
>>> Is there any function to cut theimagewith set coordinates and save
>>> it in a new file?
>
>>> I really hope you can help me... I'm not a programmer and this
>>> sometimes it's very hard
>
>>> Thanks!
>
>>> Alvaro
>
>> Do you mean like:
>
>> newimage = oldimage[x0:x1,y0:y1]
>
>> ?
>
>> -Jeremy.
>
> If the original author is looking tosubsetby map coordinates, he
> needs to use the procedure
>
> ENVI_CONVERT_FILE_COORDINATES, FID, XF, YF, XMap, YMap
>
> to convert the corners of hisimagein map coordinates to file
> coordinates. Once he has the proper file coordinates, he cansubset
> theimage. If you give us a little more specifics of what you are
> trying to do, we can probably provide more information.
>
> r

Thanks for the quickly help. I have an image with degrees coordinates
and with the function that Robert suggested
(ENVI_CONVERT_FILE_COORDINATES) i can transform coord to pixel value
without problems (as the script i show below). But i try to do that
Jeremy suggest, but i don't know if is it properly working
(image=img_file[XF,YF]??)


forward_function ENVI_CONVERT_FILE_COORDINATES
pro SUBSET
envi, /restore_base_save_files
envi_batch_init,log_file='batch.txt'

; define the image to be opened
img_file='F:\IMAGE\NDVI-HDF\try\NDVI_2008_03_02.img'
envi_open_file,img_file,r_fid=fid
print, 'fid=',fid

; define coordinates to make the subset
YMap=[-32.6030694, -32.9797194]
XMap=[-71.0580916, -70.5006694]

ENVI_CONVERT_FILE_COORDINATES, FID, XF, YF, XMap, YMap

;rounds the pixel value to its closest integer.
XF=ROUND(XF)
YF=ROUND(YF)

;verify the conversion
print, 'X pixel ',XF
print, 'Y pixel ',YF

;making the subset??????
image=img_file[XF,YF]

; Exit Envi
envi_batch_exit
end

Finally, and maybe this is a basic question, how i save this "subset"
in a .img file?

Thanks!

Alvaro
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Structure
Next Topic: structure

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 04:48:42 PDT 2025

Total time taken to generate the page: 2.56069 seconds