;############################################################################# ;# # ;# OFFICIAL DISCLAIMER # ;# ================================================================ # ;# this file contains explicit source code, everyone who finds # ;# frontal open source code to be offensive or objectionable, or # ;# is not old enough or otherwise legally not entitled to view such # ;# stuff should delete this file imediately # ;# # ;############################################################################# ;+ ; NAME: ; DECOMP ; ; PURPOSE: ; ; This Routine computes the decomposition of a polarimetric SAR ; data set in the 3 standard decompositions (lexical/Borgeaud, ; Pauli, and Sphere Diplane Helix, the output is a RGB image of ; the 3 components ; ; AUTHOR: ; ; Martin Hellmann paddy@gmx.co.uk ; ; CATEGORY: ; ; Data Analysis Routines, SAR data ; ; CALLING SEQUENCE: ; ; DECOMP ; ; INPUTS: ; ; 3 polarimetric channels HH, HV, VH, VV ; ; KEYWORD PARAMETERS: ; ; None. ; ; OUTPUTS: ; RGB - image of the decomposition ; ; COMMON BLOCKS: ; None. ; ; SIDE EFFECTS: ; ; zu Risiken und Nebenwirkunegn lesen sie die Packungsbeilage ; und fragen sie Ihren Arzt oder Apotheker ; ; RESTRICTIONS: ; ; The scaling for the channels is rather crude, using a scaling from ; 0 to twice the mean value of the master image. For better contrast ; you may wish to change this scaling. The program uses the LOAD_SLC ; routine which is available from http://epsilon.nought.de ; ; PROCEDURE: ; ; 1. compile the programme - ; ; 2. run the programm or call it from within your programm ; ; IDL> DECOMP ; ; ; 3. select the desired decomposition ; ; 4. the output, i.e. the decomposition result should now ; be available as decomp.tif and can be displayed and ; converted to other formats for furher applications with ; a standard graphic software (e.g. gimp, photoshop etc.) ; ; EXAMPLE: ; ; Decomp ; ; ; ; MODIFICATION HISTORY: ; ; Written by: Martin Hellmann, 15 May 2001. ; GUIs included 6 June 2001 ;- ;########################################################################### ; ; LICENSE ; ; This software is provided "as-is", without any express or ; implied warranty. In no event will the authors be held liable ; for any damages arising from the use of this software. ; ; Permission is granted to anyone to use this software for any ; purpose, including commercial applications, and to alter it and ; redistribute it freely, subject to the following restrictions: ; ; 1. The origin of this software must not be misrepresented; you must ; not claim you wrote the original software. If you use this software ; in a product, an acknowledgment in the product documentation ; would be appreciated, but is not required. ; ; 2. Altered source versions must be plainly marked as such, and must ; not be misrepresented as being the original software. ; ; 3. This notice may not be removed or altered from any source distribution. ; ; For more information on Open Source Software, visit the Open Source ; web site: http://www.opensource.org. ; ;------------------------------------------------------------------ ; This software has been released under the terms of the GNU Public ; license. See http://www.gnu.org/copyleft/gpl.html for details. ;------------------------------------------------------------------ ;############################################################################# ;# # ;# DECOMP # ;# # ;############################################################################# ;############################################################################# ;# # ;# This Routine computes the decomposition of a polarimetric SAR # ;# data set in the 3 standard decompositions (lexical/Borgeaud, # ;# Pauli, and Sphere Diplane Helix, the output is a RGB image of # ;# the 3 components. The program uses the LOAD_POL routine which # ;# is attached below and also available from epsilon.nought.de # ;# # ;# # ;# CALLING SEQUENCE: decomp # ;# # ;############################################################################# ;# # ;# This software has been released under the terms of the GNU Public # ;# license. See http://www.gnu.org/copyleft/gpl.html for details. # ;# # ;############################################################################# ;# Version 1.0 / 06.06.2001 Last Modification: 06.09.2001 # ;# # ;# M.Hellmann # ;############################################################################# ;============================================================================= ;=== LOAD_POL routine for reading fully polarimetric data sets ==== ;============================================================================= ; ;+ ; ; NAME: ; ; LOAD_POL ; ; ; ; PURPOSE: ; ; ; ; This Routine loads 4 Single Look Complex channels ; ; of a fully polarimetric SAR data set (SLC) ; ; 4 different data formats are supported: ; ; - Andreas 'Anderl' Reigber's: rarr.pro/sarr.pro ; ; - Rolf Schreiber's format: 2 LONG values as header ; ; - Gunther Jaeger's READ_ARRAY.pro/SAVE_ARRAY.pro format ; ; - raw 32 bit complex data without header ; ; ; ; AUTHOR: ; ; ; ; Martin Hellmann paddy@gmx.co.uk ; ; ; ; CATEGORY: ; ; ; ; I/O Routines, polarimetric SAR data ; ; ; ; CALLING SEQUENCE: ; ; ; ; LOAD_POL,slc_hh,slc_hv,slc_vh,slc_vv ; ; ; ; INPUTS: ; ; ; ; 4 channels of a fully polarimetric SAR data set ; ; ; ; KEYWORD PARAMETERS: ; ; ; ; None. ; ; ; ; OUTPUTS: ; ; None. ; ; ; ; COMMON BLOCKS: ; ; None. ; ; ; ; SIDE EFFECTS: ; ; ; ; zu Risiken und Nebenwirkunegn lesen sie die Packungsbeilage ; ; und fragen sie Ihren Arzt oder Apotheker ; ; ; ; RESTRICTIONS: ; ; ; ; reads currently data sets up to 32000 by 32000 pixel ; ; if you want/need more - and have this much memory;) - you have ; ; to change MaxTestBlock in pro TestBoxCD. ; ; the EMISAR data (as well as other data types not mentioned here) ; ; are not supported. If you want to read them transform them in ; ; complex arrays (E.g. for EMISAR data use the util.c/UTIL.EXE ; ; routine delivered with the data) or write your own progs ;) ; ; ; ; PROCEDURE: ; ; ; ; 1. compile the programme - the output should look like this ; ; ; ; IDL> .r load_slc2 ; ; % Compiled module: TESTBLOCKNUMBER_INPUT. ; ; % Compiled module: TEXTBOXCB. ; ; % Compiled module: READDATATYPE. ; ; % Compiled module: READRGPTS. ; ; % Compiled module: READDAZPTS. ; ; % Compiled module: RARR. ; ; % Compiled module: SARR. ; ; % Compiled module: READ_ARRAY. ; ; % Compiled module: SAVE_ARRAY. ; ; % Compiled module: LOAD_SLC. ; ; ; ; 2. run the programm or call it from within your programm ; ; ; ; IDL> LOAD_SLC,arrayname ; ; ; ; ; ; 3. select data format and - if applicable x- and y dimensions ; ; ; ; 4. the data set should now be accessible as 'arrayname' ; ; ; ; EXAMPLE: ; ; ; ; LOAD_SLC, img1 ; ; window,1,title='magnitude image',xsize=512,ysize=512 ; ; tv,congrid(abs(img1),512,512) ; ; ; ; MODIFICATION HISTORY: ; ; ; ; Written by: Martin Hellmann, 15 May 2001. ; ; GUIs included 24 May 2001 ; ;- ; ;########################################################################### ; ; ; ; LICENSE ; ; ; ; This software is provided "as-is", without any express or ; ; implied warranty. In no event will the authors be held liable ; ; for any damages arising from the use of this software. ; ; ; ; Permission is granted to anyone to use this software for any ; ; purpose, including commercial applications, and to alter it and ; ; redistribute it freely, subject to the following restrictions: ; ; ; ; 1. The origin of this software must not be misrepresented; you must ; ; not claim you wrote the original software. If you use this software ; ; in a product, an acknowledgment in the product documentation ; ; would be appreciated, but is not required. ; ; ; ; 2. Altered source versions must be plainly marked as such, and must ; ; not be misrepresented as being the original software. ; ; ; ; 3. This notice may not be removed or altered from any source distribution. ; ; ; ; For more information on Open Source Software, visit the Open Source ; ; web site: http://www.opensource.org. ; ; ; ;------------------------------------------------------------------ ; ; This software has been released under the terms of the GNU Public ; ; license. See http://www.gnu.org/copyleft/gpl.html for details. ; ;------------------------------------------------------------------ ; ; ;############################################################################# ; ;# # ; ;# LOAD_POL # ; ;# # ; ;############################################################################# ; ;############################################################################# ; ;# # ; ;# This Routine loads 4 Single Look Complex channels HH,HV,VH,VV # ; ;# of a fully polarimetric SAR data set H=Horizontal,V=Vertical # ; ;# - Andreas 'Anderl' Reigber's: rarr.pro/sarr.pro # ; ;# - Rolf Schreiber's format: 2 LONG values as header # ; ;# - Gunther Jaeger's READ_ARRAY.pro/SAVE_ARRAY.pro format # ; ;# - raw 32 bit complex data without header # ; ;# # ; ;# CALLING SEQUENCE: loadslc,slc # ; ;# # ; ;############################################################################# ; ;# # ; ;# This software has been released under the terms of the GNU Public # ; ;# license. See http://www.gnu.org/copyleft/gpl.html for details. # ; ;# # ; ;############################################################################# ; ;# Version 1.0 / 16.05.2001 Last Modification: 23.05.2001 # ; ;# # ; ;# M.Hellmann # ; ;############################################################################# ; ; ;============================================================================= ; ;==================== The reading and saving routines for ================ ; ;==================== Anderl's and Gunther's Formats ================ ; ;==================== uncomment and/ or save in seperate file ================ ; ;==================== if you don't have them already ================ ; ;============================================================================= ; ; ; ;------------------------------------------------------------------------------ ; ; ;------------------------------------------------------------------------------ ; ; ; Autor: Andreas Reigber ; ; ; Datum: 1.4.1998 ; ; ; ; ; ; Write a variable to a file. Any dimensions and type. ; ; ; ; ; ; Aufruf: sarr,filename,array ; ; ; Keywords: INFO - Comment (default = "unknown content") ; ; ; JOAO - my old format (2*long, then always floatarray) ; ; ; NOXDR - dont use /XDR format ; ; ; HEADER- only save header (only if not /JOAO) ; ; ; in array you get back open LUN ; ; ; GZIP - compress with gzip komprimiert, dont put .gz at the end ; ; ; ; ; ;------------------------------------------------------------------------------ ; ; ;------------------------------------------------------------------------------ ; ; ;------------------------------------------------------------------ ; ; ; This software has been released under the terms of the GNU Public ; ; ; license. See http://www.gnu.org/copyleft/gpl.html for details. ; ; ;------------------------------------------------------------------ ; ; ; ; ; ; pro sarr,file,bild,INFO=info,JOAO=joao,NOXDR=noxdr,HEADER=header,GZIP=gzip ; ; on_error,2 ; ; ; ; if keyword_set(noxdr) then xflag=0 else xflag=1 ; ; ; ; if not keyword_set(joao) then begin ; ; ; ; if not keyword_set(info) then info = "unknown content" ; ; leng = strlen(info) ; ; info = byte(info) ; ; if leng lt 80 then info = [info,bytarr(80-leng)+32b] $ ; ; else info = info[0:79] ; ; ; ; s=size(bild) ; ; s=s[0:s[0]+1] ; ; if keyword_set(header) then begin ; ; openw,ddd,file,/get_lun,xdr=xflag ; ; writeu,ddd,long(header) ; ; writeu,ddd,info ; ; bild = ddd ; ; endif else begin ; ; openw,ddd,file,/get_lun,xdr=xflag ; ; writeu,ddd,s ; ; writeu,ddd,info ; ; writeu,ddd,bild ; ; free_lun,ddd ; ; if keyword_set(gzip) then spawn,'gzip --fast '+file ; ; endelse ; ; ; ; endif else begin ; ; ; ; if keyword_set(info) then print,"Joao-Format kennt kein Infostring" ; ; openw,ddd,file,/get_lun,xdr=xflag ; ; writeu,ddd,long((size(bild))[1]) ; ; writeu,ddd,long((size(bild))[2]) ; ; writeu,ddd,bild ; ; free_lun,ddd ; ; ; ; endelse ; ; ; ; ; ; ; ; end ; ; ; ; ;------------------------------------------------------------------------------ ; ; ;------------------------------------------------------------------------------ ; ; ; Autor: Andreas Reigber ; ; ; Datum: 1.4.1998 ; ; ; ; ; ; read an array written by sarr ; ; ; ; ; ; Aufruf: rarr,filename,array ; ; ; Keywords: INFO - here you find the comment (Default = "unknown content") ; ; ; JOAO - my old format (2*long,then always floatarray - bad) ; ; ; NOXDR - do not use /XDR ; ; ; HEADER- read only header (if not /JOAO) ; ; ; in array you get the open LUN. ; ; ; BLOCK - read only this block of the data [X1,Y1,DX,DY] ; ; ; GZIP - uncompress with gunzip, dont put .gz at the end ; ; ; ; ; ;------------------------------------------------------------------------------ ; ; ;------------------------------------------------------------------ ; ; ; This software has been released under the terms of the GNU Public ; ; ; license. See http://www.gnu.org/copyleft/gpl.html for details. ; ; ;------------------------------------------------------------------ ; ; ; ; ; ; pro rarr,file,bild,INFO=info,JOAO=joao,NOXDR=noxdr,HEADER=header,BLOCK=block,GZIP=gzip ; ; on_error,2 ; ; ; ; ; Unzulaessige KEYWORD-Kombinationen ; ; if keyword_set(joao) and keyword_set(block) then begin ; ; print," Kombination /JOAO und /BLOCK nicht implementiert" ; ; return ; ; endif ; ; if keyword_set(header) and keyword_set(block) then begin ; ; print," Kombination /HEADER und /BLOCK ist Bloedsinn" ; ; return ; ; endif ; ; if keyword_set(header) and keyword_set(joao) then begin ; ; print," Kombination /HEADER und /JOAO nicht implementiert" ; ; return ; ; endif ; ; if keyword_set(info) and keyword_set(joao) then begin ; ; print,"Joao-Format kennt kein Infostring" ; ; return ; ; endif ; ; ; ; ; ; if keyword_set(noxdr) then xflag=0 else xflag=1 ; ; ; ; if not keyword_set(joao) then begin ; ; if keyword_set(gzip) then begin ; ; datstr = floor((randomu(seed,1))[0]*1e6) ; ; datstr = strcompress(datstr,/remove) ; ; spawn,'gunzip -c '+file+'.gz > /tmp/sarr'+datstr ; ; file = '/tmp/sarr'+datstr ; ; endif ; ; ; ; dim = 0l ; ; var = 0l ; ; info = bytarr(80) ; ; openr,ddd,file,/get_lun,xdr=xflag ; ; readu,ddd,dim ; ; siz=lonarr(dim) ; ; readu,ddd,siz ; ; readu,ddd,var ; ; readu,ddd,info ; ; info = strtrim(string(info)) ; ; ; ; if keyword_set(header) then begin ; ; bild = ddd ; ; header = [dim,siz,var] ; ; endif else begin ; ; if keyword_set(block) then begin ; ; case var of ; ; 4: bits = 4 ; ; 6: bits = 8 ; ; else: begin ; ; print,'Blocklesen nur bei FLOAT und COMPLEX' ; ; return ; ; end ; ; endcase ; ; point_lun,-ddd,pos ; ; point_lun,ddd,pos+block[1]*siz[0]*bits ; ; siz = [siz[0],block[3]] ; ; endif ; ; case var of ; ; 1: bild=make_array(/byte,dimension=siz) ; ; 2: bild=make_array(/int,dimension=siz) ; ; 3: bild=make_array(/long,dimension=siz) ; ; 4: bild=make_array(/float,dimension=siz) ; ; 5: bild=make_array(/double,dimension=siz) ; ; 6: bild=make_array(/complex,dimension=siz) ; ; 9: bild=make_array(/dcomplex,dimension=siz) ; ; else: begin ; ; print,'Arraytyp nicht erkannt (Falsches Format ??)' ; ; return ; ; end ; ; endcase ; ; readu,ddd,bild ; ; free_lun,ddd ; ; if keyword_set(gzip) then spawn,'rm '+file ; ; if keyword_set(block) then bild = bild[block[0]:block[0]+block[2]-1,*] ; ; endelse ; Header oder alles einlesen ; ; ; ; endif else begin ; Joao-Format ; ; ; ; sizx = 0l ; ; sizy = 0l ; ; openr,ddd,file,/get_lun,xdr=xflag ; ; readu,ddd,sizx ; ; readu,ddd,sizy ; ; bild=fltarr(sizx,sizy) ; ; readu,ddd,bild ; ; free_lun,ddd ; ; ; ; endelse ; Joao-Format ; ; end ; ; ; ; PRO save_array,array,filename ; ; ; ; ;SAVE_ARRAY saves any array up to 6 dimensions ; ; ;includes a header containing all informations ; ; ;about type and size of array ; ; ; ; ;CALLING SEQUENCE: ; ; ;SAVE_ARRAY,array,filename ; ; ; ; ; ; ;KEYWORD ; ; ;FILENAME: STRING, that contain the NAME array should be saved ; ; ;IF filename is not defined 'array.dat' is used ; ; ; ; IF KEYWORD_SET(filename) THEN BEGIN ; ; filename=filename ; ; ENDIF ELSE BEGIN ; ; filename='array.dat' ; ; ENDELSE ; ; ; ; arraySize=SIZE(array) ; ; ; ; OPENW,/XDR,unit,filename,/GET_LUN ; ; WRITEU,unit,arraySize ; ; WRITEU,unit,array ; ; FREE_LUN,unit ; ; ; ; END ; ; ; ; ; ; PRO read_array,array,filename ; ; ; ; ;READ_ARRAY reads any array up to 6 dimensions ; ; ;without needing any dimensions input ; ; ;Assumption is that array was saved with ; ; ;SAVE_ARRAY ; ; ; ; ; ; ;CALLING SEQUENCE: ; ; ;READ_ARRAY,array,filename ; ; ; ; ; ; ;KEYWORD ; ; ;FILENAME: STRING, that contain the NAME array should be saved ; ; ;IF filename is not defined 'array.dat' is used ; ; ; ; ; ; ; ; IF KEYWORD_SET(filename) THEN BEGIN ; ; filename=filename ; ; ENDIF ELSE BEGIN ; ; filename='array.dat' ; ; ENDELSE ; ; ; ; dim=LONG(1) & cols=LONG(1) & rows=LONG(1) & depth=LONG(1) ; ; dim4=LONG(1) & dim5=LONG(1) & dim6=LONG(1) & type=LONG(1) ; ; elements=LONG(1) ; ; ; ; OPENR,/XDR,unit,filename,/GET_LUN ; ; READU,unit,dim ; ; ; ; IF dim EQ 0 THEN PRINT,'Array is undefined' ; ; IF dim GE 1 THEN READU,unit,cols ; ; IF dim GE 2 THEN READU,unit,rows ; ; IF dim GE 3 THEN READU,unit,depth ; ; IF dim GE 4 THEN READU,unit,dim4 ; ; IF dim GE 5 THEN READU,unit,dim5 ; ; IF dim GE 6 THEN READU,unit,dim6 ; ; IF dim GE 7 THEN PRINT,'You want read to much dimensions, write YOUR own Program !!!' ; ; ; ; READU,unit,type ; ; READU,unit,elements ; ; ; ; IF type EQ 0 THEN PRINT,'Array is undefined' ; ; IF type EQ 1 THEN array=BYTARR(cols,rows,depth,dim4,dim5,dim6) ; ; IF type EQ 2 THEN array=INTARR(cols,rows,depth,dim4,dim5,dim6) ; ; IF type EQ 3 THEN array=LONARR(cols,rows,depth,dim4,dim5,dim6) ; ; IF type EQ 4 THEN array=FLTARR(cols,rows,depth,dim4,dim5,dim6) ; ; IF type EQ 5 THEN array=DBLARR(cols,rows,depth,dim4,dim5,dim6) ; ; IF type EQ 6 THEN array=COMPLEXARR(cols,rows,depth,dim4,dim5,dim6) ; ; IF type EQ 7 THEN array=STRARR(cols,rows,depth,dim4,dim5,dim6) ; ; IF type EQ 8 THEN array=CREATE_STRUCT({array},cols) ; ; IF type EQ 9 THEN array=DCOMPLEXARR(cols,rows,depth,dim4,dim5,dim6) ; ; ; ; READU,unit,array ; ; ; ; FREE_LUN,unit ; ; END ; ; ; ; ; ; ;============================================================================ ; ;========================= the widget/GUI routines ======================== ; ;============================================================================ ; ; ; ; PRO TestBlockNumber_Input,Value ; TestBlockNumber = Value ; ;Print,TestBlockNumber ; END ; ; PRO TextBoxCB, Event ; Common ReturnValue, in_value ; Widget_Control,Event.ID, Get_Value= Value ; Value = FIX(Value[0]) ; MaxTestBlock = 32000 ; If (Value GE 1) AND (Value LE MaxTestBlock) Then Begin ; ans = Dialog_Message('Is this Number Correct?', /Question) ; If ans EQ 'Yes' Then Begin ; TestBlockNumber_Input, Value ; in_value = Value ; EndIf ; EndIf Else Widget_Control,Event.id,Set_Value='2' ; Widget_Control,event.top,/destroy ; END ; ; PRO readdatatype, in_value ; tlb = Widget_Base(Title = 'Select',/Column) ; Label = Widget_Label(tlb,Value='data type') ; TextBox = Widget_Text(tlb,Value='2',/Editable,Event_Pro='TextBoxCB') ; Widget_Control, tlb, /Realize ; xManager,'TestGUI',tlb ; END ; ; PRO readrgpts, in_value ; tlb = Widget_Base(Title = 'Input',/Column) ; Label = Widget_Label(tlb,Value='type No. of pix in Range') ; TextBox = Widget_Text(tlb,Value='2',/Editable,Event_Pro='TextBoxCB') ; Widget_Control, tlb, /Realize ; xManager,'TestGUI',tlb ; END ; ; PRO readdazpts, in_value ; tlb = Widget_Base(Title = 'Input',/Column) ; Label = Widget_Label(tlb,Value='type No. of pix in Range') ; TextBox = Widget_Text(tlb,Value='2',/Editable,Event_Pro='TextBoxCB') ; Widget_Control, tlb, /Realize ; xManager,'TestGUI',tlb ; END ; ; @rarr.pro ;anderls read and write routines available at nought.de ; @sarr.pro ;http://epsilon.nought.de/ ; @read_array.pro ; @save_array.pro ; ; pro load_slc,slc_hh,slc_hv,slc_vh,slc_vv ; ; ; Common ReturnValue, in_value ; ; ; ; ;============================= select data sets ============================= ; ; name =$ ; ; name_hh =$ ; DIALOG_PICKFILE(/read,/must_exist,$ ; path='./',$ ; title='select HH-Channel') ; ; name_hv =$ ; DIALOG_PICKFILE(/read,/must_exist,$ ; path='./',$ ; title='select HV-Channel') ; ; ; name_vh =$ ; DIALOG_PICKFILE(/read,/must_exist,$ ; path='./',$ ; title='select HH-Channel') ; ; name_vv =$ ; DIALOG_PICKFILE(/read,/must_exist,$ ; path='./',$ ; title='select HV-Channel') ; ;============================= select data format ============================= ; ; ; print,'' ; print,'select data format: type 1 for Anderls (rarr.pro/sarr.pro) format,' ; print,'type 2 for Rolf Scheibers format (2 long values as header), type 3' ; print,'for Gunther Jaegers format READ_ARRAY/SAVE_ARRAY and type 4 for ' ; print,'for pure Complex arrays without header information [1/2/3/4]' ; print,'' ; ; in_value='' ; ; ;==============================data formats================================== ; ; ;============================================================================ ; ;========================= those who don't like widget ==================== ; ;========================= may comment in the following lines =============== ; ;============================================================================ ; ;; repeat begin ; ; read,in_value ; ; endrep until ((in_value eq '1') or (in_value eq '2') or $ ; ; (in_value eq '3') or (in_value eq '4')) ; ; ; ;============================================================================ ; ;===================== and comment out the READDATATYPE below =============== ; ;============================================================================ ; ; ; ;==============================data formats================================== ; ; Label1: ; ; READDATATYPE ;widget to read the data type ; ; ; case in_value of ; ; '1': ;------ Anderl's Format ----------- ; begin ; rarr,name_hh,slc_hh ; rarr,name_hv,slc_hv ; rarr,name_vh,slc_vh ; rarr,name_vv,slc_vv ; end ; '2': ;------ Rolf's's Format ----------- ; begin ; openr,uhh,name_hh,xdr=1,/get_lun ;------ HH-Channel ------------- ; header=lonarr(2) ; readu,uhh,header ; slc_hh=complexarr(header[0],header[1]) ; readu,uhh,slc_hh ; free_lun,uhh ; ; openr,uhv,name_hv,xdr=1,/get_lun ;------ HV-Channel ------------- ; header=lonarr(2) ; readu,uhv,header ; slc_hv=complexarr(header[0],header[1]) ; readu,uhv,slc_hv ; free_lun,uhv ; ; openr,uvh,name_vh,xdr=1,/get_lun ;------ VH-Channel ------------- ; header=lonarr(2) ; readu,uvh,header ; slc_vh=complexarr(header[0],header[1]) ; readu,uvh,slc_vh ; free_lun,uvh ; ; openr,uvv,name_vv,xdr=1,/get_lun ;------ VV-channel ------------- ; header=lonarr(2) ; readu,uvv,header ; slc_vv=complexarr(header[0],header[1]) ; readu,uvv,slc_vv ; free_lun,uvv ; end ; ; '3': ;------ Gunther's Format ------------- ; begin ; READ_ARRAY,slc_hh,name_hh ;------ VV-channel ------------- ; READ_ARRAY,slc_hv,name_hv ; READ_ARRAY,slc_vh,name_vh ; READ_ARRAY,slc_vv,name_vv ; end ; ;============================================================================ ; ;========================= those who don't like widget ==================== ; ;========================= may comment in the following lines =============== ; ;============================================================================ ; ; ; ; '4': begin ; ; HELL: ; ; print,'type no. of pixel in range (x-dimension of the array)' ; ; rg_pix=1l ; ; read,rg_pix ; ; print,'type no. of pixel in azimuth (y-dimension of the array)' ; ; az_pix=1l ; ; read,az_pix ; ; ; ; print,'the dimenions are' ; ; print,'No. pixel in azimuth = ',+ Strcompress(rg_pix) ; ; print,'No. pixel in azimuth = ',+ Strcompress(az_pix) ; ; print,'is this correct ? [Y/N]' ; ; confrm='' ; ; repeat begin ; ; read,confrm ; ; endrep until ((confrm eq 'n') or (confrm eq 'N') $ ; ; or (confrm eq 'y') or (confrm eq 'Y')) ; ; if ((confrm eq 'n') or (confrm eq 'N')) then goto, hell ; ; openr,u,name,xdr=1,/get_lun ; ; slc=complexarr(rg_pix,az_pix) ; ; readu,u,slc ; ; free_lun,u ; ;============================================================================ ; ;========================= and comment in the following lines =============== ; ;============================================================================ ; ; ; '4': begin ; ; ; print,'type no. of pixel in range (x-dimension of the array)' ; readrgpts ; rg_pix=in_value ; print,'type no. of pixel in azimuth (y-dimension of the array)' ; readdazpts ; az_pix=in_value ; print,'the dimenions are' ; print,'No. pixel in azimuth = ',+ Strcompress(rg_pix) ; print,'No. pixel in azimuth = ',+ Strcompress(az_pix) ; ; ; openr,uhh,name_hh,xdr=1,/get_lun ;------ HH-Channel ------------- ; readu,uhh,header ; slc_hh=complexarr(rg_pix,az_pix) ; readu,uhh,slc_hh ; free_lun,uhh ; ; openr,uhv,name_hv,xdr=1,/get_lun ;------ HV-Channel ------------- ; readu,uhv,header ; slc_hv=complexarr(rg_pix,az_pix) ; readu,uhv,slc_hv ; free_lun,uhv ; ; openr,uvh,name_vh,xdr=1,/get_lun ;------ VH-Channel ------------- ; readu,uvh,header ; slc_vh=complexarr(rg_pix,az_pix) ; readu,uvh,slc_vh ; free_lun,uvh ; ; openr,uvv,name_vv,xdr=1,/get_lun ;------ VV-channel ------------- ; readu,uvv,header ; slc_vv=complexarr(rg_pix,az_pix) ; readu,uvv,slc_vv ; free_lun,uvvopenr,u,name,xdr=1,/get_lun ; slc=complexarr(rg_pix,az_pix) ; readu,u,slc ; free_lun,u ; end ; ; ;============================================================================ ; ;=========================end of widget solution for option 4 =============== ; ;============================================================================ ; ; ; else: begin ; print, 'the cult of cuthullu does not allow to support this format!' ; goto, Label1 ; end ;No matches" ; ; endcase ;End of CASE statement. ; end ;============================================================================= ;=== widget routines for the selection of the decomposition type ==== ;============================================================================= PRO TestBlockNumber_Input,Value TestBlockNumber = Value ;Print,TestBlockNumber END PRO TextBoxCB, Event Common ReturnValue, in_value Widget_Control,Event.ID, Get_Value= Value Value = FIX(Value[0]) MaxTestBlock = 32000 If (Value GE 1) AND (Value LE MaxTestBlock) Then Begin ans = Dialog_Message('Is this Number Correct?', /Question) If ans EQ 'Yes' Then Begin TestBlockNumber_Input, Value in_value = Value EndIf EndIf Else Widget_Control,Event.id,Set_Value='2' Widget_Control,event.top,/destroy END PRO readdecomptype, in_value tlb = Widget_Base(Title = 'Select',/Column) Label = Widget_Label(tlb,Value='decomp type') TextBox = Widget_Text(tlb,Value='2',/Editable,Event_Pro='TextBoxCB') Widget_Control, tlb, /Realize xManager,'TestGUI',tlb END @load_pol pro decomp Common ReturnValue, in_value ;============================= read data set ================================== LOAD_POL,slc_hh,slc_hv,slc_vh,slc_vv ;============================= create image array ================================= c=size(slc_hh) sam=c[1] lines=c[2] first=fltarr(sam,lines) sec=fltarr(sam,lines) third=fltarr(sam,lines) image1=bytarr(3,sam,lines) SLC_X=(SLC_VH+SLC_HV)/2 ;average crosspol data sets SLC_VH=0 ;free memory SLC_HV=0 ;free memory ;======================= select decomposition type ============================ print,'' print,'select desired decomposition: type 1 for lexical/Borgeaud decomposition,' print,'type 2 for Pauli decomposition or type 3 for Sphere Diplane Helix (SDH)' print,'decomposition [1/2/3]' print,'' in_value='' ;==============================data formats================================== ;============================================================================ ;========================= those who don't like widget ==================== ;========================= may comment in the following lines =============== ;============================================================================ ;; repeat begin ; read,in_value ; endrep until ((in_value eq '1') or (in_value eq '2') or $ ; (in_value eq '3')) ; ;============================================================================ ;===================== and comment out the READDATATYPE below =============== ;============================================================================ Label1: READDECOMPTYPE case in_value of '1': begin ;------ lexical ----------- first = (abs(SLC_HH))^0.7 ;red sec = (abs(SLC_X))^0.7 ;green third=(abs(SLC_VV))^0.7 ;blue end '2': begin ;------ Pauli ------------- ;============ Calculate Pauli Components ========= Pauli1=SLC_HH+SLC_VV ; odd bounce SLC_HH=0 ; free memory Pauli2=SLC_X+SLC_X ; degrees tilted even bounce SLC_X=0 ; free memory Pauli3=Pauli1-2*SLC_VV ; even bounce45 SLC_VV=0 ; free memory first = (abs(pauli3))^0.7 ;red sec = (sqrt(2)*abs(pauli2))^0.7 ;green third=(abs(pauli1))^0.7 ;blue end '3': begin ;------ SDH ------------- ;============ Calculate Circular Basis Components ========= S_RR=complex(0,1)*SLC_X+0.5*(SLC_HH-SLC_VV) ;right-right S_LL=complex(0,1)*SLC_X-0.5*(SLC_HH-SLC_VV) ;left-left SLC_X=0 ; free memory S_RL=0.5*complex(0,1)*(SLC_HH+SLC_VV) ;right-left SLC_HH=0 ; free memory SLC_VV=0 ; free memory ;============= Absolute Values ============================ AS_RR=abs(S_RR) S_RR=0 ; free memory AS_RL=abs(S_RL) S_RL=0 ; free memory AS_LL=abs(S_LL) S_LL=0 ; free memory ;=========== Check whether S_RR or S_LL is bigger ========= INDEX_A=WHERE(AS_RR ge AS_LL) INDEX_B=WHERE(AS_RR lt AS_LL) first = (AS_RL)^0.7 ;sphere sec(INDEX_A) = (AS_RR(INDEX_A))^0.7 ;diplane 1 sec(INDEX_B) = (AS_LL (INDEX_B))^0.7 ;diplane 2 third(INDEX_A)=(AS_RR(INDEX_A)-AS_LL(INDEX_A ))^0.7;helix 1 third(INDEX_B)=(AS_LL(INDEX_B)-AS_RR(INDEX_B))^0.7 ;helix 2 end else: begin print, 'the cult of cuthullu does not allow to support this format!' goto, Label1 end ;No matches" endcase ;End of CASE statement. ;============================================================================ ;==================== create .tif image and save =========================== ;============================================================================ ;=========== for whole data sets complete bytscale == pixno=n_elements(first) Mean=fltarr(3) mean(0)=total(first)/pixno mean(1)=total(sec)/pixno mean(2)=total(third)/pixno maxmean=max(mean) ;==================================================== bfirst=bytscl(first,max=2*maxmean,min=0) ;red bsec=bytscl(sec,max=2*maxmean,min=0) ;green bthird=bytscl(third,max=2*maxmean,min=0) ;blue image1(0,*,*)=bfirst image1(1,*,*)=bsec image1(2,*,*)=bthird write_tiff,'decomp.tif',image1 end