Segmentation, Vectorization and features' attributes populating using the C++ API


I am trying to use the C++ API to create a workflow similar to one of the cookbook recipes (Large-Scale Mean-Shift (LSMS) segmentation), potentially adding a classification step onto it down the line.

Configuration setup

My system: Windows10
Version of the OTB: 7.1

I tried mixing two C++ samples (RadiometricAttributesLabelMapFilterExample.cxx and LabelMapToVectorData.cxx).
Essentially, what I tried is taking the OpeningLabelMapFilterType opening from RadiometricAttributesLabelMapFilterExample.cxx and using it as input to the LabelMapToVectorDataFilterType.

I managed to generate vector features and save them to a shapefile, however I noticed they had no attributes (or fields) (Also noticed the copy of the projection ref didn’t work for some reason but I can work around that).
What I would like to do, similarly to the cookbook recipe, is to segment an image, generate vector features from the different parts, optionally classify the features into different classes / perform OBIA and save the features with the attributes (and the class label) that were computed (for instance shape and radiometric attributes ).
Is there an easy way to do this using the toolbox ? If not, is there a possibility to save the output of the AttributesLabelMapFilters to some usable form? I noticed otbcli_LSMSVectorization seemed to save those attributes so I assume it’s possible in some way.

Best regards,