1. Trang chủ
  2. » Công Nghệ Thông Tin

matlab and medical image

130 276 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Matlab and Medical Image Analysis basics / Human Image Perception Kostas Marias Today’s goals •   •    •   Introduction What is MATLAB? •         !!  "#$  •  $“  ” What is Matlab? • A software environment for interactive numerical computations • Examples: – Matrix computations and linear algebra – Solving nonlinear equations – Numerical solution of differential equations – Mathematical optimization – Statistics and data analysis – Signal processing – Modelling of dynamical systems – Solving partial differential equations – Simulation of engineering systems Matlab Background • Matlab = Matrix Laboratory • Originally a user interface for numerical linear algebra routines (Lapak/Linpak) • Commercialized 1984 by The Mathworks • Since then heavily extended (defacto-standard) • Alternatives Complements • Matrix-X Maple (symbolic) Octave (free; GNU) Mathematica (symbolic) Lyme (free; Palm)  " %& '()%& *+& *+ MATLAB Environment Display Windows Help! •  •  , • - •  •  " • " ./.01!22.! Matlab Workspace • 3   "int8, uint8, int16, uint16, double – All numerical operations need to be performed on double precision, takes 8 bytes per value. – Other types are efficient for storage (<= 2 bytes) – Who, whos – current variables in workspace – Save, load – save or load variables to *.mat file – Clear all – clear all variables [...]... be listed with: >>type funcname • See Matlab editor (File>New>m-file) Interactive Calculations • Matlab is interactive, no need to declare variables • >> 2+3*4/2 • >> a=5e-3; b=1; a+b • • • • Most elementary functions and constants are already defined >> cos(pi) >> abs(1+i) >> sin(pi) • Last call gives answer 1.2246e-016 !? What kind of graphics is possible in Matlab? Polar plot: t=0:.01:2*pi; polar(t,abs(sin(2*t).*cos(2*t)));... sum vector – sum of all elements •Type for more instructions • size(A) • sum(A) • sum(sum(A)) help elmat Programming in Matlab • Script Files – List of commands to be executed sequentially Useful when same sequence is executed many times They should be saved with extension script.m and should be placed on work path to be called • >>script runs the sequence • Functions – Similar to script, but takes...Matrices in Matlab •How to build matrix? a – >>A=[1 2 3; 4 5 6; 7 8 9]; 3x3 matrix •Special matrices: – zeros(r,c), ones(r,c), eye(r,c), rand(r,c) … •Acess matrix elements: – A(2,3) - result = 6 – using one number to index: A(8) – result = 6 – matrix is written out as a single column – A(:,2) – obtain second column of the matrix Matrices in Matlab (2) •Basic Operations defined... overloaded • >> v + 2 • • • • Common operators >> B = A’ >> A*B >> A+B are are available • Note: • Matlab is case-sensitive A and a are two different variables • Transponate conjugates complex entries; avoided by • >> B=A.’ Indexing Matrices •Indexing using parentheses • >> A(2,3) •Index submatrices using vectors of row and column indices • >> A([2 3],[1 2]) •Ordering of indices is important! • >> B=A([3 2],[2... via ”handle” • >> h=plot(x,y); set(h, ’LineWidth’, 4); • Many other plot • >> v=1:4; pie(v) functions available Graphics •Three-dimensional graphics •>> A = zeros(32); •>> A(14:16,14:16) = ones(3); •>> F=abs(fft2(A)); •>> mesh(F) •>> rotate3d on •Several other available •>> surfl(F) plot functions •Can change lightning and material properties •>> cameramenu •>> material metal Graphics • Bitmap images... available •>> surfl(F) plot functions •Can change lightning and material properties •>> cameramenu •>> material metal Graphics • Bitmap images can also be visualized • >> load mandrill • >> image( X); colormap(map) • >> axis image off Basic concepts from algebra ∀nv ∀nk ∀n3 ∀n1 ∀n2 Inner (dot) Product v α w v.w = ( x1 , x2 ).( y1 , y2 ) = x1 y1 + x2 y2 The inner product is a SCALAR! v.w = ( x1... x=0:0.05:5;,y=sin(x.^2);,plot(x,y); Stem plot: x = 0:0.1:4;, y = sin(x.^2).*exp(-x); stem(x,y) What kind of graphics is possible in Matlab? Mesh plot: z=peaks(25);, mesh(z); Quiver plot: Surface plot: z=peaks(25);, surf(z);, colormap(jet); Contour plot: z=peaks(25);,contour(z,16); Vectors and Matrices • Vectors (arrays) are defined as • >> v = [1, 2, 4, 5] • >> w = [1; 2; 4; 5] • Matrices (2D arrays) defined... overloaded • >> help elmat • >> sin(A) • Specialized operators • >> As=sqrtm(A) • >> As^2 • >> A.*A matrix are often functions and • Note: in general, ”.” elementwise operation is Numerical Linear Algebra • Basic numerical linear • >> z=[1;2;3]; x=inv(A)*z • >> x=A\z • Many standard predefined • >> det(A) • >> rank(A) • >> eig(A) algebra functions • The number of input/output arguments can often... An×m  a11 a  21 = a31    an1  a12 a22 a32  an 2  a1m   a2 m    a3m      anm   Sum: Cn×m = An×m + Bn×m cij = aij + bij A and B must have the same dimensions Matrices Product: Cn× p = An×m Bm× p m cij = ∑ aik bkj k =1 Identity Matrix: A and B must have compatible dimensions An×n Bn×n ≠ Bn×n An×n 1 0  0    0 1  0  IA = AI = A I =      0 0  1    Matrices Transpose:... a12  1  = a a −a a a22  11 22 21 12  a22 − a  21 − a12  a11   Matrix MATLAB works with essentially only one kind of object – a rectangular numerical matrix with possible complex entries Entering a Matrix Matrices can be Entered manually; Generated by built-in functions; Loaded from external disk (using “load” command) An Example •A = 9] [1, 2, 3; 7, 8,   Use ‘ ; ’ to indicate the end of . Matlab and Medical Image Analysis basics / Human Image Perception Kostas Marias Today’s goals •   •    •   Introduction What. optimization – Statistics and data analysis – Signal processing – Modelling of dynamical systems – Solving partial differential equations – Simulation of engineering systems Matlab Background • Matlab = Matrix. elmat  Programming in Matlab • %5 – List of commands to be executed sequentially. Useful when same sequence is executed many times. They should be saved with extension script.m and should

Ngày đăng: 24/10/2014, 23:36

Xem thêm:

TỪ KHÓA LIÊN QUAN

Mục lục

    Matlab and Medical Image Analysis basics / Human Image Perception

    Basic concepts from algebra

    Array Operations (con’t…)

    Solutions to Systems of Linear Equations

    Solutions to Systems of Linear Equations (con’t…)

    if … elseif … else … end

    Additional commands for plotting

    3D - Plotting example

    Let’s move on to…

    Different Types of Filters

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN

w