1 / 23

Matlab course - Program

Matlab course - Program. Today Basic matrix operations Basic visualization. Images and plots Thursday Programming, scripts, more visualization Friday Graphical user interfaces and advanced visualizaton Any suggestions wellcome, only today is fairly set. Matlab course - introduction.

Download Presentation

Matlab course - Program

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Matlab course - Program • Today • Basic matrix operations • Basic visualization. Images and plots • Thursday • Programming, scripts, more visualization • Friday • Graphical user interfaces and advanced visualizaton • Any suggestions wellcome, only today is fairly set

  2. Matlab course - introduction • Goals • Visualize data • Develop programs • GUIs • Read other peoples programs (eg. SPM) • Hands on

  3. Matlab as a language • Vector/matrix based • Many built in functions • Few lines of code will get you far • Extensive visualization capabilities • Might run slower depending on task

  4. Lets start • Manipulating matrices and vectors • Basically needed for all programming tasks everything • Basic operations • Add noise to a simulated signal – an example (hemodynamic response function)

  5. Visualizing data

  6. Plotting data • The plot function • plot(y) • plot(x,y) • X and Y can be matrices • plot() will plot the columns • Use hold on to keep the old plot

  7. Simulating the HRF Buxton: Introduction to FMRI hrtvectortor = hrt(timevector, tau, t0, n)

  8. Excercise • Part 1 • Generate a timevector, L=10 s, interval=0.1 s • Use the hrf() function to generate a hemodynamic response • Use plot to verify the output • Part 2 • Imagine that you want to display 3 different hrf functions in a plot. Generate 3 functions and put them in a matrix columnwise. Use a single call to plot to view them • Part 3 • Use randn() to add noise to the curves. Use a std of XX • Plot again Example hrf parameters: timevec: from 0 to 20 secs tau: 1.2 t0: 4 s n: 3 Example noise parameters: Use a std of 0.1 – 0.3 - 0.5

  9. Images=matrices

  10. Imagescaling Min value Max value Full range Partial range

  11. imagesc() + colorbar imagesc(data) imagesc(data,[0 5000])

  12. Loading a dicom file • Matrix=dicomread(’filename’); • Matrix=double(Matrix); • imagesc(Matrix)

  13. colormap(cmap_name)

  14. hist(data(:),[bins])

  15. Logical comparisons • Largevalues=matrix > 500 • Can be true or false, 0 or 1

  16. Roipoly – will return a mask

  17. Exercise • Load a dicom into a matrix • Use hist()( to identify noise and see if there is ghosting using imagesc() • ’Cut away’ the noise • Hint: use a comparison to make a noise mask and then .* • Use roipoly to mask away 1 hemisphere

  18. Birgitte – how do we do stats on a mask?

  19. Exercise • Use mean() to get a mean of an ROI selected using roipoly • Plot a histogram of your ROI

  20. Saving work • save workspacename • save filename X saves only X. • Save filenename X Y Z saves X, Y, and Z.

  21. The online docs • Very usefull • Good links • Good newsgroup • Tomorrow: structures – the dir command

More Related