Image preprocessing for deep learning based segmentation - cerr/CERR GitHub Wiki

The available pre-processing options for building and deploying deep learning-based segmentation models are described below.

A. Resampling

CERR's image pre-processing pipeline supports resampling to smoothly interpolate images to the voxel resolution (in cm) specified by the user through any of the following methods: sinc, linear, cubic, spline, makima, nearest.

B. Cropping

The following cropping methods are supported: "crop_fixed_amt","crop_to_bounding_box", "crop_to_bounding_box_2d", "crop_to_str", "crop_to_str_2d", "crop_around_center", "crop_around_structure_center", "crop_around_center_of_mass", crop_pt_outline", "crop_pt_outline_2d", "crop_sup_inf", and "none" (default).

  • Examples

    • crop_fixed_amt : Crop to user-input extents (row_start, row_end, column_start, column_end, slice_start, slice_end).
Original image Crop by fixed amount [100,400, 50,450]
  • crop_to_bounding_box : Crop to bounding box enclosing one the structures to be segmented. Bounding box extents are computed from 3D mask (uniform across slices).
  • crop_to_bounding_box_2d : Crop to bounding box enclosing one the structures to be segmented. Bounding box extents are computed on each slice.
Original image Crop to bounding box around parotid gland
  • crop_to_str : Crop to bounding box enclosing any available structure. Bounding box extents are computed from 3D mask (uniform across slices).
  • crop_to_str_2d : Crop to bounding box enclosing any available structure. Bounding box extents are computed on each slice.
Original image Crop to bounding box around lungs
  • crop_around_center : Crop by user-input margin from the center of the image.
Original H&N CT image Crop around center
  • crop_around_structure_center : Crop by user-input margin from the center of the specified structure.

  • crop_pt_outline : Automatically extract patient outline and crop to bounding box. Bounding box extents are computed from 3D mask (uniform across slices).

  • crop_pt_outline_2d : Automatically extract patient outline and crop to bounding box. Bounding box extents are computed on each slice.

Original H&N CT image Crop to bounding box around patient outline
  • crop_sup_inf : Restrict superior & inferior extents based on user-input structure mask.

Multiple cropping operations can be chained by providing a list of cropping operations(to be applied sequentially) and associated operators (union, intersection).

C. Resizing

CERR supports resizing images through any of the following methods:

  • none : No resizing (default).
  • pad2d : Pad with zeros around the bounding box computed on each slice. Used with 2D (slice-wise) crop options.
  • pad3d : Pad with zeros around the bounding box computed across slices.
  • unpad2d : Crop to dimensions specified for each slice.
  • unpad3d : 3D crop to input dimensions.
  • padorcrop3d : Crop input or pad with zeros based on desired output diimensions
  • padorcrop2d : Crop input or pad with zeros based on desired output diimensions. Used with 2D (slice-wise) crop options.
  • padslices : Append scan array with all-zero slices.
  • unpadslices : Retain first 'n' (user-input) slices.
  • By interpolation (2D/3D) using 'bilinear', 'bicubic' , or 'sinc' methods Note: To resize by padding, the input image dimensions (following cropping, if selected) are required to be smaller than the target dimensions.

D. Transforming image orientation

Images may be exported in axial, sagittal or coronal orientations as specified through the "view" field.
Note: Input scans are assumed to have axial orientation.

E. Populating image channels

The pre-processing pipeline can be used to generate single or multi-channel images. Channels are specified as a list, where each element contains "imageType" and "slice" information. The imageType field can be used to populate a given channel with texture maps generated from the original scan by applying any of the supported image filters. The slice field can be used to generate multi-channel images by repeating a slice across all channels, or by populating the channels with some combination of previous, current and subsequent slices (e.g. to generate 2.5D images).

  • Examples

  • Configuration for single channel output

    • With original image (default)
      "channels": {"imageType":"original", "slice":"current"}
    • With image texture
      "channels": {"imageType":{"Wavelets":{"Wavelets":"Coif", "Index":"1", "Direction": "HLH"}}, "slice":"current"}
  • Configuration for multi-channel output

    • 2.5D
      "channels": [{"imageType":"original", "slice":"current-1"},
      {"imageType":"original", "slice":"current"},
      {"imageType":"original", "slice":"current+1"}]
    • Combination of original and derived images (same slice)
      "channels": [{"imageType":"original", "slice":"current"},
      {"imageType":{"Wavelets":{"Wavelets":"Coif", "Index":"1", "Direction": "HLH"}},
      "slice":"current"}]

Configuring pre-processing parameters

Pre-processing parameters are defined through JSON-format configuration files.