티스토리 뷰

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 드랍박스에서 받은 후 실행 함

 

 

댓글
댓글쓰기 폼