1
2import smilPython as sm
3import numpy as np
4
5
6file = "Slices-16.raw"
7im16 = sm.Image('UINT16')
8sp.readRAW(file, 700, 700, 700, im16)
9
10
11
12
13p16 = im16.getNumpyArray()
14
15
16p16 //= 256
17
18
19p8 = p.astype('uint8')
20
21
22im8 = sm.Image(im16, 'UINT8')
23
24im8.fromNumpyArray(p8)
25