# If I could get the scalar value of a point/cell (in world coordinate) on the rendering of 3d vtkImageData?

**URL:** https://discourse.vtk.org/t/if-i-could-get-the-scalar-value-of-a-point-cell-in-world-coordinate-on-the-rendering-of-3d-vtkimagedata/7032
**Category:** Support
**Created:** [November 1, 2021, 2:28pm UTC](https://discourse.vtk.org/t/if-i-could-get-the-scalar-value-of-a-point-cell-in-world-coordinate-on-the-rendering-of-3d-vtkimagedata/7032 "2021-11-01T14:28:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![YuezhenQin](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/y/f1d935/32.png) [@YuezhenQin](https://discourse.vtk.org/u/YuezhenQin)
#### Post date: [November 1, 2021, 2:28pm UTC](https://discourse.vtk.org/t/if-i-could-get-the-scalar-value-of-a-point-cell-in-world-coordinate-on-the-rendering-of-3d-vtkimagedata/7032/1 "2021-11-01T14:28:42Z")

</div>

imageData-\>GetOutput()-\>GetPointData()-\>GetArray(“ImageScalars”);

I also tried the following code:  
int\* dimension = connector-\>GetOutput()-\>GetDimensions();  
for (int x = 0; x \< dimension[0]; x++)  
{  
double\* pixel = static\_cast\<double\*\>(connector-\>GetOutput()-\>GetScalarPointer(x, 0, 0));  
std::cout \<\< pixel[x] \<\< std::endl;  
}

The output:  
-6.818e+289  
-2.06898e+289  
-2.06898e+289  
-2.06898e+289  
-2.06898e+289  
-2.06898e+289  
-2.06898e+289  
-2.06898e+289  
-2.06898e+289  
-2.06898e+289  
-2.06898e+289  
-2.06898e+289  
-2.06898e+289  
-2.06898e+289  
-2.06898e+289  
-2.06898e+289  
-2.06898e+289

I am wondering what data type to be selected to receive the result pixel.

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [November 2, 2021, 1:51pm UTC](https://discourse.vtk.org/t/if-i-could-get-the-scalar-value-of-a-point-cell-in-world-coordinate-on-the-rendering-of-3d-vtkimagedata/7032/2 "2021-11-02T13:51:27Z")

</div>

Take a look at [https://kitware.github.io/vtk-examples/site/Cxx/ImageData/IterateImageData/](https://kitware.github.io/vtk-examples/site/Cxx/ImageData/IterateImageData/) for an example.
