CenterLine strange error - Using `--no-main--window`

Hi everybody,

Im using the module for obtain the centerline from a segmentation. I created a module wich call the centerline module and it works fine. When I run the same code but using slicer --no-main–window, the program crash always in the same line of code.

Its strange, its the same code and the same inputs. When I run it as a module I get the centerline but when I run it like a py code using slicer --no-main-window, it doesnt.

Aways crash in this line, and I put also the lines that I use for work with ExtractCenterLine.

In another case, there is other way to work with ExtractCenterLine different?

Thanks, Lucas.

# The line of problems.
preprocessedPolyData = extractLogic.preprocess(inputSurfacePolyData, targetNumberOfPoints, decimationAggressiveness, subdivideInputSurface)
# Preprocess the surface
inputSurfacePolyData = extractLogic.polyDataFromNode(segmentationNode, segmentID)
targetNumberOfPoints = 5000.0
decimationAggressiveness = 4
subdivideInputSurface = False
preprocessedPolyData = extractLogic.preprocess(inputSurfacePolyData, targetNumberOfPoints, decimationAggressiveness, subdivideInputSurface)

# Extract the centerline
centerlineCurveNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsCurveNode", "Centerline curve")
centerlinePolyData, voronoiDiagramPolyData = extractLogic.extractCenterline(preprocessedPolyData, pointListNode)
centerlinePropertiesTableNode = None
extractLogic.createCurveTreeFromCenterline(centerlinePolyData, centerlineCurveNode, centerlinePropertiesTableNode)

The application main window takes care of many tasks. It would be practically impossible to test all the features of the application with and without main window. Some years ago we tried, but it just took too much of our time, and for creating simplified applications (slicelets) we found that having a main window and just hiding unwanted elements works much better. The --no-main-window only exists for component-level testing, and for application-level tests or using application features.

1 Like

Hi Andras, thanks for your help and comments. Finally, I managed to use -no-main-window.

This is my line:

./Slicer --python-script 'myscript.py' --testing --no-splash --no-main-window 

I removed --testing and it worked. Maybe those comments can be useful for other people.

Thanks, Lucas.

Oh yes, I think they would help me install/uninstall extensions from local packages without fully launching Slicer, thanks ! Still have to test.

1 Like