# pixel positions in every slice is not uniform

**URL:** https://discourse.itk.org/t/pixel-positions-in-every-slice-is-not-uniform/7746
**Category:** Algorithms
**Created:** [April 8, 2026, 2:18am UTC](https://discourse.itk.org/t/pixel-positions-in-every-slice-is-not-uniform/7746 "2026-04-08T02:18:27Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jsemeda](https://discourse.itk.org/user_avatar/discourse.itk.org/jsemeda/32/4633_2.png) [@jsemeda](https://discourse.itk.org/u/jsemeda)
#### Post date: [April 8, 2026, 2:18am UTC](https://discourse.itk.org/t/pixel-positions-in-every-slice-is-not-uniform/7746/1 "2026-04-08T02:18:27Z")

</div>

I am getting the 3d position of the pixels in every slice. I use the “TransformIndexToPhysicalPoint” to get the 3d position of pixels. I looked at the corner pixel in every slice, index (0, 0, 0), and the results are not uniform. Here are the results of the 3d position of the corner pixel in every slice

Physical coordinates of the first pixel: (-202.954, -27.6161, -60.131)  
Physical coordinates of the first pixel: (-202.298, -28.3201, -51.7863)  
Physical coordinates of the first pixel: (-201.642, -29.0242, -43.4416)  
Physical coordinates of the first pixel: (-200.984, -29.7283, -35.097)  
Physical coordinates of the first pixel: (-200.328, -30.4323, -26.7524)  
Physical coordinates of the first pixel: (-199.672, -31.1364, -18.4077)  
Physical coordinates of the first pixel: (-199.016, -31.8405, -10.063)  
Physical coordinates of the first pixel: (-198.358, -32.5445, -1.7184)  
Physical coordinates of the first pixel: (-197.702, -33.2486, 6.62633)  
Physical coordinates of the first pixel: (-197.046, -33.9527, 14.971)  
Physical coordinates of the first pixel: (-196.39, -34.6567, 23.3156)  
Physical coordinates of the first pixel: (-195.732, -35.3609, 31.6602)  
Physical coordinates of the first pixel: (-195.076, -36.0649, 40.0049)  
Physical coordinates of the first pixel: (-194.42, -36.769, 48.3496)  
Physical coordinates of the first pixel: (-193.764, -37.4731, 56.6942)  
Physical coordinates of the first pixel: (-193.107, -38.1771, 65.0389)  
Physical coordinates of the first pixel: (-192.45, -38.8812, 73.3835)  
Physical coordinates of the first pixel: (-191.794, -39.5853, 81.7282)  
Physical coordinates of the first pixel: (-191.138, -40.2893, 90.0728)  
Physical coordinates of the first pixel: (-190.481, -40.9934, 98.4175)  
Physical coordinates of the first pixel: (-189.824, -41.6975, 106.762)  
Physical coordinates of the first pixel: (-189.168, -42.4015, 115.107)  
Physical coordinates of the first pixel: (-188.512, -43.1056, 123.452)  
Physical coordinates of the first pixel: (-187.855, -43.8097, 131.796)  
Physical coordinates of the first pixel: (-187.198, -44.5137, 140.141)  
Physical coordinates of the first pixel: (-186.542, -45.2179, 148.486)  
Physical coordinates of the first pixel: (-185.886, -45.9219, 156.83)

Both the x and y positions are deviating, the z position(depth) is also changing as it should. The tag values values of the

Slice Thickness = 4  
Pixel Spacing X = 0.3125  
Pixel Spacing Y = 0.3125

the results do not reflect these values between pixels, the pixel positions are being advanced with random values.

Should I use these tag values to advance pixel positions from the corner pixel position to get a uniform result? or just go with the function given values?

---

<div class="post-metadata">

### Author: ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)
#### Post date: [April 8, 2026, 12:58pm UTC](https://discourse.itk.org/t/pixel-positions-in-every-slice-is-not-uniform/7746/2 "2026-04-08T12:58:55Z")

</div>

Hello @jsemeda,

The results of using `TransformIndexToPhysicalPoint` are correct. Those are the physical coordinates of the corner pixels. The “issue” you are encountering is that the axes of the image are not the identity. To see this use the image’s `GetDirection` method. Non identity direction matrices often happen in CT and MR. Note that slice thickness does not play a role in determining the pixel locations, see [this discussion](https://discourse.slicer.org/t/tag-0018-0050-slice-thickness-does-not-correspond-to-what-i-calculate-in-the-image/27438) for details.
