DataElement

Class to represent a data point in the dataset with relevant features and methods

class munge.DataElement.DataElement(dicom_path, icontour_path, ocontour_path=None)

Bases: object

DataElement class can be instantiated with the following args

  • parameters, types, return and return types:
Parameters:
  • dicom_path (string) – full path of the DICOM image
  • contour_path (string) – full path of the corresponding contour file
asarray()

Returns the DataElement in the form of (data, label)

Returns:array of data and labels
get_area_in_sqmm(roi='icontour')

Gets the area of the ROI in sq.mm. The conversion is done using the PixelSpacing tag of the DICOM image.

Returns:area in sq.mm
get_image_icontour_overlay(window=30, patch_color=[255, 0, 0])

Gets a bounding box around the inner contour with and without the i-contour overlaid (horizontally stacked). This will be useful for manual verification of the annotation

Parameters:
  • window – size of bounding box required around the marked contour
  • patch_color – [r, g, b] value of the color in which the patch should be overlaid
Returns:

horizontally stacked array with left image being original and the right with the patch drawn

get_image_ocontour_overlay(window=30, patch_color=[255, 0, 0])

Gets a bounding box around the outer contour with and without the o-contour overlaid (horizontally stacked). This will be useful for manual verification of the annotation

Parameters:
  • window – size of bounding box required around the marked contour
  • patch_color – [r, g, b] value of the color in which the patch should be overlaid
Returns:

horizontally stacked array with left image being original and the right with the patch drawn

get_roi_avg_relative_intensity(roi='icontour')

Gets the relative intensity (%) of the ROI. Relative intensity is w.r.t the maximum intensity of the image

Returns:average intensity in percentage
overlay_contours(window=30, patch_colors=[[0, 0, 255], [255, 0, 0]])

Overlays both inner and outer contours for visualization

Parameters:
  • window – Bounding box window size around the ROI
  • patch_colors – Array of colors for the outer and inner contours