Practical 1: Processing Fundamentals
ID5220: Biomedical Imaging and Sensing
Due date: Thursday 11th March 2021 (11/03/2021) (Week 6) at 12:00 (midday) UK
35% of the coursework grade.
Please note that MMS is definitive for weighting and deadlines, which, occasionally
have to be changed.
The main aim of this practical is to have experience programming and explaining the funda-
mentals of processing both of medical signals and medical images. You will load some signals
and images and perform some signal and image processing tasks and write up a report on
what you did and why you did it that way, along with the outputs of your experiments.
The scenario is you are working for a medical technology start up. Their mission statement
is to improve patient well-being through image and signal processing. As phone cameras are
cheap and readily available in many communities these have been identified to be a good
target acquisition device to collect medical information. The company wants you to create
come code and a report around how to achieve these tasks (along with the advantages and
limitations of the approach used and outputs of prototype code).
Note that some parts may require you doing some research, part of this practical is to get
you to be familiar with how to figure out how to find information for yourself.
The company has identified to main targets:
(a) Measuring heart rates using the video feed of a camera.
(b) Identifying skin cancer from optical images of the skin. They do not intent to make a
commercial product from this skin cancer detection system but intent to provide the code free
of charge to clinicians to boost their profile.
Heart rate from video: Create a method to automatically calculate the heart rate from a video
of a finger placed on the camera lens. Provided is a video (approximately a minute long) of a
persons finger (video of finger.MOV). Explain the process you take (justifying your decisions).
The way you do this is up to you, you may wish to use a python version of OpenCV, perhaps
with pyvideoreader https://pypi.org/project/pyvideoreader/.
You will need to solve the following tasks (written by you in python):
1. Display a plot of the mean grayscale value from within each frame over time (in seconds).
2. Calculate the heart rate derived from the video using a script you write, the method you
use is up to you (you may wish to use a Fast Fourier Transform).
Skin cancer detection in optical images: Create a method to process and analyse optical
images of benign and malignant skin moles. You’re provided with a dataset of optical im-
ages of the skin (Skin cancer.zip), originally from the ISIC: Skin Lesion Analysis Towards
Melanoma Detection grand challenge https://www.isic-archive.com/. The condensed
dataset you will be processing is from
You are expected to do the following tasks:
1. Load in 3 benign and 3 malignant images and display these as a combined grid of images
to show examples of the two classes of the dataset. The choice of images is up to you.
2. Create a background remover which segments the mole from the rest of the skin. Display
an image matrix of the background removed for your three images of each class (shown
in the previous step), note you can set the background to be all black, all white or another
colour of your choosing. The images you show should show the mole (in colour) with
the background (rest of the skin) set to a single colour and have a grid of 3x2 image of
the 3 images from the 2 classes.
3. Create a classifier which predicts whether an image of a mole image contains a benign
or malignant mole. Show predictions for example images and calculate the accuracy
for both the training (and validation (as defined by you)) and test sets and show the
confusion matrices for these train/validate/test sets.
Each of these steps (for both heart rate and skin cancer tasks) should be clearly explained
in the report. In all cases, you should explain what you did, why you did it that way, what
the results show, what the results mean and put these into context. Evidence and justify your
arguments both with relevant citations and with the output of your analysis.
Try to keep the report informative and focussed on the important details and insights –
the report also demonstrates an understanding of what is important. There is a maximum
page limit of 10 pages, including figures but excluding references, note that this is a limit not
a target. All figures must be referenced in the main body of the text, and have captions and
must have legible axis labels.
Hand in via MMS, by the deadline of Thursday 11th March 2021 (11/03/2021) (Week 6) at
12:00 (midday) UK time:
• The Python code that you write (either as a .py (python script) file or a .ipynb (python
jupyter notebook) file. But do not include the original datasets or linked software.
• The files for the generated figures (include the relevant task number in the filename for
• A report in PDF format which contains details of each step of the process, justification for
any decisions you take, and an evaluation of the final analysis. This should also contain
evidence of functionality (via your results in the report) and any notable figures you
have produced with relevant citations throughout. Clearly link the text and files with
the task numbers above. Your report should include a brief introduction followed by the
methods results and discussion for both main tasks (heart rate and skin cancer) detailing
the subtasks for each along with a final conclusion.
Please create a .zip file containing all files and submit this to MMS in the Code1 slot, please
also upload your pdf report to the Report1 slot. Please note that MMS is definitive for weight-
ing and deadlines, which, occasionally have to be changed. Ensure you give yourself to upload
and download and check that you’ve uploaded the correct files, do this with enough time to
fix if required and re-check before the deadline.
Marking and Extensions
This practical will be marked according to the graduate school mark descriptors. All docu-
ments relating to the mark descriptors (and their conversion to the 20 point scale) can be found
on the graduate school webpages: https://www.st-andrews.ac.uk/graduate-school/
For the mark descriptors see: https://www.st-andrews.ac.uk/assets/university/
graduate-school/documents/marks-descriptors.pdf. You should also be aware of
the following marking guidelines for this practical:
• To get a mark in the 0-22% band is a submission which shows little evidence of any
attempt to complete the work.
• To get mark in the 23-39% band is a submission which shows little evidence of any ac-
ceptable attempt to complete the work, with no substantial relevant material submitted.
• A partial working implementation in the 40-49% grade band is a submission which shows
evidence of a reasonable attempt addressing some of the requirements, or is accompa-
nied by a very weak report which does not evidence good understanding. Perhaps only
one of the main components is attempted however it’s not done well.
• A basic implementation in the 50-59% band is a submission which achieves a solution in a
straight-forward way and contains some evaluation, but is lacking in quality and detail,
or is accompanied by a weaker report which does not evidence good understanding.
Perhaps you have achieved only one of the two main sections.
• An implementation in the 60-68% range should complete all parts of the specification,
consist of clean and understandable code, and be accompanied by a good report which
clearly describes the process and reasoning behind each step and contains a good discus-
sion of the achieved results including graphs and evaluation measures. You are expected
to try all tasks and have these written up but perhaps the final classification task is not
• To achieve a grade of 69% and higher, should have excellent justification and experi-
mentation into the methods used with relevant citations linking with the literature. You
must have completed all tasks (note that you are not expected to get perfect accuracy for
the segmentation or classification task).
Note that the goal is solid methodology and understanding rather than a collection of extensions – a
good scientific approach and analysis are difficult, whereas running many different algorithms
on the same data is easy. Be thorough in your solution and strengthen your basic argument
Also note that:
• We will not focus on software engineering practice and advanced Python techniques
when marking, but your code should be sensibly organised, commented, and easy to
follow. The result of your code must be in the pdf report to evidence that your code
• Overlength penalty: Scheme A, 1 mark for work that is 10% over-length, then a further
1 mark per additional 10% over. See https://www.st-andrews.ac.uk/policy/
• Lateness penalty: 5% of the maximum available mark per 24-hour period, or part thereof.
• Details for good academic practice are outlined on the University webpages here: https:
• For more details on Graduate School penalties, extension request etc, please refer to