# How to label model according to cell data?

**URL:** https://discourse.vtk.org/t/how-to-label-model-according-to-cell-data/9406
**Category:** VR/AR
**Tags:** code, proposal
**Created:** [September 20, 2022, 11:46am UTC](https://discourse.vtk.org/t/how-to-label-model-according-to-cell-data/9406 "2022-09-20T11:46:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![graysuit](https://discourse.vtk.org/user_avatar/discourse.vtk.org/graysuit/32/5107_2.png) [@graysuit](https://discourse.vtk.org/u/graysuit)
#### Post date: [September 20, 2022, 11:46am UTC](https://discourse.vtk.org/t/how-to-label-model-according-to-cell-data/9406/1 "2022-09-20T11:46:01Z")

</div>

I have model (\*.vtu) containing several blocks like:

 ![Untitled](https://discourse.vtk.org/uploads/default/original/2X/8/8493554bb19401b6e4393028b7321e878f614a99.png)

I want to label values on each block like:  
 ![labels](https://discourse.vtk.org/uploads/default/original/2X/f/f09ec227122c729066c21402c452e3546d2537a1.png)

How can I do it ? I can access values using:

```auto
vtkActor actor = ...;
var output = actor.GetMapper().GetInputAsDataSet();
var cell = output.GetCellData();
for (int i = 0; i < cell.GetNumberOfComponents(); i++)
{
    var cells = cell.GetArray(i);
    if (cells == null) continue;
    if ("IJK" != cell.GetArrayName(i)) continue; //There are many columns. I used IJK column as testing purpose
    var min = cells.GetRange()[0];
    var max = cells.GetRange()[1];
    for (int j = 0; j < nCells; j++)
    {
        double val = cells.GetComponent(j, i);
        // how to label this value now ?
    }
    break;
}         
vtkDataSetMapper mapper = vtkDataSetMapper.New();
mapper.SetInput(output);
actor.SetMapper(mapper);

```

Here’s attached my model file: [model.zip](https://discourse.vtk.org/uploads/short-url/pzxaqTbCDhgPogZ14DUCDnCMJFQ.zip) (3.1 MB)
