Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Idl-pvware > Re: problem wit...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 13 of 18 Topic 5562 of 6457
Post > Topic >>

Re: problem with subset one image by another

by negra <chemsat@[EMAIL PROTECTED] > Mar 28, 2008 at 06:54 PM

On 28 =D0=BC=D0=B0=D1=80, 22:22, Jean H
<jghas...@[EMAIL PROTECTED]
> wrote:
> negra wrote:
> > On 27 =C3=8D=C3=81=C3=92, 21:56, Jean H
<jghas...@[EMAIL PROTECTED]
> wrote:
> >> negra wrote:
> >>>> Without more details about what you want to do it is difficult,
> >>>> bordering upon impossible, for us to give you any useful advice
about=

> >>>> how to do it.
> >>> here is idl routine what I written. The beginning of it, is working.
> >>> pro spat_subset
> >>> cd, 'C:\Scandata\L1a'
> >>> HKMfiles =3D FILE_SEARCH('MOD02HKM.*.img',count=3Dnumfiles)
> >>> PRINT, '# NDSI files:',N_ELEMENTS(FILE_SEARCH('MOD02HKM.*.img'))
> >>> print, FILE_SEARCH(HKMfiles)
> >>> for j=3D0,numfiles-1 DO BEGIN
> >>> HKM_name =3D HKMfiles[j]
> >>> print,HKM_name
> >>> ;first restore all base save files
> >>> ;
> >>> envi, /restore_base_save_files
> >>> ;
> >>> ;Initialize ENVI and send all errors and warnings to the file
> >>> batch.txt
> >>> ;
> >>> envi_batch_init, log_file=3D'batch.txt'
> >>> ;
> >>> ;Open the input files
> >>> ;kz_hkm mask file
> >>> envi_open_file, 'C:\Scandata\L1A\mask\kz_hkm', r_fid=3Dfile1_fid
> >>> if (file1_fid eq -1) then begin
> >>> =C2=A0 =C2=A0 =C2=A0envi_batch_exit
> >>> =C2=A0 =C2=A0 =C2=A0return
> >>> endif
> >>> envi_open_file,'C:\Scandata\L1A\'+ HKMfiles[j], r_fid=3Dfile_fid
> >>> if (file_fid eq -1) then begin
> >>> =C2=A0 =C2=A0 =C2=A0envi_batch_exit
> >>> =C2=A0 =C2=A0 =C2=A0return
> >>> endif
> >>> envi_file_query, file1_fid, dims=3Dfile1_dims, ns=3Dfile1_ns,
nl=3Dfil=
e1_nl,
> >>> nb=3Dfile1_nb
> >>> file1_dims =3D [-1L,0,file1_ns-1,0,file1_nl-1]
> >>> file1_mapinfo =3D envi_get_map_info(fid=3Dfile1_fid)
> >>> print, file1_mapinfo
> >>> file1_xf =3D [0,file1_ns-1]
> >>> file1_yf =3D [0,file1_nl-1]
> >>> envi_convert_file_coordinates, file1_fid, file1_xf, file1_yf,
> >>> file1_xmap, file1_ymap, /to_map
> >>> print, 'UL corner:',file1_xmap[0],file1_ymap[0]
> >>> print, 'LR corner:',file1_xmap[1],file1_ymap[1]
> >>> ;Longitude 44.39011111 - 88.38219444
> >>> ;Latitude 36.20264722 - 56.35832500
> >>> ;subset #1
> >>> envi_file_query, file_fid, dims=3Dfile_dims, ns=3Dfile_ns,
nl=3Dfile_n=
l,
> >>> nb=3Dfile_nb
> >>> file_dims =3D [-1L,0,file_ns-1,0,file_nl-1]
> >>> file_mapinfo =3D envi_get_map_info(fid=3Dfile_fid)
> >>> print, file_mapinfo
> >>> pos =C2=A0=3D lindgen(file_nb)
> >>> out_namea =3D HKMfiles[j]+'subset.img'
> >>> file_mapinfo =3D envi_get_map_info(fid=3Dfile_fid)
> >>> _xfactor =3D file1_mapinfo.ps[0]/file_mapinfo.ps[0]
> >>> _yfactor =3D file1_mapinfo.ps[1]/file_mapinfo.ps[1]
> >>> print, [_xfactor, _yfactor]
> >>> file_xf =3D [0,file_ns-1]
> >>> file_yf =3D [0,file_nl-1]
> >>> envi_convert_file_coordinates, file_fid, file_xf, file_yf,
file_xmap,
> >>> file_ymap, /to_map
> >> you have to do the opposite: take the projected coordinates of the
mask=

> >> image, and convert it to the Cartesian coordinate of the image to
subse=
t.
>
> >> then, don't do the "resize", as you are just changing the pixel size
an=
d
> >> not the covered area. =C2=A0do subset =3D
> >> image[maskXmin:maskXmax,maskYmin:maskYmax]
>
> >> Jean
>
> >>> print, 'UL corner:',file_xmap[0],file_ymap[0]
> >>> print, 'LR corner:',file_xmap[1],file_ymap[1]
> >>> ;Longitude 63.29925556 - 106.42788056
> >>> ;Latitude 42.01251944 - 64.14574167
> >>> ; I have coordinates of image corners
>
> > It's write that something wrong but I don't know how will be right.
> > Where is mistake?
>
> > pos =C2=A0=3D lindgen(file_nb)
> > input =3D ENVI_GET_DATA(fid=3Dfile_fid, dims=3Dfile_dims, POS=3Dpos)
> > ;
> > subset =3D input[file1_xf[0]:file1_xf[1], file1_yf[0]:file1_yf[1]]
>
> This will not work, as file1_xf contains the Cartesian coordinate of the
> mask.
> first, do
>
> envi_convert_file_coordinates, subset_fid, subset_xf, subset_yf,
> Mask_xmap, Mask_ymap
>
> so with the above, you have, with respect to the subset image, the
> Cartesian coordinates of the Mask corners.
>
> Then do
> subset =3D input[subset_xf[0]:subset_xf[1],subset_yf[0]:subset_yf[1]]
>
> > out_names =3D 'subset.img'
> > ENVI_WRITE_ENVI_FILE, subset, DATA_TYPE=3D4 =C2=A0,
OUT_NAME=3Dout_names=
,
> > R_FID=3Ds_fid
>
> ENVI_WRITE_ENVI_FILE requires the other following keywords:
> NB=3Dinteger | NL=3Dinteger | NS=3Dinteger
> OFFSET=3Dvalue
>
> Jean- =D0=A1=D0=BA=D1=80=D1=8B=D1=82=D1=8C
=D1=86=D0=B8=D1=82=D0=B8=D1=80=
=D1=83=D0=B5=D0=BC=D1=8B=D0=B9 =D1=82=D0=B5=D0=BA=D1=81=D1=82 -
>
> - =D0=9F=D0=BE=D0=BA=D0=B0=D0=B7=D0=B0=D1=82=D1=8C
=D1=86=D0=B8=D1=82=D0=
=B8=D1=80=D1=83=D0=B5=D0=BC=D1=8B=D0=B9 =D1=82=D0=B5=D0=BA=D1=81=D1=82 -

I tried to do as you suggested, but it was unsuccessful.
May be it must look like this?
min_x =3D max(file1_xmap[0], file_xmap[0]); Attempt to store into an
expression: <DOUBLE   (       63.295452)>.

max_x =3D min(file1_xmap[1], file_xmap[1])
min_y =3D max(file1_ymap[0], file_ymap[0])
max_y =3D min(file1_ymap[1], file_ymap[1])
subset =3D input[min_x:max_x, min_y:max_y]
But it give me mistake on the first line.
Do you know where is mistake?

Gulshat
 




 18 Posts in Topic:
problem with subset one image by another
chemsat@[EMAIL PROTECTED]  2008-03-22 02:49:18 
Re: problem with subset one image by another
David Fanning <news@[E  2008-03-22 10:12:46 
Re: problem with subset one image by another
negra <chemsat@[EMAIL   2008-03-26 09:47:21 
Re: problem with subset one image by another
James Kuyper <jameskuy  2008-03-26 19:52:59 
Re: problem with subset one image by another
negra <chemsat@[EMAIL   2008-03-26 19:10:09 
Re: problem with subset one image by another
James Kuyper <jameskuy  2008-03-27 11:40:28 
Re: problem with subset one image by another
negra <chemsat@[EMAIL   2008-03-27 05:47:07 
Re: problem with subset one image by another
James Kuyper <jameskuy  2008-03-27 13:54:49 
Re: problem with subset one image by another
negra <chemsat@[EMAIL   2008-03-27 08:40:16 
Re: problem with subset one image by another
Jean H <jghasban@[EMAI  2008-03-27 09:56:34 
Re: problem with subset one image by another
negra <chemsat@[EMAIL   2008-03-28 08:30:05 
Re: problem with subset one image by another
Jean H <jghasban@[EMAI  2008-03-28 10:22:13 
Re: problem with subset one image by another
negra <chemsat@[EMAIL   2008-03-28 18:54:37 
Re: problem with subset one image by another
Jean H <jghasban@[EMAI  2008-03-31 11:05:21 
Re: problem with subset one image by another
James Kuyper <jameskuy  2008-04-01 11:18:11 
Re: problem with subset one image by another
Bulrush <Wasit.Weather  2008-03-28 21:18:27 
Re: problem with subset one image by another
negra <chemsat@[EMAIL   2008-04-04 08:32:13 
Re: problem with subset one image by another
Bulrush <Wasit.Weather  2008-04-04 08:54:45 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 21:32:59 CST 2008.