Skip to content

STYLE: Refactor DataProbe for easier customization

Sam Horvath requested to merge github/fork/jcfr/jcfr-FactorizeDataProbe into master

Created by: jcfr

This PR is a collection of changes simplifying the code in the processEvent() function by introducing these functions:

  • generateViewDescription(self, xyz, ras, sliceNode, sliceLogic)
  • generateLayerName(self, slicerLayerLogic)
  • generateIJKPixelDescription(self, ijk, slicerLayerLogic)
  • generateIJKPixelValueDescription(self, ijk, slicerLayerLogic)
  • _createMagnifiedPixmap()

It is based on the original PR #335 from @Punzo. The difference is that in this PR, instead of adding a function named updateCursorPositionDisplayText that would be expected to explicitly update all DataProbe widgets, it introduces generate[...]Description() functions returning text used internally by the DataProbe. That extensions customizing the text used in the DataProbeInfoWidget are less likely to break because of refactoring associated with the DataProbeInfoWidget.

Additionally, it also removes some redundant code (eb650dd0), simplifies the DataProbeInfoWidget constructor removing the extra type parameter set to False (a9f7fbf6) and renamed function createSmall() to _createSmall() (630c7bf8)

Merge request reports

Loading