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

Home » Public Forums » archive » Code-correction please
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Code-correction please [message #37071] Tue, 25 November 2003 04:03
toreto is currently offline  toreto
Messages: 4
Registered: November 2003
Junior Member
I have written a code to transform an image in quantile classification
image. In this code I have classified the values LE 0 = 0 and the
other data in a quantile of 4 classes. The code run with little image
but when the image is greater the computer can't run!!

Any solution???

Thanks in advance

Nacho

pro clasquantLE0_image
;-----------------------------------------------------
;sans le zero ou negatives
;************************
; preparation de l'image

; First restore all the 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='c:\temp\batch.txt'
;****************************
; open image
;****************************


im1 ='c:\nacho\imageExemple


envi_open_file, im1, r_fid=ref_fid
if (ref_fid eq -1) then begin
envi_batch_exit
return
endif

; information of the band
;
envi_file_query,ref_fid,ns=ns, nl=nl,nb=nb, bname = ref_bname
ref_dims = [-1,0,ns-1,0,nl-1]
pos = lindgen (nb)
band= envi_get_data(fid=ref_fid, dims=ref_dims, pos=0)
data= make_array (ns, nl, value=0)
data= float (band*1)
;print, data

;********************
n=n_elements (data)
no = n_elements (data(where(data LE 0)))
m = n_elements (data(where(data GT 0)))
; n_elements de data with 0
nno= n-no
print, no
Print, 'valeur de N'
print, n
; indices des data's value
ix = sort (data)


; classification quantile
indm= make_array (n+1,value=4)
for h= 0,no-1 do begin
for i= no-1, ((no-1)+(0.25*nno)) do begin
for j =((no-1)+(0.25*nno)), ((no-1)+(0.50*nno)) do begin
for k = ((no-1)+(0.50*nno)),((no-1)+(0.75*nno)) do begin
for l= ((no-1)+(0.75*nno)), (n) do begin
indm(h)=0
indm(i)=1
indm(j)=2
indm(k)=3
indm(l)=4
endfor
endfor
endfor
endfor
endfor

;print ,'impression de nacho'
;print, indm

arclq =indm(sort(ix))
;print, 'resultat de la classifquantile'

;******************
; creation de la matrix

clq= reform (arclq, ns,nl)



;***********

;resclq = make_array (ns, nl, value= clq)

;print, clq
;******************************
; preparation de l'image output
;
envi_enter_data, clq, r_fid=clq_fid
nb=1
pos= lindgen(nb)
clqfid=lonarr (nb)
dims=lonarr (5,nb)

pos[0]=0
;dims[0,0] = [-1,0,ns-1,0,nl-1]
clqfid[0]=clq_fid

outnameclq ='c:\nacho\clasquantres1

envi_doit, 'cf_doit', $
fid=clqfid ,pos=pos,dims=ref_dims, out_name=outnameclq,
r_fid=resCLQ_fid, out_dt=1


end
[Message index]
 
Read Message
Previous Topic: Code-correction please
Next Topic: iTool Redeux

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

Current Time: Sat Oct 11 13:54:05 PDT 2025

Total time taken to generate the page: 1.51873 seconds