Page MenuHomePhabricator

[Segmentation] Disable "New" button when no image is selected
Open, LowPublic

Description

When no patient image is selected, the "New" segmentation button can still be clicked (but nothing happens). It would be better if it was only enabled when an image is selected, and was not clickable/"greyed out" otherwise.

Event Timeline

kompan created this task.
kislinsk renamed this task from Disable "New" button when no image is selected to [Segmentation] Disable "New" button when no image is selected.Sep 10 2020, 1:34 PM

Also, the checklist states "Er ist disabled"

Also, the "red warning" does not change back to "Please select an image" if an image is removed (which was automatically selected before).

That leads me to the question, @kompan: Does the bug only happen, after you removed a selected node or also, if no node was initially selected?

Good point! It only occurs after I have removed the image node. When I initially open the segmentation plugin, the new button still is deactivated as it should be.

I looked into it and I have the impression that there is a lot of unnecessary complexity created in order to generate a valid UI state. The problem, as far as I can see, lies in the overuse of if-statements and having functions that have way to many responsibilities. This is a typical "clean code" task and I suggest to go through the whole QmitkSegmentationView.cpp file and apply some best practices of writing clean code.
But since it is not clear how much effort we want to put into it (thinking of T28142), it might be wise to not work on this right now but to use a general refactoring task (parent task) to fix the mentioned bug.
I advise also to have a look https://phabricator.mitk.org/file/data/7bghshzurxwupnipv3dl/PHID-FILE-n2hwm6xv2mil3ola47sq/QtStateMachineFramework.pdf.

I looked into this (to be honest, I did not read Amirs last comment): I totally agree. I fixed the issue, which was not to complicated, but there is a lot of spaghetti code involved. I agree with Amirs suggestion to not fix it this way.

kleina removed kleina as the assignee of this task.Tue, Jul 6, 1:13 PM
kleina moved this task from Cycle to Segmentation on the MITK (v2021.10) board.
kleina added a subscriber: kleina.