-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task 1 - XR Files #290
Task 1 - XR Files #290
Conversation
… and ImageLoading.py changes. RTSTRUCTs can be generated, and XR files with RTSTRUCTs can be opened, however they are not added automatically yet. Additionally, the XR display needs adjustement.
Temp RTSTRUCTS are now applied to XR files. Removed some testing code from and renamed xr-rtstruct.py -> xrRtstruct.py. IM000001 sample file can be opened, but IM000002-IM000004 cause issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at Photometric Interpretation.
It should allow you to simplify some of the code.
src/Model/ImageLoading.py
Outdated
@@ -68,6 +68,11 @@ | |||
"1.2.840.10008.5.1.4.1.1.88.33": { | |||
"name": "sr", | |||
"sliceable": False | |||
}, | |||
# XR Image |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XR is not a standard acronym or name for this, although it may be understood by others. Formally it is CR Image:
https://dicom.innolitics.com/ciods/cr-image
src/Model/ImageLoading.py
Outdated
orientation = img_dataset.ImageOrientationPatient | ||
position = img_dataset.ImagePositionPatient | ||
sort_key = img_stack_displacement(orientation, position) | ||
|
||
return sort_key | ||
|
||
|
||
def add_missing_cr_components(cr): | ||
""" | ||
:param cr: a dictionary key, value item that represents a CR file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The data type is pydicom.Dataset
src/Model/InitialModel.py
Outdated
@@ -36,6 +36,11 @@ def create_initial_model(): | |||
if dataset[0].Modality == "CT": | |||
is_ct = True | |||
|
|||
# Determine if dataset is CR for grayscale inverting | |||
is_cr = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment in ImageLoading regarding Photometric Interpretation
src/Model/MovingModel.py
Outdated
@@ -41,6 +41,11 @@ def create_moving_model(): | |||
if dataset[0].Modality == "CT": | |||
is_ct = True | |||
|
|||
# Determine if dataset is CR for grayscale inverting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment regarding Photometric Interpretation
rt_ss.SoftwareVersions = "2021" | ||
|
||
# Frame of Reference module | ||
rt_ss.PositionReferenceIndicator = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Body Part Examined might be a reasonable value to use for the RT SS Position Reference Indicator.
https://dicom.innolitics.com/ciods/cr-image/cr-series/00180015
from copy import deepcopy | ||
import datetime | ||
|
||
#AttributeError: 'Dataset' object has no attribute 'FrameOfReferenceUID' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Frame Of Reference is what ties together a 3D Volume (and more generally, a Series of images). A CR isn't a volume, and it predated the concept of a Frame Of Reference (or else it would have been a type 3 or type 2, where for CT and other objects it is frequently type 1).
import datetime | ||
|
||
#AttributeError: 'Dataset' object has no attribute 'FrameOfReferenceUID' | ||
#removed 2 lines relating to this error, might need to be looked at if this is required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the RT SS to be DICOM conformant (and can have an expectation of being usable by anything else), it will need to have a FrameOfReferenceUID. Given that one is trying to tie the RT SS to the CR, one could generate a new UID for the FoR, insert that in to the RT SS, and update the CR object by adding the FoR UID to that. Given that you know you will need to do this up front, it would be better to update the CR first (with a generated FoR UID), and update the SOP Instance UID of the CR (because it's a new object and not interchangeable with the original CR that lacks the FoR UID), and then use that FoR UID in the RT SS. Having a DICOM object with a public element it wouldn't normally have tends to be reasonably interoperable. Having a DICOM object without a public element that it is required to have is problematic.
src/Model/readxr.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like it would better to have in the test area, or if we want to have separate utilities.
It doesn't seem necessary for the application itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file was supposed to be removed, I guess I forgot to do that. Sorry!
Very good draft pull request. |
The pyradiomics issue is one for the maintainers to work out. |
Please fetch and pull from upstream master (to address pyradiomics issue and the poetry.lock issue) |
Yeah! All checks have passed, so the master branch is a known good starting point. |
… equal dimensions, but CR files do not, requiring a change. Made some requested changes.
Still need to fix up xrStruct.py, but everything else (including functionality with the other sample files) is in. |
please do this in a separate PR. |
Sample file IM000001 can be opened and have a temporary rtss applied.
Files IM000002 through 4 cannot be opened.
Phil made the RTSTURCT function.