Download presentation
Presentation is loading. Please wait.
Published byApril Walker Modified over 9 years ago
1
Introduction to IDL Lecture 2
2
ITT: solutions for data visualization and image analysis http://www.ittvis.com/ http://www.ittvis.com/ IDL, programming language ENVI, image processing based on IDL
3
IDL Data visualization and image analysis IDL has both numeric and nonnumeric data types IDL is an array-oriented language Build-in functions Command Line and Development Environment
5
Array-oriented language One dimension array (or vector): array=[1.0, 2.0, 4.0, 8.0] or array (4) Two dimension array (or matrices, one band image): Array=[[1,2,3], [5,7,8]] or (Array (3,2)) Three dimension array (multiple bands image) Array=findgen(500,300,6) or an image of 500 columns, 300 rows, and 6 bands Any operation on an array is performed on all elements of the array, without the need for the user to write an explicit loop. The resulting code is easier to read and understand, and executes more efficiently. For example, you have a landsat image of (500, 300, 6) (i.e. column, row, bands) and you wish to divide each pixel (or element) by 2 or do other calculations: Image=image/2 Print, total(image) / n_elements(image) Print, mean(image) ;the same as above (c, r, b): BSQ; (b, c, r): BIP; (c, b, r): BIL Differ from Matlab: row, column
7
Compact syntax without using loops. This makes simpler coding and the processing much faster than loops npts=1000000L data=randomu(0L, npts) sum=total(data) sum=0.0 for i=0L, (npts-1L) do sum=sum+data[i] Needs 0.11 second Needs 2.64s Randomu: Return a array of uniformly distributed random numbers (0,1) of the specified dimensions
8
Functions for array creation Zeroed array ( *arr() ) bytarr(), intarr(), uintarr(), ulonarr(), ulong64arr(), fltarr(), dblarr(), complexarr(), strarr() Index array bindgen(): byte index array indgen(): integer index array ul64indgen(): unsigned integer array ulindgen(): unsigned long integer array lindgen(): long integer index array l64indgen(): 64-bit integer array findgen(): Floating-point index array dcindgen(): double precision floating-point index array cindgen(): complex index array dcindgen(): complex, double-precision index array sindgen(): spring array
9
Array indexing array dimension myarr(), array indexing myarr[index] Two dimension can be 1-d linear indexing Arr[14]=56 2-d indexing Arr[2,3]=56 Arr = indgen(4,4)*4 Print, arr 0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 Print, arr[3,2] 44 Print, arr[11] 44 Print, arr(*,2), arr(2,*) ?
10
Array properties-build in functions n_elements(), size(), min(), max(), mean(), variance(), stddev(), moment(), total()
11
Other operations for an array Locating values within an array Array reordering: reform(), reverse(), rotate(), transpose(), shift(), sort(), uniq() Array resizing: rebin(), congrid(), interpolate(), Arr = indgen(9)*10 Index = where(arr gt 35) Print, arr[index] ?
12
Other build-in functions and procedures FFT(image, -1), forward fast Fourier transfer FFT(image, 1), inverse FFT ROT(image, angle, scale, /sampling methods) interpolate, bilinear, cubic, map_image read_binary correlate …. plot tv, tvscl contour ….
13
Command Line and Development Environment
14
iTools Allow you to more quickly and easily open, analyze and visualize your data than even before. http://www.ittvis.com/idl/itools_tutorials.asp iPlot (plot) iSurface (surface) iContour (contour) iImage (tv, tvscl) iVolume (volume) iMap iVector
15
IDL Virtual Machine Simple, no-cost method of distribution Run IDL.sav file programs without license requirements Commercial and non-commercial applications
16
IDL/ENVI programming Combine the ENVI/IDL together, extending the ENVI interface in IDL in order to implement new methods and algorithms of arbitrary sophistication is both easy and fun (M. Canty, 2007) See an example and will give more examples as the class moving forward DEMO!
17
IDL Project IDL Project allows you to easily develop applications in IDL for distribution among other developers, colleagues, or users who have IDL Working with an IDL Project allows you to easily prepare a SAVE file of your IDL application for distribution. You can organize, manage, compile, run, and create distributions of all of your application files from within the IDL Project interface. IDL Project offers the flexibility and functionality you need in a development environment. Access to all files in your application IDL source code files (.pro) GUI files (.prc) created with IDL GUIBuilder Data files Image files Other files (help files,.sav files, etc.) Build application and create an IDL.sav file for distribution and share.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.