Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Enable right-click menu for fiducials #1253

Closed
wants to merge 1 commit into from

Conversation

cpinter
Copy link
Member

@cpinter cpinter commented Nov 8, 2019

Right-clicking markups in views shows a context menu provided by subject hierarchy. The infrastructure to use the SH in-view context menu for other node types is also established.

  • Sink MenuEvent event from markups display node to display node base class
  • Display node MenuEvent handled in Subject hierarchy plugin logic. It shows a third type of SH menu called View menu, which offers actions that are applicable in the views
  • First plugin to support this is Markups that offers a menu to rename fiducial

Copy link
Contributor

@lassoan lassoan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, it looks really nice and it works well. It'll open up a lot of possibilities.

Since this feature is so powerful, there is a high chance that modules would want to customize what appears in the context menu. For example, I would add an "Edit properties..." menu item, but I guess that some modules or custom applications would not like to see this menu item. Do you have a preferred design for this? Maybe we could implement all menu items in markups plugin and use flags to configure which ones are shown. And for more customization, new plugin class (maybe derived from the default markups plugin class) for special markups could be created, which would display customized view menu (remove some too generic functions, add some application-specific ones)?

@@ -29,6 +29,8 @@ set(${KIT}_TARGET_LIBRARIES
${MRML_LIBRARIES}
)

set (${KIT}_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "" FORCE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? These include dirs should be added to cache automatically (you can see in Slicer-build\CMakeCache.txt that there are many ...ModuleLogic_INCLUDE_DIRS variables and they are not set using such code).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the markup node header could not be included in the subject hierarchy plugin cxx without this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is odd that this is needed, because even without this, my Slicer-build/CMakeCache.txt contains vtkSlicerMarkupsModuleMRML_INCLUDE_DIRS:INTERNAL=C:/D/S4/Modules/Loadable/Markups/MRML;C:/D/S4R/Slicer-build/Modules/Loadable/Markups/MRML.

It does not hurt to have this, so if you want you can go on and integrate as is, but it would be nice if you could try a clean build without this line and see if it fails.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started a clean build...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It builds. I guess then probably there are several lines of the same kind in Slicer. In any case I removed this one.
@lassoan do you have any ideas what I can do to make it build without a clean build in general? Like re-run CMake or clean build just a few projects etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think anything can replicate the behavior of a clean build.

I only saw this kind of kit include dir caching line in Subject Hierarchy plugin and maybe one more place. They seemed to be special enough that I did not check if they were still needed, but you are right that those may be removed, too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably an oversight. I suggest to remove it and if there are issues later one, I will have a look.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For development it not acceptable having to do a complete 3-5 hour clean build when making such changes in CMake. There must be some kind of way to have a successful build without either adding this line or doing a full clean build...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is really no other way if you want to be 100% sure that you test a clean build without actually doing a clean build. If you are sure that your changes only affect Slicer then you may be able to delete just the Slicer binary folder and then VTK, CTK, etc., may not need to be rebuilt.

I have additional test builds set up for things like this, so I can continue my work, while another build is running in the background.

@cpinter
Copy link
Member Author

cpinter commented Nov 11, 2019

I like all the ideas about Edit properties and also the special markup types. Since this infrastructure will most probably remain the same, I think we could go ahead and integrate this. Once we have a concrete plan to extend it, I'm happy to help.

@lassoan
Copy link
Contributor

lassoan commented Nov 12, 2019

Once we have a concrete plan to extend it, I'm happy to help.

I would recommend to have at least these actions:

  • Rename point
  • Delete point
  • Toggle select point
  • Edit properties...

Could you add them? It does not have to be in this pull request.

It would be nice to have something like "Show in subject hierarchy tree", which would switch to Data module / Subject Hierarchy tab and select the node.

@cpinter
Copy link
Member Author

cpinter commented Nov 12, 2019

OK I can add these easily. For Edit properties we can use the current infrastructure right?

@lassoan
Copy link
Contributor

lassoan commented Nov 12, 2019

OK I can add these easily. For Edit properties we can use the current infrastructure right?

yes

Right-clicking markups in views shows a context menu provided by subject hierarchy. The infrastructure to use the SH in-view context menu for other node types is also established.
- Sink MenuEvent event from markups display node to display node base class
- Display node MenuEvent handled in Subject hierarchy plugin logic. It shows a third type of SH menu called View menu, which offers actions that are applicable in the views
- First plugin to support this is Markups that offers a menu to rename fiducial
@cpinter
Copy link
Member Author

cpinter commented Nov 14, 2019

This PR has been integrated in Slicer/Slicer@771bc70

I will push a second PR with the following changes:

  • More actions for markpus (and not just for fiducial types): Rename point, Delete point, Toggle select point, Edit properties...
  • A whitelist in plugin logic for the actions so that it can be esaily customized

@cpinter cpinter closed this Nov 14, 2019
@cpinter
Copy link
Member Author

cpinter commented Nov 16, 2019

For the record, the follow-up PR: Slicer/Slicer#1262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants