Slicer icon indicating copy to clipboard operation
Slicer copied to clipboard

Creating a nested subject hierarchy breaks cloning

Open muratmaga opened this issue 1 year ago • 13 comments

Summary

When a data object (e.g., pointlist) is nested under another data object, cloning functionality get completely broken (whether nested or not). This happens on Slicer r32267 on intel silicon mac

Steps to reproduce

in a fresh scene download MRHead. See that you can successfully clone it by right click in Data module and choosing clone. Create a pointlist with a single point and drag it under cloned MRhead node. Now try to clone any object in the data scene, and notice the pasted error.

Reproduces consistently.

Switch to module:  "Data"
GetItemName: Failed to find subject hierarchy item by ID 31


GetItemName: Failed to find subject hierarchy item by ID 31


virtual QStandardItem *qMRMLSubjectHierarchyModelPrivate::insertSubjectHierarchyItem(vtkIdType, int) : Item mismatch when inserting subject hierarchy item with ID  38

muratmaga avatar Nov 03 '23 04:11 muratmaga

I followed the described steps in Slicer 5.5.0-2023-10-10 (r32228) and I was able to clone each item in the scene after the parenting, and there were no errors at all. Same thing with Slicer 5.5.0-2023-10-30 r32252.

I tried it on Windows, but I don't see why it should be different on Mac. However, if someone has Mac please try to reproduce.

cpinter avatar Nov 03 '23 10:11 cpinter

Often these strange errors are related to SlicerMorph customizations. In this case, maybe it is due to enabling undo/redo.

lassoan avatar Nov 03 '23 11:11 lassoan

I couldn't reproduce on mac with 5.4 (no SlicerMorph customizations).

pieper avatar Nov 03 '23 11:11 pieper

Often these strange errors are related to SlicerMorph customizations. In this case, maybe it is due to enabling undo/redo.

I don't think I have the SlicerMorph installed on it, since I was testing the lights. but will double check.

muratmaga avatar Nov 03 '23 15:11 muratmaga

I also tested it with 5.5.0-2023-11-02 r32276, and there were no issues. Just wanted to confirm that this is not something very recent affecting all platforms.

cpinter avatar Nov 03 '23 15:11 cpinter

I am seeing the error and warning in a recent slicer with slicermorph customizations but cloning still works. Likely an issue on our side. Thanksnfor checking

muratmaga avatar Nov 03 '23 15:11 muratmaga

Maybe also check if it can be reproduced after you work with some data and then close the scene. Maybe cleanup of the scene has some problems.

lassoan avatar Nov 03 '23 16:11 lassoan

Re-opening the issues, as it turns out not related to nestedness or any extension, but the object. In current stable or previews on mac, cloning does not work model or markup data objects. In a fresh install, create a single pointList and try to clone.

Session start time .......: 2023-11-06 21:17:40
Slicer version ...........: 5.4.0 (revision 31938 / 311cb26) macosx-amd64 - installed release
Operating system .........: macOS / 12.7 / 21G816 / UTF-8 - 64-bit
Memory ...................: 16384 MB physical, 2048 MB virtual
CPU ......................: GenuineIntel Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz, 8 cores, 16 logical processors
VTK configuration ........: OpenGL2 rendering, Sequential threading
Qt configuration .........: version 5.15.8, with SSL, requested OpenGL 3.2 (core profile)
Internationalization .....: disabled, language=es_419
Developer mode ...........: enabled
Application path .........: /Applications/Slicer.app/Contents/MacOS
Additional module paths ..: (none)
Scripted subject hierarchy plugin registered: SegmentEditor
Scripted subject hierarchy plugin registered: SegmentStatistics
Switch to module:  "Data"
Populating font family aliases took 160 ms. Replace uses of missing font family ".AppleSystemUIFont" with one that exists to avoid this cost. 
CreateHierarchyItem: Failed to find parent subject hierarchy item by ID 0


void qSlicerSubjectHierarchyCloneNodePlugin::cloneCurrentItem() : Failed to clone subject hierarchy item (ID: 3 , name: Scene )

muratmaga avatar Nov 07 '23 05:11 muratmaga

I can replicate this with 5.4 and with my local build on mac. Trying to clone a markup in a fresh start of Slicer fails, but if I download MRHead sample data the clone operation succeeds. Oddly, the same operation succeeds on 5.4 on linux without needing to have other data loaded.

pieper avatar Nov 07 '23 13:11 pieper

Using Slicer 5.4.0 and Slicer 5.5.0-2023-11-04 on Windows, starting Slicer, creating a point list with a single defined point and then cloning it is successful.

Based on the above comments it appears this issue is unique to macOS?

jamesobutler avatar Nov 07 '23 13:11 jamesobutler

Trying to clone a markup in a fresh start of Slicer fails, but if I download MRHead sample data the clone operation succeeds.

You mean you can clone a markup or a model node after you have a volume loaded in the scene? In my case, it doesn't matter whether there is a volume on the scene or not. I can clone volumes and segmentations, but not markups or models.

yes, I think this is mac specific. i don't have the issue on the linux or windows.

muratmaga avatar Nov 07 '23 15:11 muratmaga

You mean you can clone a markup or a model node after you have a volume loaded in the scene?

Yes, for me starting Slicer fresh and adding a markup, the markup cannot be cloned.

After adding a volume or even another markup then the cloning works.

pieper avatar Nov 07 '23 16:11 pieper

By the way this error is persisting in the new stable 5.6 on macos. There is this message in the log file with tag critical: virtual QStandardItem *qMRMLSubjectHierarchyModelPrivate::insertSubjectHierarchyItem(vtkIdType, int) : Item mismatch when inserting subject hierarchy item with ID 17

muratmaga avatar Nov 29 '23 04:11 muratmaga