Error in SegmentMesher

Hello all,

I get the following error when I try to use Cleaver method to mesh a vertebra.

“Command ‘cleaver-cli’ returned non-zero exit status 109.” (attached photo)

Do you have any idea what does this error mean and how it can be solved?

Also, I am looking for some documents on using Cleaver method through programming Python intractor, which I guess it’s needed for adaptive mesh. I found some ideas in this post, but it is comprehensive enough. Any suggestion is highly appreciated.

Thank you,

The cleaver mesher CLI never explicitly returns with error code 109, so most likely this is generated at somewhere higher level and will not reveal anything specific about the problem. Maybe the process has ran out of memory. Monitor the memory usage and free memory while the mesher is running to confirm this.

You can also build Cleaver and run it in a debugger to understand what is happening, and if you don’t find a solution then report all your findings at Cleaver’s issue tracker. While you are waiting for the answer, you can adjust the meshing parameters to avoid this error.

Hi Andras,

Thanks for your reply. I tried to use the module on another disk and actually another operating system (from Linux to Windows), but I still get the same error. The mesher doesn’t run at all for monitoring the process and the error pops up immediately. Plus, the WorkStation has plenty of empty space available.

Attached you can also see the error message in Python interactor, if it helps any.

What are the messages above Run with --help for more information?

Didn’t we have an issue lately where an extra space or empty string was being post-pended to a command line string leading to an error message like this? The error message makes it look like the same issue.

Here is the full message:

(I played with meshing parameters a bit!)

Yes, that last '' in the argument list looks like the issue I mentioned. Maybe you can try editing the python code to remove it before running the command.

Thanks Steve for the reply. Can you explain a bit more on the source of the error, so I can find a clue where should I edit in the code?

I’ve pushed a fix:

You can make the change in the script on your computer right now or update the extension from the extensions manager tomorrow.

Thank you Andras, I’ll do that.

Yes, that’s the fix I would have expected. Will be great if you can try it out and report back @ZSoltani

Sure, I will try it and report back. Thank you @lassoan and @pieper for your great support.


As a report: With the updated version of the Segment Mesher, it can complete the mesh generation using Cleaver method. Thank you for that.

However, at the end of the process, Python interactor shows a message that .vtk and .info files are written in a subfolder in SegmentMesher folder. But the folder is empty and no file is there (I checked view the hidden option too). Please see the attached image.


Hi Zahra -

I think you are getting close - the files are usually deleted after they are re-loaded in Slicer (with the idea that you can save out your final version form Slicer). But you can have them preserved if you check the box in the application settings:


For me the current nightly version of the Segment Mesher extension is working as expected in the 5.0.3 release. Let us know if it works for you or you run into other issues. Here the source segmentation is shown semi-transparent over the meshed result.

Thank you @pieper, that default setting makes a real sense.

I was also wondering if there is a way to improve the mesh quality in a few local areas manually? In the attached image, I want to have some control in the two specified areas.


With changing the mesh parameters, I could get rid of those areas and have a nice mesh generated as below. But still I am wondering about possibility to control mesh in local areas?

Thank you,

Great :tada: Glad it’s working for you.

1 Like

Thanks Steve indeed for the great support!

I have another question though. The mesh generated is 4-node linear tetrahedral element (C3D4), by default. How can I change the element type to 10-node quadratic tetrahedral element (C3D10)?


That’s a great question but I don’t know enough about Cleaver to answer. If nobody here knows you could follow up at the cleaver github.


Just as an update, I asked people in the Cleaver github and based on their reply, higher order elements aren’t supported in Cleaver at this time. But still, C3D4 can be converted to C3D10 by adding nodes at the midpoints of the edges.