Page MenuHomePhabricator

UpdateStatusBar duplicates business logic
Closed, ResolvedPublic

Description

Currently the UpdateStatusBar method in QmitkImageNavigatorView and in mitkDisplayInteractor mitkDisplayActionEventBroadcast duplicate a lot of business logic. The part of the function that extracts the pixel value from the image and updates the statusbar is the same. The redundant part should be extracted and be put in one function that can be called by both (QmitkImageNavigatorView::UpdateStatusBar() and mitkDisplayInteractor::UpdateStatusBar() mitkDisplayActionEventBroadcast::UpdateStatusBar().
Similar code is also used inside StdMultiWidget::HandleCrosshairPositionEventDelayed, where the image / pixel information is extracted and passed onto mitkStatusBar.

Revisions and Commits

rMITK MITK
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

The GetTopLayerNode has been moved to the data storage as FindTopmostVisibleNode.
Would it be reasonable to move the UpdateStatusBar functionality to the data storage as well, as it needs to extract image information from the topmost visible node?
Or is there some other place for this kind of image geometry processing?

Would it be reasonable to move the UpdateStatusBar functionality to the data storage as well

No, I don't think so. It is not job of the DataStorage to update the status bar.

Or is there some other place for this kind of image geometry processing?

UpdateStatusBar is not just image geometry processing.
Why not put it in mitkStatusBar.h? E.g. as global public method or put it into a mitkStatusBarHelper
I think both ways are more appropriate then putting it into the DataStorage or its files.

We do not need to move the whole functionality to the data storage, just the geometry processing part. The rest can be put somewhere else, but https://phabricator.mitk.org/D14 said, It was decided that the status bar should not be responsible for extracting information from an image.

So basically I was thinking about a function inside the data storage that would do the image processing and the compute / return the needed parameters to call DisplayImageInfo.

We do not need to move the whole functionality to the data storage, just the geometry processing part.

What do you exactly mean with geometry processing part? Does "to the storage" mean, into the class or into the file?

The rest can be put somewhere else, but https://phabricator.mitk.org/D14 said, It was decided that the status bar should not be responsible for extracting information from an image.

Please take care. I never said it should be part of the class StatusBar. I proposed that it should be a global public method in the header file mitkStatusBar.h. Thats a big difference in terms of dependencies etc.

So basically I was thinking about a function inside the data storage that would do the image processing and the compute / return the needed parameters to call DisplayImageInfo.

If you plan any rework, please keep T25043: Remove pixel informations from the statusbar and put it into views in mind. As discussed there the pixel information should not be in the status bar at all and is very use case, application specific.

kislinsk triaged this task as Wishlist priority.Nov 7 2018, 8:43 AM
kislinsk edited projects, added MITK; removed MITK (2018-04).
kalali added a revision: Restricted Differential Revision.Jul 12 2022, 3:13 PM

In combination with the child task I added a first part of the tasks in D686.
The UpdateStatusBar-functions (and HandleCrosshairPositionEventDelayed-function) are completely removed and a simple function has been added to dynamically write the pointer position / world position and the global time to the status bar.

More changes will be uploaded to show an example of how image pixel information could be added to the renderer as an overlay or how a specific image pixel info widget / view could look like.

kalali edited projects, added MITK (v2022.10); removed MITK.