Skip to content
asch99 edited this page Sep 13, 2018 · 2 revisions

QC Generic OCR Module

Summary

This module uses OCR to extract text from images of any modality. There is no specific analysis in this module; it just extract the text in a given boundary box, and optionally removes a prefix and suffix before converting it to the specified type of data.

Status

Released.

Dependencies

Packages (apt/yum)

  • tesseract-ocr
  • tesseract-ocr-eng

Packages (pip)

  • pillow
  • numpy
  • pydicom
  • scipy
  • pyocr

Acquisition protocol

Just make sure the text always appears at the same pixel coordinates in the image.

Selector

input data

The analysis module expects a dicom_instance. For RGB data, the pixel values are first converted to grayscale before analysis.

config

Two config.json files for analysis at dicom_instance level are provided. One for a Philips ultra sound machine, and one for a Siemens gamma camera. Most configs are for Philips machines. Generally each combination of tube and detector has its own config and its own selector.

The config describes 2 different actions for the module:

  • acqdatetime Extracts the correct data/time for the analysed dicom file. Does not take any parameters.
  • qc_series The actual image analysis. The parameters for this action mostly define the bounding box of the text in the image and optionally a prefix and suffix of the text in the box. In addition, the parameter "channel" specifies how to convert RGB to gray scale, and "slicenr" specifies what slice should be analyses for enhanced dicom data.

meta

As this is a generic module, no default action limits are defined.

rules

As this is a generic module, no specific rules can be recommended.

Analysis

There is no real analysis in this module. The module does have some heuristic handling of black text on a white background or white text on a black background: the top and bottom of the defined boundary box are used to determine in the pixel values should be inverted or not before analysis.

If the text inside the boundary box is -12dB and the user wants to store just the numerical value, set the suffix to "dB" and the type to "float".

Results

Sometimes the OCR makes an error. Adjusting the zoom and or the threshold might then result in better values; try to override the parameters "ocr_threshold" and "ocr_zoom".