Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #DICOM IMage
- dataset = dicom.read_file("1.3.6.1.4.1.5962.99.1.2786334768.1849416866.1385765836848.376.0.dcm")
- dsw = png.Writer(width=dataset[0x28, 0x10].value,height=dataset[0x28, 0x11].value, greyscale=True, bitdepth=dataset[0x28, 0x102].value)
- lista = list()
- aux = list()
- #Changing only for a test because the error
- for i in range(0, 512):
- for j in range(0, 512):
- if dataset.pixel_array[i][j]== -2000:
- aux.append(0)
- else:
- aux.append(int(dataset.pixel_array[i][j]))
- lista.append(aux)
- #lista= [[x for x in [i for i in range(0,512)]] for y in range(0, 512)]
- dw = png.Writer(width=512, height=512, greyscale= True, bitdepth=16)
- dw.write(open('imagetest.png', 'wb'), lista)
- #png.from_array(lista, 'L', info={'bitdepth':16}).save('imagetest.png')
- print("Escritor criado com sucesso!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement