We are in the testing stage of the entire code now. To confirm, we are running it line by line in the python interactor. The GitHub code uses an apply function(which appears to be synonymous with run the algorithm). The parameters for apply are self and ijkPoints.
Whenever we run the apply function:’
It says apply() missing 1 required positional argument: ‘ijkPoints’
Indeed, in case of this effect, which is derived from C++ effect, the syntax is slightly different, as effect refers to the C++ effect, and you need to call effect.self() to access the methods added in Python. So, a complete example:
I am sorry to bother you again. I copied all of the functions from the Local Threshold into the Python Interactor and created a segmentationNode around a pre-determined point. Then, I run this code:
segmentEditorWidget = slicer.modules.segmenteditor.widgetRepresentation().self().editor
effect.setParameter(“Minimum Threshold”, 265)
effect.setParameter(“Maximum Threshold”, 1009)
effect = segmentEditorWidget.activeEffect()
ijkPoints = vtk.vtkPoints()
ijkPoints.InsertNextPoint(world, world, world) ##world has the coordinates of the point
This gives me an error saying that “None Type” has no attribute self. I feel like we have the necessary elements to the code(many thanks to your GitHub resources), but I just cannot get the code to actually work when run. Thank you
You can only select an effect if you selected a master volume and created a segment. See the examples.
Also note that the order of operations need to be fixed (effect = comes first) and that world coordinate is physical (RAS) coordinate and not IJK. You need to convert to RAS to IJK before inserting the point coordinates into ijkPoints.