Module 'PythonQt.qSlicerMarkupsModuleWidgets' has no attribute 'qMRMLMarkupsROIWidget'?

Why?howto use qMRMLMarkupsROIWidget by python?

[CRITICAL][Stream] 15.09.2021 04:43:02 (unknown:0) - AttributeError: module ‘PythonQt.qSlicerMarkupsModuleWidgets’ has no attribute ‘qMRMLMarkupsROIWidget’

If trying to instantiate a reference to a qSlicerMarkupsROIWidget object you should do the following from python. Things should not be accessed through the “PythonQt” namespace. Use “slicer” instead.

roi_widget = slicer.qSlicerMarkupsROIWidget()


Where is the ROIwidget?

@lassoan Is there something wrong with qSlicer type widgets? qSlicerMarkupsROIWidget and qSlicerVolumeRenderingModuleWidget don’t appear to show anything?

When qSlicerMarkupsROIWidget was qMRMLMarkupsROIWidget prior to this commit in Slicer 4.11.20210226 it can be shown successfully.
image

In latest Slicer Preview it is just blank
image

In latest Slicer Preview it is just blank???

Good catch. We did not notice this design error during the recent markups module rework. There are several issues, I’ve summarized them in here. @RafaelPalomar is there a chance that you can work on this before finalizing Slicer5 (in the next 2 weeks or so)?

Hello. Yes I will have a look at it.

1 Like

Thank you @jumbojing, @jamesobutler and @lassoan for reporting and giving insight on this issue. Here are my findings on this issue.

The idea behind qSlicerMarkupsROIWidget (as well as other qSlicerMarkups widgets) was to make it an “optional” widget that will show only when the relevant markup is selected. This avoids filling up the Markups module interface with widgets unusable in the context of the current markup (e.g., a ROI widget does not make sense for a line markup).

Much of this behavior is driven by the qSlicerMarkupsROIWidget itself (e.g., here the widget is set invisible by default Slicer/qSlicerMarkupsROIWidget.cxx at 022a4f1a347ebb24509a50f6c8928ae26d3c5955 · Slicer/Slicer · GitHub), which makes it less usable as an independent component. I think it is possible to translate the coordination of this behavior up to qSlicerMarkupsModuleWidget widget and leave qSlicerMarkupsROIWidget as a more independent component. @lassoan, @jamesobutler, let me know your thoughts on this approach; I think I can handle this in the coming days, before the release of Slicer5.

Adding markups option widgets is good. But these widgets should not replace the reusable high-level widgets, but they should show one or more of these high-level widgets.

A post was split to a new topic: Get oriented bounding boxes for each segment

There is a PR (Refactor markups qt widgets by RafaelPalomar · Pull Request #5921 · Slicer/Slicer · GitHub) on this now.