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

Home » Public Forums » archive » Apply a shapefile to raster images in IDL
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: Apply a shapefile to raster images in IDL [message #41325 is a reply to message #41289] Fri, 08 October 2004 11:54 Go to previous messageGo to previous message
envi35 is currently offline  envi35
Messages: 8
Registered: October 2004
Junior Member
Hi Everyone,
Thank you all very much. I've taken Chris+Lorenzo's suggestions, and
it works really well. Though just started to learn IDL a couple of
weeks ago, I found it is a golden mine, worthy to dig hard. :-(
With Fortran background, it seems not too hard for me to jump to IDL
direct graphics. Since the IDL object is more powerful, I think it is
time for me to learn object programming (really scared!). I'm
wondering if someone could give me some advices on how to start with
the object...

Best regards,
Jenny

lbusett@yahoo.it (Lorenzo Busetto) wrote in message news:<e4da268.0410070408.60d07040@posting.google.com>...
> Hi Jenny,
>
> If your images are all of the same size I think that you can solve
> your problem simply by using ENVI.
>
> 1: Open one of your images and load it in a display
> 2: Convert your shapefile to an ENVI vector file (EVF) by clicking
>> Vector > Open Vector File > Shapefile
> 3: Load your vector on the display where you have loaded your
> image (In the "available vectors list" select the vector, then click
> on "load" and then on "Diplay# (your_display)"
> 4:In the "Vector Parameters" window that appears, select "File >
> Export active layer to ROI"
> 5: Select "basic tools > masking > build mask" and select your
> display
> 6: Select "Options > Import ROIS", then select the ROI you created
> from your vector and click on "OK". Next, choose a name for the mask
> file that you want to create and click on "Apply". Now, in the
> "available bands list you should see a new image, which has value 0
> outside the vector and 1 inside it.
> 7: Now, you can use this "0-1" image as a mask for your image. Go
> to Basic tools > apply mask. Select one of the images that you want to
> mask, then click on "Select mask band" and select the mask image.
> Click on "OK".
>
> If you have many images and you don't want to repeat n-times the
> last step you can use an IDL procedure that automatically opens the
> images and apply the mask on each one.
> I think that something like this should work: it's a simple
> modification of the example program that you can find on the ENVI
> User's guide.
>
> pro multiple_mask
>
> ; Select input files (Select all your images)
>
> files_list = dialog_pickfile(/READ,title ='Select input$
> files',/multiple_files)
>
> ; Select the mask File
>
> mask_file = dialog_pickfile(/read, title = 'Select Mask File')
> envi_open_file, mask_file, r_fid=m_fid
>
> ; Count the number of files
>
> num_files = N_elements (files_list)
>
> for count = 0, num_files-1 do begin
>
> ; Selects the n- file. Output file name is
> "input_file_name"+"-masked"
>
> in_file = files_list [count]
> out_file =files_list [count]+'-masked'
> envi_open_file, in_file, r_fid=fid
> if (fid eq -1 or m_fid eq -1) then return
>
>
> ; get some useful information and set the output filename.
> envi_file_query, fid, ns=ns, nl=nl, nb=nb, bname=bname
>
> ; Set the keyword parameters
> dims = [-1l, 0, ns-1, 0, nl-1]
> pos = lindgen(nb)
> m_pos = [0]
>
> ; Call the 'doit' to apply the mask
>
> envi_mask_apply_doit, fid=fid, pos=pos, dims=dims,m_fid=m_fid,$
> m_pos=m_pos, value=0, out_name=out_file, in_memory=0, $
> r_fid=r_fid
>
> endfor
>
> end
>
> I hadn't fully tested it, but it should work.
>
> Hope this helps,
>
> Lorenzo
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: create oval shape
Next Topic: python, strange result

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

Current Time: Sat Oct 11 01:25:20 PDT 2025

Total time taken to generate the page: 1.04023 seconds