티스토리 뷰
Python/PyQt5
Python PyQt5 DICOM 8bit Pixel Load(PyQt5로 DICOM Pixel 데이터 로드)
j0n9m1n1 2019. 9. 30. 23:22반응형
import os, sys
import numpy as np
import pydicom
from pydicom.data import get_testdata_files
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap, QImage
from PyQt5.QtWidgets import QApplication, QLabel, QVBoxLayout, QWidget
class MyApp(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
ds = pydicom.dcmread('H:/dicom/US-RGB-8-epicard', force = True)
cvImg = ds.pixel_array
arr = np.require(cvImg, np.uint8, 'C')
height, width, _ = arr.shape
qImg = QImage(arr, width, height, QImage.Format_RGB888)
pixmap = QPixmap(qImg)
lbl_img = QLabel()
lbl_img.setPixmap(pixmap)
lbl_size = QLabel('Width: ' + str(pixmap.width()) + ', Height: ' + str(pixmap.height()))
lbl_size.setAlignment(Qt.AlignCenter)
vbox = QVBoxLayout()
vbox.addWidget(lbl_img)
vbox.addWidget(lbl_size)
self.setLayout(vbox)
self.setWindowTitle('QPixmap')
self.move(300, 300)
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = MyApp()
sys.exit(app.exec_())
https://barre.dev/medical/samples/
Medical Imaging : Samples
This repository is not intended to collect huge series of images, but only these files that may emphasize some structural or anatomic differences. I have been collecting them for testing purposes during the development of my own medical image reader (thank
barre.dev
위 링크에서 US-RGB-8-epicard 드랍박스에서 받은 후 실행 함
'Python > PyQt5' 카테고리의 다른 글
PyQt5 Designer 설치 및 사용방법 (0) | 2020.07.07 |
---|---|
cafe24 그룹웨어 일정 크롤링 알림이 (0) | 2020.02.13 |
댓글
티스토리 방명록
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
Blog is powered by
Tistory / Designed by
Tistory
Contact: j0n9m1n1@gmail.com
Contact: j0n9m1n1@gmail.com