How to add threshold computation and make the button apply to work

Hi, everyone.

I am trying to implement a python code to create a module in 3d slicer, howevery I don’t know how to activate the button apply. Basically I have an input volume that will be 1 or 0 comparing with a threshold value, however I don’t know how to make the button apply works.

    # Apply Button
    self.apply_button = qt.QPushButton("Apply")
    self.apply_button.toolTip = "Run the algorithm."
    self.apply_button.enabled = False

It is considered a widget. How can I make it works!?

Rafael Cristo

Hi -

You need to connect the button to a callback slot. You can read through the developer tutorials for all the details.