Giter Club home page Giter Club logo

Comments (6)

lassoan avatar lassoan commented on June 18, 2024

While adding a segment on an empty segmentation, show 3D is always disabled (even if it was enabled previously)

"Show 3D" toggle is a shortcut for "Create/delete closed surface representation". Therefore, you cannot have a segmentation without segments that has closed surface representation.

add segment -> paint in slide -> enable Show 3D -> undo.
This undos the paint-stroke but "Show 3D" is still enabled

This is the expected behavior. This is so because the segmentation contains a closed surface representation (even if it is currently does not contain any points).

Then redo brings back the paint-stroke and it's also shown in 3D. This could be considered fine, normal behavior

This is the expected behavior. Redo is supposed to restore the previous state.

add segment -> paint in slide -> paint in slide -> enable Show 3D -> undo
This makes the first paint-stroke disappear from the 3D view even though the Show 3D button is enabled

This is the expected behavior. Redo is supposed to restore the previous state. The state includes the available representations.

add segment -> paint in slide -> paint in slide -> enable Show 3D -> undo -> enable show 3D (click the button twice because there is a bug)

This is indeed a GUI bug - the Show 3D button should be unchecked. -> #7246

You lose the second paint-stroke from the segmentationHistory even though the 3D mesh is not the master representation

This is the expected behavior. If you make any change to the segmentation (change includes the list of avaialble representations) then all future states are deleted.


Overall, everything works as intended (except the small GUI bug that will be fixed).

Probably the source of confusion is that the "show" button text suggests that the button just adjusts some display property, which does not affect the state of the segmentation. However, clicking "Show 3D" actually means "create closed surface representation so that the segmentation can be displayed in 3D" and as such it is modifying the segmentation data, not just its display properties. I don't think we would want to change how things work under the hood, so if you find the current behavior confusing then we should improve text in GUI and/or documentation.

from slicer.

mauigna06 avatar mauigna06 commented on June 18, 2024

Below is another problem, that may be related?

import SampleData
volumeNode = SampleData.SampleDataLogic().downloadSample("CTChest")

######### Go to segment editor ################

segmentationNode = getNode('Segmentation')

def printRepresentationModified(caller,event):
    print("RepresentationModified")

def printSegmentModified(caller,event):
    print("SegmentModified")


tagRepresentationModified = segmentationNode.AddObserver(
    segmentationNode.GetSegmentation().RepresentationModified,
    printRepresentationModified
)

tagSegmentModified = segmentationNode.AddObserver(
    segmentationNode.GetSegmentation().SegmentModified,
    printSegmentModified
)

After creating a segment, click show3D (to enable), it will print:

RepresentationModified
SegmentModified

click show3D again (to disable), it will print:

SegmentModified

I use RepresentationModified event to handle my own undo/redo segment editor logic but the asymmetric behavior makes it not work. Would you consider the above example a bug or should I just rewrite some of my logic?

from slicer.

lassoan avatar lassoan commented on June 18, 2024

RepresentationModified is invoked when there is a representation with modified content. This happens when you create a representation but not when you delete it (because the representation no longer exists). If you want to know when a representation is added or removed then you can observe this event:

/// Invoked if a representation is created or removed in the segments (e.g., created by conversion from master).
ContainedRepresentationNamesModified,

from slicer.

lassoan avatar lassoan commented on June 18, 2024

I use RepresentationModified event to handle my own undo/redo segment editor logic

Why the built-in logic does not work for you? Could it be improved?

from slicer.

mauigna06 avatar mauigna06 commented on June 18, 2024

If you want to know when a representation is added or removed then you can observe this event:

/// Invoked if a representation is created or removed in the segments (e.g., created by conversion from master).
ContainedRepresentationNamesModified,

I'll check

from slicer.

mauigna06 avatar mauigna06 commented on June 18, 2024

I use RepresentationModified event to handle my own undo/redo segment editor logic

Why the built-in logic does not work for you? Could it be improved?

We just have a very simplified segment editor interface with low ui button count. Each step has particular masking configuration or may execute several "normal" segmentation effects on a chain. Then the undo/redo buttons in our GUI have to have in mind this

Hope it's useful feedback :)

from slicer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.