View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003911 | Slicer4 | Core: Base Code | public | 2014-12-02 09:43 | 2018-03-02 11:07 |
Reporter | lauren | Assigned To | alexy | ||
Priority | normal | Severity | crash | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | Slicer 4.4.0 | ||||
Target Version | Fixed in Version | Slicer 4.5.0-1 | |||
Summary | 0003911: Toggle hierarchy visibility causes crash | ||||
Description | In Slicer 4.4.0 Dec 1 nightly, toggling visibility of a hierarchy containing fiber bundles causes an immediate crash. This is on Mac 10.9.5. Steps to reproduce:
Test data: | ||||
Additional Information | MAC crash report: Date/Time: 2014-12-02 14:21:47.630 -0500 Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) VM Regions Near 0: Thread 0 Crashed:: Dispatch queue: com.apple.main-thread Thread 1:: Dispatch queue: com.apple.libdispatch-manager Thread 2: Thread 3: Thread 4: Thread 5:: ctkFDHandler Thread 6:: ctkFDHandler Thread 7: Thread 8:: QThread Thread 9: Thread 10:: QKqueueFileSystemWatcherEngine Thread 11:: QProcessManager Thread 12:: com.apple.CFSocket.private Thread 13: Thread 14: Thread 15: Thread 16: Thread 0 crashed with X86 Thread State (64-bit): Logical CPU: 6 Binary Images: | ||||
Tags | No tags attached. | ||||
Reminder sent to: alexy, nicole, pieper Hi Alex, Is it something Alex could look at ? Thanks |
|
This is actually caused by changes in SubjectHierachy module. When you load any model of fiber it now adds itself to the SubjectHierarchy (this is happening in the qSlicerSubjectHierarchyModule::onNodeAdded() method) However vtkMRMLSubjectHierarchyNode is not derived from vtkMRMLDisplayableHierarchyNode, and the logic for setting visibility does assume that. I can fix this assumption so that the code does not crash, but I don't know if it is a good idea to have all models be a part of SubjectHierarchy by default. Csaba should comment on this. |
|
Please note that this happens with MODELs as well. It is not specific to fiber bundles or diffusion. I tested that at the end of writing the bug report, and did not change the original title. So this is a very basic Slicer crash. |
|
Reminder sent to: pinter Hi Csaba, Could you comment on Alex point ? Thanks |
|
In vtkMRMLModelHierarchyLogic:290 SafeCast is done, but the result is not checked. It should be checked if it's not NULL. I made a point not to involve Subject hierarchy in the other hierarchies, this is why I came up with the concept of "nested hierarchy", Jc you may remember. It was necessary to create SH nodes for supported data nodes in order to make SH actually usable, as the users didn't know that they have to "add" nodes into the hierarchy, and it just seemed to be not working. I don't think a simple bug like this means that it was a bad decision. We just have to fix the bug. |
|
Fixed crash on change of visibility of ModelHierarchy nodes introduced by making them part of SubjectHierarchy. At revision: 23813 However, if all Model/Fiber nodes are part of SubjectHierarchy now should vtkMRMLSubjectHierarchyNode be derived from vtkMRMLDisplayableHierarchyNode not from vtkMRMLHierarchyNode as it is today? |
|
If you call GetAssociatedChildrenNodes or GetChildrenModelNodes instead of GetAllChildrenNodes, then it will work fine. It will mean using a vtkCollection instead of an std::vector |
|
It used to be a displayable hierarchy node back in the day, which caused issues in Data module etc (as far as I remember). I was also specifically asked not to mix SH with the other hierarchies, so I'd say let's keep it separate, so that users who want to use Data, Models, etc. can use those. I was asked to help create a DTI tracts plugin in SH so that the fiber bundles can be handled in a very similar way. That way the user could use this feature from both places. I don't know anything about fiber bundles so I'd appreciate if someone could get me started. Apparently there are bugs, sorry about that! Btw there are too many GetChildren'ish methods in the hierarchies and it's very easy to get lost. For example I don't really know the difference between GetChildren, GetAllChildren, and GetAssociatedChildrenNodes. Maybe they just need better names, but there's an ambiguity whether a function returns the hierarchy nodes (because only those can be actual children of hierarchy nodes), or the associated data nodes. |
|
@alexy: I just ese your commit message. Let's make it clear that ModelHierarchy is not just not part of SubjectHierarchy, but should be independent. |
|
I agree that SubjectHierarchy should be separate hierarchy. However each link in hierarchy contains two Hierarchy nodes one associated with the "data" node (1) and a hierarchy parent node it points to (2). Node (2) represents logical hierarchy like Models, Transforms, etc. Node (1) represents just a link to a parent and also defines common visualization parameters: visibility color, etc. That is why node (1) is better be a vtkMRMLDisplayableHierarchy. Subject Hierarchy module creates (1) as vtkMRMLSubjectHierarchyNode which I am not sure is a good idea, while (2) I agree should be a vtkMRMLSubjectHierarchyNode and does not need to be a vtkMRMLDisplayableHierarchy. |
|
Hi Alex, |
|
Does this last part about auto-creation of nested associations sound like a good idea? |
|
I see now that the model nodes in a model hierarchy are indeed not associated to a "leaf" hierarchy node. Alex, can you please explain how they work then? |
|
I confirmed that not just this but more issues are caused by SH in Models. I'm going to apply two fixes. First I'm going to disable auto SH creation by default and allow the user to turn it on when they switch to the SH module. The other fix will be more complicated, this is why I tried to get information about model hierarchy, without success so far. The model hierarchy works differently than the others, and this is why SH interferes with it. I'll need the help of the person who owns Models. Thanks! |
|
Hi Csaba, Thanks for your patience with this. I guess Alex and Nicole should be able to answer questions. @Alaex, @Nicole: Could the following page be updated with some high level info ? Thanks |
|
Thanks Jc, Actually the drawing on the link you provided is consistent with what I understood for the hierarchies, but not with reality. I'm reading the code in the hope of understanding, and found the flag vtkMRMLHierarchyNode::AllowMultipleChildren which is only used in some scene models for allowing or not allowing drops, but nothing more. The drawing should reflect that hierarchy nodes allow multiple children, do NOT require an explicit hierarchy node for each leaf, and what kind of connector is used for each connection. I'm researching further and try to fix the bug. It's indeed quite important to fix and I'm on it... |
|
Committed fix This does not fix the whole issue, only if the user does not use subject hierarchy! We still need to sort out the multiple leaf thing. |
|
From the email I sent before reading this whole thread: The model hierarchy does add leaf hierarchy nodes automatically when model nodes are dragged under hierarchies, they're just hidden (hide from editor flag set to 1, the Q mrml scene model doesn't show them). It looks like this (my bad ASCII upward pointing arrows represent the parent node id on hierarchy nodes): Top level model hierarchy node (hide from editors = 0) -> no associated node id (by convention) Hierarchy nodes just point up to their parents. There are also display nodes in there, left out for an attempt at clarity. I was experimenting with double hierarchy trees for reporting (similar to what you might need for SH) and it gets very tricky because of the built in assumptions of a model node only being the associated node id for a single hierarchy node. Does that help a bit? I know that there was a picture that I took of a white board when Steve was explaining it to me at one point, but I haven't been able to dig it up yet. |
|
Also from email: "So there are leaf hierarchy nodes, just hidden from the editor. Indeed, I can see them in Data module if I check the "Show Hidden nodes" checkbox. Now that this is cleared up, I can implement my other fix that enforces nested associations (creates them for SH if a second hierarchy node associates to the data node that was also in SH)." This is very good news, means that the drawing is indeed right (sigh!). |
|
Committed fix |
|
I played around with the rulers and ROIs in the annotations module and only found one thing that wasn't working: |
|
Thanks so much, Nicole, for trying it out! I'm glad these things seem to work well now. |
|
Import 2017-06-07 23:51:09: master b7d6ed07 2014-12-09 10:35:55 Details Diff |
BUG: Fix mixing subject hierarchy with other hierarchies Two fixes have been applied. One is to enforce nested associations if there is a conflict of two hierarchy nodes associating to one data node. Reminder: Nested associations prevent the scenario when two hierarchy nodes associate to the same data node, which leads to non-determinism if GetAssociatedHierarchyNode is called. In this case instead of the connections (SH --assoc--> Model <--assoc-- ModelHierarchy), this structure is created: SH --assoc--> ModelHierarchy --assoc--> Model The other fix is to ensure reparenting to the same type of hierarchy nodes. If this proves to be too strict, then we may allow reparenting to base classes, or the alternative is to subclass the scene hierarchy model to the hierarchy types. Also a subject hierarchy bug was fixed that occurred because the widget was created when instantiating the module (which is udesirable by itself), and this caused creation of context menu actions before external plugins had the chance to register. Now the widget is not created early, but the right connections are made at the right time. Fixes 0003911 git-svn-id: http://svn.slicer.org/Slicer4/trunk@23821 3bd1e089-480b-0410-8dfb-8563597acbee |
||
mod - Libs/MRML/Widgets/qMRMLSceneHierarchyModel.cxx | Diff File | ||
mod - Modules/Loadable/SubjectHierarchy/Widgets/qMRMLSubjectHierarchyTreeView.cxx | Diff File | ||
mod - Modules/Loadable/SubjectHierarchy/Widgets/qMRMLSubjectHierarchyTreeView.h | Diff File | ||
mod - Modules/Loadable/SubjectHierarchy/qSlicerSubjectHierarchyModule.cxx | Diff File | ||
mod - Modules/Loadable/SubjectHierarchy/qSlicerSubjectHierarchyModuleWidget.cxx | Diff File | ||
mod - Modules/Loadable/SubjectHierarchy/qSlicerSubjectHierarchyModuleWidget.h | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2014-12-02 09:43 | lauren | New Issue | |
2014-12-02 09:43 | lauren | Status | new => assigned |
2014-12-02 09:43 | lauren | Assigned To | => jcfr |
2014-12-02 10:10 | jcfr | Assigned To | jcfr => alexy |
2014-12-02 10:18 | jcfr | Note Added: 0012751 | |
2014-12-02 10:43 | alexy | Note Added: 0012752 | |
2014-12-02 10:46 | lauren | Note Added: 0012755 | |
2014-12-02 10:48 | jcfr | Note Added: 0012756 | |
2014-12-02 10:58 | pinter | Note Added: 0012757 | |
2014-12-02 11:06 | alexy | Note Added: 0012758 | |
2014-12-02 11:08 | pinter | Note Added: 0012759 | |
2014-12-02 11:09 | alexy | Status | assigned => feedback |
2014-12-02 11:09 | alexy | Resolution | open => fixed |
2014-12-02 11:23 | pinter | Note Added: 0012760 | |
2014-12-02 13:15 | pinter | Note Added: 0012764 | |
2014-12-02 14:07 | alexy | Note Added: 0012765 | |
2014-12-02 15:54 | pinter | Note Added: 0012767 | |
2014-12-03 07:09 | pinter | Note Added: 0012768 | |
2014-12-03 12:21 | pinter | Note Added: 0012769 | |
2014-12-05 06:15 | pinter | Note Added: 0012771 | |
2014-12-05 07:19 | jcfr | Note Added: 0012774 | |
2014-12-05 07:33 | pinter | Note Added: 0012775 | |
2014-12-05 07:47 | pinter | Note Added: 0012776 | |
2014-12-05 08:00 | nicole | Note Added: 0012777 | |
2014-12-05 08:46 | pinter | Note Added: 0012778 | |
2014-12-09 05:55 | pinter | Note Added: 0012780 | |
2014-12-09 05:55 | pinter | Status | feedback => resolved |
2014-12-09 05:55 | pinter | Fixed in Version | => Slicer 4.4.1 |
2014-12-09 07:14 | nicole | Note Added: 0012781 | |
2014-12-09 07:25 | pinter | Note Added: 0012783 | |
2015-09-09 08:29 | jcfr | Fixed in Version | Slicer 4.4.1 => Slicer 4.5.0-1 |
2017-06-10 08:51 | pinter | Changeset attached | => Slicer master b7d6ed07 |
2018-03-02 11:07 | jcfr | Status | resolved => closed |