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

Home » Public Forums » archive » Re: divise image envi-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: divise image envi-idl [message #70970 is a reply to message #70969] Tue, 18 May 2010 09:15 Go to previous message
jeanh is currently offline  jeanh
Messages: 79
Registered: November 2009
Member
Hi tonino_nestor

> I try to write a batch to divise my image but apparently, the values
> of the loop are wrong... could someone explain me what is wrong ?

what error do you get?

> envi_open_file, image, r_fid=fidimage, /NO_REALIZE
>
> if (fidimage eq -1) then begin
> print, 'error nestor'
> endif

at times, the r_fid can be an array... it works better to test if
(fidimage[0] eq -1)


> result = dblarr(NSimage/5, NLimage/2, NBimage)

result is of type double

> for i = 0, (NSimage-NSimage/5), NSimage/5 do begin
> for j = 0, (NLimage-NLimage/2), NLimage/2 do begin
>
> result = image[i:i+((NSimage/5)-1),j:j+((NLimage/2)-1),
> 0:NBimage-1]

result is of the type of image (float? double? int?)

> envi_write_envi_file, result, data_type=4
> outname = STRCOMPRESS('C:\Documents and Settings\Administrateur
> \Mesdocume\'+string(i/(NSimage/5))+string(j/(NLimage/2)),/RE MOVE_ALL)
> openw, lun, outname, /Get_lun
> close, lun
> free_lun, lun

here is your problem...
1) the output is of type float. So, if image is a double, your problem
is here!, change the data_type.
2) you need to specify more argument than that to envi_write_envi_file,
including the outname (if you don't want to have the output only in
memory), ns, nl, nb... see the help file.
3) you open and close the file... this is useless.
4) don't use STRCOMPRESS this way. The output would be, for the
begining: C:\DocumentsandSettings\ which is, I believe, not the
directory you are looking for. Instead, use strtrim ==>
+string(i/(NSimage/5)) becomes +strtrim(i/(NSimage/5),2)

Jean



> endfor
> endfor
>
> end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: x-y offsets
Next Topic: Why do I get the string in ytitle in vertical direction

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

Current Time: Fri Oct 10 23:51:45 PDT 2025

Total time taken to generate the page: 0.14546 seconds