Geting Scalars to DiscreteMarchingCubes

Hello,

I am assiging a label value for each connected component in the image that I am using to generate the mesh. In the picture each rib has a different label in the original image.

I am just trying to check if the corrected label is assigned to each cell of the output mesh, I will need that information later.

I tryed to do something similar to your code but it does not print.

Thank you

vtkSmartPointer<vtkPolyData> outputPolyData = discrete_smooth_mesher->GetOutput();

vtkCellData* pointData = outputPolyData->GetCellData();
	

    vtkDataArray* scalarArray = pointData->GetArray(0);

    if (scalarArray) {
	    
	            std::unordered_set<int> uniqueValues;

		    for (vtkIdType i = 0; i < scalarArray->GetNumberOfTuples(); ++i) {
     			int scalarValue = static_cast<int>(scalarArray->GetTuple1(i));

			uniqueValues.insert(scalarValue);}

tissue 6