-
Notifications
You must be signed in to change notification settings - Fork 576
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
Improvements to the Terminologies module. #6975
Comments
adding this thread for discussions: https://discourse.slicer.org/t/improving-the-usability-of-terminology-module/38501
We need these changes for MorphoDepot. @cpinter will be working on these, but would be good to obtain some consensus.... @lassoan @pieper |
Also, we need a behavior for user to change the default terminology. I have part of uberon imported, but every time I try to use the terminology module in changing a segment name, I have to click on the dropdown and change it from Segmentation category and type to Uberon. At the minimum, it should remember the last terminology I interacted with. |
Another list from recent email of @muratmaga:
I just did I'd like to discuss |
@cpinter Do you want to discuss at forum, where more people might be tracking? My point is, as I understand, this selection requires a specific term to be set (like Bone, Skull, brain) from a terminology context. I am not sure why there is such a restriction. I am not going to segment always the same thing. So I will have to rename Bone (or whatever I set this to) each time I am going to do something else. From my point of view this behavior is not any different then renaming the "Segment_1", which would have been the segment name of I do not set this property, so I don't see the value. My suggestion have a terminology context selector property so that I can choose my own custom terminology or Uberon or whatever I want to follow, and it doesn't default to Slicer Segmentation Context each time I switch to Navigator. |
We typically go from free discussion on forum to more concrete discussion on GitHub (if forum discussion reaches that point in the first place), and we can post the link to this issue for those who are interested can participate. We can also mention people here who we want to be involved. But up to you!
I see that making one type the default is unnecessary and confusing in your case. In the Slicer terminology Tissue/Tissue seemed super generic, so we went with that as default. I just tried to not specify a type (leaving it at 'None'), and it worked. It caused some errors, however. See this screenshot: This selection results in this terminology attribute string:
Selecting None within your custom terminology context will do just that. If we get rid of the errors (I added way too many error messages during development, here, in segmentations, in subject hierarchy as well, to be able to debug early issues, but most of them are not needed), then I think this function is done. What do you think? Can you please try? |
OK, if this is going to facilitate making the custom terminology to be more easily used, it is fine. However, I still think the default behavior should be such that whatever I chose as the last terminology context, it should come as the active one when I open the navigator next time. I suspect this would be the expectation of the user. Particularly if people are going to have multiple custom terminologies.... |
The problem with this is that when you create a new segment, it will be assigned a default terminology, and then when you open the terminology editor, that terminology entry will be loaded. Forcing the selection of the last used terminology context is in conflict with this feature. I suggested using the default terminology entry feature, because it fulfills both requirements. |
OK, i got it now. Not to be argumentative, but wouldn't it be better to decouple this behavior? I mean what terminology context is Segment_1, Segment_2 are assigned to? |
Can you please elaborate? I'm not sure I understand. @lassoan do you have any comment to the above? Thanks! |
I am talking about the situation where I have not set up a "default terminology entry" in the Application Settings. In that situation, when I create a new segment, it gets the name Segment_1, which I believe is not part of the any terminology contexts (I might be wrong). Let's say I renamed this to Cranium from my Uberon ontology. The next blank segment I create will get a name like Segment_2, now when I rename this using Navigator, my expectation would be that Navigator will start from the last chosen context, Uberon in this as, not Slicer Segmentation Terminology. I am not sure I can describe it any more. Perhaps a zoom session would be useful. |
I guess a related question, if we set the default terminology entry None so that Uberon (or the custom terminology context of the user) is the default, what would be the Segment name generated when I initialize the segmentation and hit the "Add Segment" button. Still Segment_1 or None? |
The name is indeed that, but it does get the Tissue/Tissue terminology, even if nothing was selected explicitly before in the settings. So there is really no situation when the default terminology entry is not set up. The easiest is to go to Application Settings, choose your context, and select the None type, or a generic type if exists. I honestly don't see the difference between this, and being able to select just a context, except that adding that option would complicate things (what happens if the two are in conflict etc.).
I think this is slightly different than being able to select a default context. A possible feature to add could be that when adding a new segment, the terminology of the last added segment would be checked, and that context would de forced with None type (Edit: only if no default terminology entry is defined in settings). Would this work? I think this would be sensible, relatively clean, and would not take a huge effort. The reason I say it is sensible is that you already have a segmentation by that time, and having explicitly chosen a non-default terminology, we can assume that for the subsequent segments you want to stick to the same context.
Possibly, if my last suggestion is not appealing. However, we can be discussing here for days and days, but then when @lassoan or @pieper looks at the PR, they might have a totally different opinion, and nothing can be integrated without their consent. That's why I asked for feedback early on.
My guess is Segment_1, but need to try. |
I added a PR about the renaming behavior: |
I have been investigating the "segment selection on clicking eye" issue. I think the only way basically would be to subclass the Also, we'd need to discuss the creation of custom terminology. It is a very open question with lots of possible solutions and implementations. Do you have something in mind? |
If you don't think "segment selection on clicking eye" is a small thing, I think we have to prioritize the custom terminology due to the funding. For that, I think for starters maybe adding a "Add to my custom terminology" button to the navigator, so when I am renaming a segment and choosing a color, I click on this, and it goes into my custom terminology context. Another behavior maybe is I create an empty segmentation with multiple segments that I custom name and assign colors, then (Under segmentations module perhaps?) there is an option that says "Generate custom terminology from Segments". As you said there are many possibilities on UI. I am not sure if this is going to give you all the information you will need to create the JSON though. Another option is like a little interactive editor using the table layout in slicer, where each row is property of a term that needs to be set (color, names, unique identifier, whether symmetrical or not). And then from this file, it is possible to export a json. this is sort of similar to what we have done previously as a standalone python module. I would like this to be doable inside the Slicer though. |
Something like this: https://github.com/Imageomics/slicerMorph_JSON_generator/blob/main/test_data/terminology_test.csv Perhaps, we might be even able to use this structure to generate a color table as well? |
Thanks Murat! I'll come back with a concrete suggestion soon.
What do you think of this? |
I tried a simple thing based on this forum thread (setting the |
Eye icon@cpinter If we add a widget (such as a pushbutton with custom icon to show the eye) in the table then I think it will not change the item selection. See for example in the table view in the Tables module: 2024-10-09_09-37-43.mp4Since this issue is not related to terminology, it would be better to spin this out to a separate github issue and discuss it further there. Terminology editing@muratmaga Would it help if users could create/edit/combine terminology files in standard .csv file format in Excel? We would use this simple "color table with terminology" labels.csv file format for deep learning segmentation models in Slicer (MONAIAuto3DSeg, TotalSegmentator already bought in) and several other key developers from various packages support the idea, too.
Since this is a color table, it will be editable in Colors module in Slicer - entries can be added/removed/modified using GUI. We could improve this with more features, such as copy/move entries from other color tables, cut/copy/paste clipboard operations. We could also add a "Export segments to color table" feature very easily, which would export current segments to a color table. Allowing the current segmentation to be used as a template for new segmentations. We could also make the terminology selector widget support selection of color table nodes (which could be implemented by generating terminology json from the color table node; since color tables are not modified frequently, it would not need to be regenerated often, and since color tables usually contain only up to a few hundred items, regeneration would be very fast anyway): |
Thanks Andras! Just quickly regarding this
there is an issue: #5290 I'll digest the other topic a bit more. What I've been thinking along was right-clicking a type, and adding entries to a temporary terminology that could be edited/exported in the Terminologies module (which is really not useful at the moment). |
@lassoan that's exactly what we are doing right now with our python module I linked above. We trimmed the fields to a minimum (since most everything else is fixed from our perspective) This works, and probably is the way to go for creating/editing larger custom terminologies. But what about a situation where you might have 5-6 undergrads doing a segmentation for a class (or a for the PI). You want to use them the same terms, same colors etc... There really should be an easier way to achieve that.... |
Yes, this could work, but instead of modifying terminologies, we could modify a color table node (which contains terminology codes). A real-life analog could be paint in bottles -> palette -> canvas. You buy a set of bottles of paint = terminology. You then select a subset of them and put them on your palette = color table (in custom position, maybe slightly modify its color compared to the original). Then you can paint with those colors on your canvas = segmentation (again color may be slightly modified when used there). |
We do. We work with all vertebrates, not just humans and/or a few model species. UBERON is the most comprehensive cross-species anatomical ontology. Even then we have encountered issues of missing terms and such. |
We probably need some curation and structure, not sure if automatically merging with minimal check is a good idea. Maybe like a regular PR with manual review (like we are doing in morphoDepot?). Imagine everybody is checking in their own VTK rendering presets so that they can access on their new computers/lab. If we have hundreds of files to choose from that might hinder the usability. |
It might be helpful if each file is accompanied by another file with the metadata - what it is, what is its purpose, author. Otherwise I don't know how one could navigate that content. This could be JSON/Yaml, and in case of a remote file by reference it would be just JSON/Yaml with the link to the specific commit of the external file elsewhere. |
Most important changes: - Select existing color in the simple color table when opening it with an existing color - Fix loading color table from file: terminology was saved to the wrong color index Re Slicer#6975, Slicer#7593
- Move Colors widget classes into Colors module - The Colors module related widget classes have been in Libs/MRML/Widgets, but that way they cannot possibly use Terminology features. They need to be moved to the Colors module to facilitate this - Classes in Testing and DesignerPlugins folders using the moved classes have also been moved to Colors module - Remove FileName member from vtkMRMLColorNode, as it was not used (moreover, there were comments explaining why it is not used) - Move roles enum to qMRMLItemDelegate to consolidate access: Previously the qMRMLColorModel was in MRMLWidgets, but after moving it to the Colors module (so that the Color widgets have access to Terminologies widgets) the delegate did not have access to the enum. With the enum moved to the delegate now this is solved. The PointerRole was deleted from the enum because it was not used anywhere. - Create terminology editor widgets for editing from item delegate - Get and set model data correctly in the new item delegate - Add functions to color node for get/set terminology as/from string (also add GetColorNameAutoGenerated) - Make coded entries in color property struct in color node simple pointer, and delete them in destructor - Add back PointerRole to be able to access the color node from a model item - Allow empty terminology and anatomic region context names in terminologies logic - Change CSV column separator to underscore - Style fixes Re Slicer#6975, Slicer#7593
- Select terminology from navigator widget works from terminology column in Colors module - Improve terminology editor layout - Save terminology columns into color table CSV file - Implement color table terminology CSV reading - Simplify terminology editor widget layout: instead of collapsible groups use simple grid layout with all fields always visible. - Terminology contexts from color nodes are offered in selector - Simplify color table terminology loading - Set color from terminology editor to color table Re Slicer#6975, Slicer#7593
- When opening the terminology selector (navigator), the terminology contexts containing the given terminology entry are found, first among the last selected terminology contexts (last selected searched first), then among all. The first of the resulting list is selected (i.e. the last selected terminology context that contains the given category/type/modifier) - Fix bug with color table terminology generation. Now existing terminologies are always overridden by the newly generated ones. This way as we keep adding new terminology entries in the color table, it keeps being updated in the terminology selector. Re Slicer#6975, Slicer#7593
- Improve color terminology text to have the format ": , in , ". Create static function in color model so that the same string can be easily generated from the model and the delegate - Move the color model back to MRMLWidgets as preparation for showing simple color table in terminology selector for color tables - Fix warnings Re Slicer#6975, Slicer#7593
- If selected terminology context is a color table, then instead of showing the category/type/etc terminology selector, show a simple color table - Add qMRMLSimpleColorTableView to serve as mentioned simple color table view. It is not editable, and only shows the color, label, and terminology columns. Does not show rows where the terminology is "(none)" - Fix non-windows build error Re Slicer#6975, Slicer#7593
Most important changes: - Select existing color in the simple color table when opening it with an existing color - Fix loading color table from file: terminology was saved to the wrong color index Re Slicer#6975, Slicer#7593
- Move Colors widget classes into Colors module - The Colors module related widget classes have been in Libs/MRML/Widgets, but that way they cannot possibly use Terminology features. They need to be moved to the Colors module to facilitate this - Classes in Testing and DesignerPlugins folders using the moved classes have also been moved to Colors module - Remove FileName member from vtkMRMLColorNode, as it was not used (moreover, there were comments explaining why it is not used) - Move roles enum to qMRMLItemDelegate to consolidate access: Previously the qMRMLColorModel was in MRMLWidgets, but after moving it to the Colors module (so that the Color widgets have access to Terminologies widgets) the delegate did not have access to the enum. With the enum moved to the delegate now this is solved. The PointerRole was deleted from the enum because it was not used anywhere. - Create terminology editor widgets for editing from item delegate - Get and set model data correctly in the new item delegate - Add functions to color node for get/set terminology as/from string (also add GetColorNameAutoGenerated) - Make coded entries in color property struct in color node simple pointer, and delete them in destructor - Add back PointerRole to be able to access the color node from a model item - Allow empty terminology and anatomic region context names in terminologies logic - Change CSV column separator to underscore - Style fixes Re Slicer#6975, Slicer#7593
- Select terminology from navigator widget works from terminology column in Colors module - Improve terminology editor layout - Save terminology columns into color table CSV file - Implement color table terminology CSV reading - Simplify terminology editor widget layout: instead of collapsible groups use simple grid layout with all fields always visible. - Terminology contexts from color nodes are offered in selector - Simplify color table terminology loading - Set color from terminology editor to color table Re Slicer#6975, Slicer#7593
- When opening the terminology selector (navigator), the terminology contexts containing the given terminology entry are found, first among the last selected terminology contexts (last selected searched first), then among all. The first of the resulting list is selected (i.e. the last selected terminology context that contains the given category/type/modifier) - Fix bug with color table terminology generation. Now existing terminologies are always overridden by the newly generated ones. This way as we keep adding new terminology entries in the color table, it keeps being updated in the terminology selector. Re Slicer#6975, Slicer#7593
- Improve color terminology text to have the format ": , in , ". Create static function in color model so that the same string can be easily generated from the model and the delegate - Move the color model back to MRMLWidgets as preparation for showing simple color table in terminology selector for color tables - Fix warnings Re Slicer#6975, Slicer#7593
- If selected terminology context is a color table, then instead of showing the category/type/etc terminology selector, show a simple color table - Add qMRMLSimpleColorTableView to serve as mentioned simple color table view. It is not editable, and only shows the color, label, and terminology columns. Does not show rows where the terminology is "(none)" - Fix non-windows build error Re Slicer#6975, Slicer#7593
Most important changes: - Select existing color in the simple color table when opening it with an existing color - Fix loading color table from file: terminology was saved to the wrong color index Re Slicer#6975, Slicer#7593
…aming - The name auto-generated from the selected terminology was not set to the color unless the user clicked the reset buttons. Now that section is hidden from the terminology navigator when opening from terminology editor from color table, and there is a new checkbox in terminology editor whether to use the auto-generated name/color (also shown in widget) or keep the original one and only actually set the terminology - Sometimes "in" was added to generated name even when there was no valid region. Now instead of only checking the pointer of the region object, it also checks validity. It is done by a new function in the entry that checks the three mandatory fields in the coded entry Re Slicer#6975, Slicer#7593
- Move Colors widget classes into Colors module - The Colors module related widget classes have been in Libs/MRML/Widgets, but that way they cannot possibly use Terminology features. They need to be moved to the Colors module to facilitate this - Classes in Testing and DesignerPlugins folders using the moved classes have also been moved to Colors module - Remove FileName member from vtkMRMLColorNode, as it was not used (moreover, there were comments explaining why it is not used) - Move roles enum to qMRMLItemDelegate to consolidate access: Previously the qMRMLColorModel was in MRMLWidgets, but after moving it to the Colors module (so that the Color widgets have access to Terminologies widgets) the delegate did not have access to the enum. With the enum moved to the delegate now this is solved. The PointerRole was deleted from the enum because it was not used anywhere. - Create terminology editor widgets for editing from item delegate - Get and set model data correctly in the new item delegate - Add functions to color node for get/set terminology as/from string (also add GetColorNameAutoGenerated) - Make coded entries in color property struct in color node simple pointer, and delete them in destructor - Add back PointerRole to be able to access the color node from a model item - Allow empty terminology and anatomic region context names in terminologies logic - Change CSV column separator to underscore - Style fixes Re Slicer#6975, Slicer#7593
- Select terminology from navigator widget works from terminology column in Colors module - Improve terminology editor layout - Save terminology columns into color table CSV file - Implement color table terminology CSV reading - Simplify terminology editor widget layout: instead of collapsible groups use simple grid layout with all fields always visible. - Terminology contexts from color nodes are offered in selector - Simplify color table terminology loading - Set color from terminology editor to color table Re Slicer#6975, Slicer#7593
- When opening the terminology selector (navigator), the terminology contexts containing the given terminology entry are found, first among the last selected terminology contexts (last selected searched first), then among all. The first of the resulting list is selected (i.e. the last selected terminology context that contains the given category/type/modifier) - Fix bug with color table terminology generation. Now existing terminologies are always overridden by the newly generated ones. This way as we keep adding new terminology entries in the color table, it keeps being updated in the terminology selector. Re Slicer#6975, Slicer#7593
- Improve color terminology text to have the format ": , in , ". Create static function in color model so that the same string can be easily generated from the model and the delegate - Move the color model back to MRMLWidgets as preparation for showing simple color table in terminology selector for color tables - Fix warnings Re Slicer#6975, Slicer#7593
- If selected terminology context is a color table, then instead of showing the category/type/etc terminology selector, show a simple color table - Add qMRMLSimpleColorTableView to serve as mentioned simple color table view. It is not editable, and only shows the color, label, and terminology columns. Does not show rows where the terminology is "(none)" - Fix non-windows build error Re Slicer#6975, Slicer#7593
Most important changes: - Select existing color in the simple color table when opening it with an existing color - Fix loading color table from file: terminology was saved to the wrong color index Re Slicer#6975, Slicer#7593
…aming - The name auto-generated from the selected terminology was not set to the color unless the user clicked the reset buttons. Now that section is hidden from the terminology navigator when opening from terminology editor from color table, and there is a new checkbox in terminology editor whether to use the auto-generated name/color (also shown in widget) or keep the original one and only actually set the terminology - Sometimes "in" was added to generated name even when there was no valid region. Now instead of only checking the pointer of the region object, it also checks validity. It is done by a new function in the entry that checks the three mandatory fields in the coded entry Re Slicer#6975, Slicer#7593
Is your feature request related to a problem? Please describe.
Currently both in Data module and segment editor double clicking the segment name allows renaming the segment in place. Clicking the color of the segment bring the Terminologies window, in which the name of the segment can also be changed. This is a confusing behavior and not conducive to using the terminologies more frequently.
Describe the solution you'd like
Now that Terminologies module is seeing some improvement, to encourage its usage I suggest changing the renaming behavior in segment editor. See discussion here. https://discourse.slicer.org/t/terminologies-questions/27384/11?u=muratmaga
The text was updated successfully, but these errors were encountered: