Project

General

Profile

Actions

PETCT Viewer

View>mainpage>PETCTView.py

This file is responsible for implementing the PET/CT Viewer tab of the OnkoDICOM program. As this is an extension of the image fusion functionality, a new tab has been created to maintain clarity of the fused PET and CT images. The visual layout of PETCTView.py share many similarities with DICOMView.py and thus, code from the latter has been copied and refactored so that the mainpage folder contains the PETCTView.py.

Alpha Slider

goes between 0 and 100 for opacity
image_display using painter, blends images together

#
   def init_alpha_slider(self):
        """ 
        Creates the alpha slider for PET/CT View
        """ 
        self.alpha_slider.setMinimum(0)
        self.alpha_slider.setMaximum(100)
        self.alpha_slider.setValue(0)
        self.alpha_slider.setTickPosition(QtWidgets.QSlider.TicksLeft)
        self.alpha_slider.setTickInterval(1)
        self.alpha_slider.valueChanged.connect(self.value_changed)
# QPaint addition in image_display function
# Load moving image
        if not self.moving_dict_container.is_empty() \
                and self.moving_dict_container.has_attribute("sitk_moving"):
            moving_pixmaps = \
                self.moving_dict_container.get("pixmaps_" + self.slice_view)
            m = float(len(moving_pixmaps)) / len(pixmaps)
            moving_image = moving_pixmaps[int(m * slider_id)]
            image_conv = image.toImage()
            mov_conv = moving_image.toImage()
            alpha = float(self.alpha_slider.value() / 100)
            painter = QPainter()
            painter.begin(image_conv)
            painter.setOpacity(alpha)
            painter.drawImage(0, 0, mov_conv)
            painter.end()
            image = QtGui.QPixmap.fromImage(image_conv)

Axial, Coronal, and Sagittal Views

toggled --> update_axis (gets which image was toggled, grabs the name of the toggled view, get the length of the pixmaps and correct the slider values)

image_display - updated to cater for image sets of different sizes (look for variable m)


Windowing

The approach to enabling windowing levels while in the PETCT Viewer tab is to first apply windowing to both PT and CT sets separately before overlaying the images (fusing).


Updated by Felicina Chau over 3 years ago · 6 revisions