Thanks for your reply. I have tried to follow the script for converting stl to TIFF images but still get error messages. In particular, the command
inputModel.GetBounds(bounds)
returns the error message:
Traceback (most recent call last):
File "<console>", line 1, in <module>
AttributeError: 'bool' object has no attribute 'GetBounds'
Similarly, the command:
slicer.modules.segmentations.logic().ImportModelToSegmentationNode(inputModel, seg)
Returns the error message:
Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: ImportModelToSegmentationNode argument 1: method requires a VTK object
To me it looks as if the method to load the stl file is the problematic one (inputModel = slicer.util.loadModel(inputModelFile) ).
Any idea how to solve it?
If you see the documentation of the function you use you’ll see why you get a boolean:
>>> help(slicer.util.loadModel)
Help on function loadModel in module slicer.util:
loadModel(filename, returnNode=False)
Load node from file.
:param filename: full path of the file to load.
:param returnNode: Deprecated.
:return: loaded node (if multiple nodes are loaded then a list of nodes).
If returnNode is True then a status flag and loaded node are returned.
The API is changed in Slicer-4.11. By default we don’t use Boolean flag to indicate error anymore, but raise an exception instead. This allows simpler syntax of inputModel = slicer.util.loadModel(inputModelFile).
I would recommend to update to latest Slicer stable or preview release.