I would recommend to use the latest “scripteddesigner” module template. GUI state updates should be more clear now. If you have any questions about this latest template then let us know.
If you want to keep using the old template then adding a breakpoint in PyCharm execute the code step-by-step is a good way to understand what your code does (and why it is not the same what you expect).
The example shows how to run a CLI module from Python. See more information about CLI modules in general in the Slicer developer tutorials, and more details about how to run them and how to get their input/output parameters are available here. Source code of CLI modules bundled with Slicer are available here.
You can run any other processing using VTK, SimpleITK, numpy, various Slicer modules provided by extensions, and any Python packages. See a variety of examples in the script repository.
Thank you for providing the link to the code of thresholdscalarvolume module!
Is the link below where I should investigate for the algorithm of ThresholdScalarVolume?
It seems that the module does not contain any comments, and I was not able to find out how the threshold was applied.
Most CLI modules use ITK filters to process data. You can find documentation, examples, and source code by searching for the filter name on the web (e.g., itk::ThresholdImageFilter).
You can run ITK filters directly in Python using SimpleITK, which is bundled with Slicer. You can also implement trivial operations, such as image thresholding using numpy. These are all described in the PerkLab Slicer programming tutorial that I linked above.