Procrustes Skull Analysis
Summary
Procrustes analysis is a form of statistical shape analysis used to analyze the distribution of a set of shapes. The goal of this assignment is to compare different skull types to a reference skull to determine similarities and differences using Procrustes analysis techniques. Students will iteratively develop code that can plot a complete triangle from three vertices. They will then write code to compare and plot two triangles, translate, scale, and rotate those triangles to determine the degree of rotation that results in the minimum distance between them. They will then adapt that code to plot and compare two skulls such that they are able to complete a morphological analysis between skulls from different species.
Learning Goals
-Read information from and write information to Excel files and csv files.
-Extract filenames and pathnames as variables from dialog boxes in MATLAB and combine these two types of information to create a complete 'address' for file access.
-Create and use dialog boxes in MATLAB to open files and to save files, to extract information from files and to write information to files.
-Create (or read in from Excel) and use two-dimensional arrays, as for x,y data.
Generate simple x,y plots in MATLAB.
-Provide a simple description on the difference between plot, scatter, and bar function, and how they should be used.
-Given a subplot command ("subplot(m,n,i)"), describe what the m, n, and i indexes describe and identify the location in the subplot frame where the next 'plot' command will be placed.
-Use "hold on" commands where needed to plot multiple data sets on the same plot, to make subplots, and to add features to plots (titles, axis labels, legends, etc.).
-Control the line color, marker type and color, etc. in plots.
-Make the axes of plots equal or square to aid visual interpretation.
-Change font size in axis labels and title.
-Use MATLAB's ":" operator to access selected ranges of data within arrays.
-Given a name and data indices for a two-dimensional array (for example, "myArray(2,4)" or "myArray(3,:)"), represent the two-dimensional array as two columns of boxes and highlight the location of the data referred to by the given indices.
-Interpret the size of a matrix as shown in MATLAB workspace to identify the numbers of rows and columns in the matrix.
-Describe the Procrustes analysis technique in words, and explain why the three steps of translation, scaling, and rotation are necessary in order to complete a meaningful shape analysis.
-"Trick" MATLAB into plotting a closed loop by creating a final data point that is equal to the first data point in the series.
-Given a complicated shape – like a skull – select and justify appropriate locations from which to collect homologous points for Procrustes analysis.
-Complete mathematical operations on matrices in MATLAB (such as multiplying, raising to a power, etc.)
-Use MATLAB to read in and to show an image file.
-Use powerful matrix manipulation commands to implement a complete Procrustes analysis in MATLAB, including translation (centering the centroids of the objects to be investigated), scaling (same centroid size), and rotation through 360 degrees to find the rotation angle for which the Procrustes number is minimized. Plot the original shapes and major steps (translation, scaling, rotation) in subplot frames.
-Use powerful matrix manipulation commands to implement a complete Procrustes analysis in MATLAB, including translation (centering the centroids of the objects to be investigated), scaling (same centroid size), and rotation through 360 degrees to find the rotation angle for which the Procrustes number is minimized. Plot the original shapes and major steps (translation, scaling, rotation) in subplot frames.
Context for Use
This is a series of assignments that build small skills and culminates in a final project. This activity spans several weeks and is considered most of a whole module (out of 5 total modules). Students should already be familiar with IF statements, FOR loops, and writing functions.
Description and Teaching Materials
The information about each sub-assignment and its individual goals are found within each handout. Briefly, the goal of this assignment is to compare different skull types to a reference skull to determine similarities and differences. To accomplish this, you will:
- Write a scriptXXXXCollectSkullPoints.m that asks user to select a file (*.jpg); user selects 18 anatomical markers; stores the coordinates of 18 points in a matrix (18 by 2); writes the coordinates into an EXCEL file. (The points that the user must select are shown in the handout).
- WriteSkullPlotFunction.m (function) to, based on the 18 coordinates, plots four geometric shapes; remember to separate the coordinates into groups (1-7; 8-10; 11:14; 15-18), and close out the loop for each group. (Example in handout)
- WriteXXXXSkullProcWork.m (script) to access the coordinates of two skulls (using XXXXCollectSkullPoints.m twice); store each set of coordinates into a variable; translates each centroid to the origin; scales each skull to have the same "area"; rotate the second skull until the Procrustes distance is smallest; stores the Procrustes distance for this particular pair of skulls; Generates four subplots (Example in handout).
- Write a discussion where you:
- Identify your reference
- Give initial estimates of which skulls you expect to be most and least different
- Provide the Procrustes values for all pairs
- Discuss your findings
Deliverables:
- XXXXCollectSkullPoints.m
- SkullPlotFunction.m
- SkullProcWork.m
- A sample image file called XXXXSkullPlots.jpeg
- Discussion (discussion should identify a reference skull and which skulls are most similar and different from it. Comments about what features contribute most to changing the Procrustes distance should be included).
The handouts and coding assignments should be distributed in the following order:
- 2D Plots in Matlab Handout 2D Plots in Matlab Handout Workshop.docx (Microsoft Word 2007 (.docx) 148kB Sep11 22)
- Matrix Arithmetic Operations Handout Matrix Arithmetic Operations Handout.docx (Microsoft Word 2007 (.docx) 126kB Sep11 22)
- Matrix Arithmetic Operations Part 2 Handout Matrix Arithmetic Operations Part 2 Handout.docx (Microsoft Word 2007 (.docx) 141kB Sep11 22)
- Images in Matlab Handout Images in Matlab Handout.docx (Microsoft Word 2007 (.docx) 1.3MB Sep11 22)
Also attached are the triangle image files that students will need to complete the assignment and the rotate function that I provide. ProcRotationFunction.m (Matlab File 718bytes Sep11 22)
Skull images can be found online and the specific species and number of skulls analyzed can be modified.
Triangle_A.tif (TIFF 39kB Sep11 22)
Triangle_B.tif (TIFF 39kB Sep11 22)
Triangle_C.tif (TIFF 39kB Sep11 22)
Triangle_D.tif (TIFF 39kB Sep11 22)
Reference skull: Human Skull
Teaching Notes and Tips
This assignment is used in a first-year introduction to programming course for biomedical engineering and biology majors. Students have a range of programming experience when they enter this course (from 0 to several years of experience) but we start from the very beginning. This assignment(s) should span 2-3 weeks at a minimum and come about mid-way through the course. I find it useful to introduce the activity with the presentation that is attached.
ProcrustesBackgroundv2.pptx (PowerPoint 2007 (.pptx) 1.9MB Sep11 22)
Topics to be covered prior to this assignment:
- General MATLAB programming concepts (IF, ELSE, FOR, WHILE)
- Commenting code
- User-defined functions
- Debugging and errors
- Data importing and exporting
- Breaking out of code
Assessment
The rubric attached can be used to assess the final submission. Intermediate submissions can be assessed based on whether or not they run and produce the desired output as stated in the instructions. Rubrics - Skull.docx (Microsoft Word 2007 (.docx) 31kB Sep11 22)