Project

General

Profile

PETCT Viewer » History » Version 6

Felicina Chau, 25/09/2021 07:30 PM

1 1 Felicina Chau
h1. PETCT Viewer
2
3
View>mainpage>PETCTView.py
4
5
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. 
6 2 Felicina Chau
7
h2. Alpha Slider
8 4 Felicina Chau
9 3 Felicina Chau
goes between 0 and 100 for opacity 
10
image_display using painter, blends images together
11
12 2 Felicina Chau
<pre><code class="python">
13 3 Felicina Chau
#
14 6 Felicina Chau
   def init_alpha_slider(self):
15
        """
16
        Creates the alpha slider for PET/CT View
17
        """
18
        self.alpha_slider.setMinimum(0)
19
        self.alpha_slider.setMaximum(100)
20
        self.alpha_slider.setValue(0)
21
        self.alpha_slider.setTickPosition(QtWidgets.QSlider.TicksLeft)
22
        self.alpha_slider.setTickInterval(1)
23
        self.alpha_slider.valueChanged.connect(self.value_changed)
24
</code></pre>
25 2 Felicina Chau
26 6 Felicina Chau
<pre><code class="python">
27
# QPaint addition in image_display function
28
# Load moving image
29
        if not self.moving_dict_container.is_empty() \
30
                and self.moving_dict_container.has_attribute("sitk_moving"):
31
            moving_pixmaps = \
32
                self.moving_dict_container.get("pixmaps_" + self.slice_view)
33
            m = float(len(moving_pixmaps)) / len(pixmaps)
34
            moving_image = moving_pixmaps[int(m * slider_id)]
35
            image_conv = image.toImage()
36
            mov_conv = moving_image.toImage()
37
            alpha = float(self.alpha_slider.value() / 100)
38
            painter = QPainter()
39
            painter.begin(image_conv)
40
            painter.setOpacity(alpha)
41
            painter.drawImage(0, 0, mov_conv)
42
            painter.end()
43
            image = QtGui.QPixmap.fromImage(image_conv)
44 2 Felicina Chau
</code></pre>
45
46
h2. Axial, Coronal, and Sagittal Views
47 5 Felicina Chau
48 3 Felicina Chau
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)
49
50
image_display - updated to cater for image sets of different sizes (look for variable m)
51
52 2 Felicina Chau
<pre><code class="python">
53
54
</code></pre>
55
56
h2. Windowing
57 5 Felicina Chau
58 3 Felicina Chau
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).
59 2 Felicina Chau
<pre><code class="python">
60
61
</code></pre>