# Analysing Cupping Effect of a CT-Scanner

**URL:** <https://discourse.slicer.org/t/analysing-cupping-effect-of-a-ct-scanner/23178>\
**Category:** Support\
**Created:** [April 28, 2022, 4:47pm UTC](https://discourse.slicer.org/t/analysing-cupping-effect-of-a-ct-scanner/23178 "2022-04-28T16:47:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joshua](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@Joshua](https://discourse.slicer.org/u/Joshua)\
**Post date:** [April 28, 2022, 4:47pm UTC](https://discourse.slicer.org/t/analysing-cupping-effect-of-a-ct-scanner/23178/1 "2022-04-28T16:47:04Z")

</div>

Hello,  
I’d like to analyse the homogeneity of the voxel values along the x, y and z axis.  
Is there any way of getting the mean voxel value of an area along an axis.  
Like for each slice the same area → calculating the voxel value mean of that are → Plotting voxel value over the depth of the slice [mm].

I hope you understand what i mean and can help me out.

---

<div class="post-metadata">

**Author:** ![Joshua](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@Joshua](https://discourse.slicer.org/u/Joshua)\
**Post date:** [May 19, 2022, 7:27pm UTC](https://discourse.slicer.org/t/analysing-cupping-effect-of-a-ct-scanner/23178/2 "2022-05-19T19:27:44Z")

</div>

I Wrote a Python Program to solve my problem

> #Bereich in z Richtung
> 
> ```
> #x 122 bis 153 (31 Pixel)
> 
> #y 71 bis 107 (36 pixel)
> 
> #Slices 140 bis 800 (660)
> 
> ```
> 
> n=getNode(“NodeName”)
> 
> nD=n.GetDisplayNode()
> 
> a=array(“NodeName”)
> 
> mid =
> 
> z = 0
> 
> sum = 0
> 
> h=0
> 
> for s in range(140, 802): #662 Slices 140 bis einschließlich 801
> 
> ```
> for y in range(71, 108): #37 Pixel 71 bis 107 fließt ein
> 
> for x in range(122, 154): #32 Pixel 122 bis 153 fließt ein
> 
> if z < 1184:
> 
> sum = sum + a[s,y,x]
> 
> z = z + 1
> 
> else:
> 
> m = sum / z    
> 
> mid.append(m)
> 
> sum = 0
> 
> z = 0
> 
> sum = sum + a[s,y,x]
> 
> z = z + 1
> 
> ```
> 
> m=sum/z
> 
> mid.append(m)
> 
> import numpy as np
> 
> np.savetxt(“DateiName.csv”, mid, delimiter=‘,’) # zum Exportieren

> #Bereich in x Richtung
> 
> n=getNode(“NodeName”)
> 
> nD=n.GetDisplayNode()
> 
> a=array(“NodeName”)
> 
> mid =
> 
> z = 0
> 
> sum = 0
> 
> h=0
> 
> for x in range(56, 325): # 269 Pixel 56 bis 324 fließt ein
> 
> ```
> for s in range(40, 891): # 851 Slices 40 bis einschließlich 890
> 
> for y in range(214, 244): # 32 Pixel 123 bis 155 fließt ein
> 
> if z < 25530:
> 
> sum = sum + a[s,y,x]
> 
> z = z + 1
> 
> else:
> 
> m = sum / z    
> 
> mid.append(m)
> 
> sum = 0
> 
> z = 0
> 
> sum = sum + a[s,y,x]
> 
> z = z + 1
> 
> ```
> 
> m=sum/z
> 
> mid.append(m)
> 
> import numpy as np
> 
> np.savetxt(“DateiName.csv”, mid, delimiter=‘,’) # zum Exportieren
