PT Viewing » History » Version 6
Felicina Chau, 07/09/2021 11:58 PM
| 1 | 1 | Felicina Chau | h1. PT Viewing |
|---|---|---|---|
| 2 | 2 | Felicina Chau | |
| 3 | Only PT images with SOP UID " *Positron Emission Tomography Image Storage* " (1.2.840.10008.5.1.4.1.1.128) supports the Image Plane module which contains Image Position (Patient) and Image Orientation (Patient). Files with "enhanced" SOP Classes such as "Enhanced PET Image Storage" and "Legacy Converted Enhanced PET Image Storage" would need further investigation to import other modules such as Dimension Index Sequence. |
||
| 4 | |||
| 5 | Images with SOP UIDs "Secondary Capture Image Storage" and "Multi-frame True Color Secondary Capture Image Storage" are essentially "screenshots" of data/images from PT modality. These are a variety of different secondary capture types. It is important to confirm the SOP Class as that is what defines the content of the object. |
||
| 6 | |||
| 7 | 3 | Felicina Chau | While experimenting with series [WB_NAC] and [WB_CTAC], the system encountered KeyError: (0018, 5100). It is missing the Patient Position attribute. |
| 8 | 4 | Felicina Chau | |
| 9 | 5 | Felicina Chau | <pre><code class="python"> |
| 10 | 6 | Felicina Chau | if hasattr(dataset, 'PatientPosition'): |
| 11 | patient_pos = dataset['PatientPosition'].value |
||
| 12 | self.label_patient_pos.setText( |
||
| 13 | "Patient Position: %s" % (str(patient_pos))) |
||
| 14 | </code></pre> |
||
| 15 | |||
| 16 | The above code has resolved the issue of being unable to display modern PET files in OnkoDICOM, however, the image is sheared upon opening. This is due to an issue in QImages as PySide6 needs to know the number of bytes in each line of an image, otherwise it will assume something. This has led to there being too many bytes in one line. To resolve the issue, the number of bytes for each image needed to be recalculated (only the last 57 122 bytes should be used to form the image). |
||
| 17 | |||
| 18 | The following code snippet has fixed the issue: |
||
| 19 | <pre><code class="python"> |
||
| 20 | 4 | Felicina Chau | # PT Viewing Shear Issue Fix |
| 21 | # Convert numpy array data to QImage for PySide6 |
||
| 22 | bytes_per_line = np_pixels.shape[1] |
||
| 23 | qimage = QtGui.QImage( |
||
| 24 | np_pixels, np_pixels.shape[1], np_pixels.shape[0], bytes_per_line, |
||
| 25 | QtGui.QImage.Format_Indexed8) |
||
| 26 | 6 | Felicina Chau | |
| 27 | 4 | Felicina Chau | </code></pre> |