MorphoLibJ: keep largest region with 8 connectivity

Hi all,

I am having troubles with MorphoLibJ library, in order to keep the largest connected component. It should be straightforward, and indeed it is… if I want 4 connectivity in 2D.

Algorithms work for both 2D or 3D images. Default connectivity 4 (resp. 6) is used for 2D (resp. 3D) images.

However, I cannot find a way to do it with 8-conn. The documentation does not seem to reflect if other values aside from the default can be used:

I need 8-conn because I’m handling skeletons.
Ideas? Thank you very much in advance, hints are greatly appreciated.

OK. Got it myself!

It’s a two-step solution:
a) Create a labels image, setting 8-conn
b) Keep largest label