Contour to Dso
Developer: Vignav Ramesh
Algorithm & details
Given an AIM file (in JSON format) storing an ePAD user’s manual annotations on a DICOM image series along with the aforementioned series, the contour to DSO plugin generates a multi-frame DICOM Segmentation Object (DSO) storing the segmentation masks generated from the annotations in the AIM file. Note that a multi-frame DICOM image is defined as an image whose pixel data consists of a sequential set of individual Image Pixel frames; a multi-frame image is transmitted as a single contiguous stream of pixels.
An example AIM file and the generated DSO are shown below:
The creation of the DSO involves two major steps:
(i) Generating the seg_mask array, which contains the pixel data for each segmentation mask. For each DICOM image slice, the algorithm obtains a list of tuples from the AIM file which denote the boundary points of the manual annotation. These tuples are then provided as arguments to the contains_points function of the matplotlib.Path library to generate a boolean array representing the mask bounded by the inputted points (a pixel marked “true” is part of an annotation, while a pixel marked “false” is not). The algorithm then creates a 3D array combining the individual mask arrays from each DICOM slice, excluding all empty arrays before and after the first and last arrays with at least one annotated pixel, respectively. (ii) The plugin generates a DSO object from the seg_mask array. All appropriate DICOM header values are filled, and a multi-frame object is created with seg_mask as its PixelData attribute and saved to the filename specified by the title of the lesion provided in the AIM file.
The algorithm to generate the seg_mask array is shown below:
You can pull the image with : docker pull rvignav/contour2dso
How to use in ePad