3

Background

I'm trying to calculate the added path length (APL) metric used in segmantic segmentation for radiotherapy treatment planning. The metric originated in this paper but I can't find any explanation on how to calculate it, just the following figure that indicates shape A (black), and the surface edits (dotted yellow lines) required to create shape B:

added path length

Currently I'm calculating this metric by summing all the surface pixels that are in shape B, but not in shape A (similar to this) and multiplying by pixel width (assuming isometric pixels) to obtain a value in mm. I've also added a tolerance parameter that allows some deviation between surfaces of shape A and B before considering the surface as "edited".

Questions

  1. Any good references for how the original authors calculated this metric?
  2. Any thoughts on going from voxel to mm version of this metric?
clarkbab
  • 31
  • 5

1 Answers1

1

I had the same problem, and implemented a version of the APL metric in platipy. The code is available here. This is open-source Python code.

$ pip install platipy

(Note - you may have to update pip with pip install -U pip if you get errors).

from platipy.imaging.label.comparison import compute_metric_total_apl

compute_metric_total_apl(label_A, label_B, distance_threshold=3)

This will return the (total) APL in millimetres. You may also find the function compute_metric_mean_apl useful, which computes the slice-wise averaged APL.

You may notice the added variable distance_threshold. If the two contours are closer than this distance, they are considered identical. It is used to make the APL more sensitive to true differences (i.e. ignore negligible, voxel-scale variations). Just set it to zero to get the APL as per the original definition.

Robbie
  • 4,672
  • 1
  • 19
  • 24
  • Thanks Robbie! I corresponded with the authors of the original paper and their method aligns with yours except for the calculation of mm. In this instance they use pixel width and assume isotropic pixels, whereas your methods takes the average of pixel width/height. Of course these two methods are equivalent when pixels are isotropic which has been the case for all images I've worked with. – clarkbab Dec 21 '22 at 01:31