Home-Download-Recalibrate-Pre-process-Annotate1-Annotate2-Coregister-Statistics
Annotate
This workflow is for manually adding annotations to an H&E image by drawing ROIs (regions of interest). The main function is AnnoExtract.m
and this can be run in batch mode via AnnoExtractWorkflow.m
.
Single file mode
First of all define a set of annotation labels and colours. These should be kept the same for all images within a cohort, so don’t add or remove any labels as this will produce unknown errors in statistical analysis.
The following is a simple command to generate 3 annotation labels and colours (specified as RGB vectors between 0 and 1).
myAnnotationLabels = {'Normal',[0.2 0.8 0.1];...
'Cancer',[0.8 0.4 0.4];...
'Background',[0.5 0.5 0.5]};
To annotate an image, first load it using imload
and then run the annotation function. Ensure that the 3 name/value pairs are provided as shown ('mode'
, 'init'
and 'anno'
).
% Load image
img = imread('/Path/To/Image.jpg');
%% Run annotation function
AnnoExtract(img,'mode','simple','init',false,'anno',myAnnotationLabels);
This will open a window that allows you to draw polygonal ROIs on the optical image by clicking on the coloured buttons. Regions can be removed and the image reset and saved using the grey buttons.
When finished, save the annotation file in a convenient location.
Batch file mode
AnnoExtractWorkflow.m
can be used to loop through all unannotated files without having to manually load up each image. Ensure that the following options are set in the corresponding cell:
initialEstimate = false;
annotationMode = 'simple';
You will also need to define the annotation labels, such as by adding another case
in the switch annoType
code block and setting annoType
to reflect the new case.
Once annotations have been drawn for an image, save the file and then quit. The next image will then be loaded in a loop until either all files have been completed or the process is aborted by manually closing the window.
Home-Download-Recalibrate-Pre-process-Annotate1-Annotate2-Coregister-Statistics