pombreda / dicompyler

Automatically exported from code.google.com/p/dicompyler
0 stars 0 forks source link

Application hangs if ROIDisplayColor is Missing from a Structure #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
running DICOMPYLER on Ubuntu 10.10 both of which are up to date (hg update 
pulls nothing new). It is a new install since previous comments (#22).

Attempting to open a Pinnacle-created DICOM-RT. After loading the DCMs and 
specifying prescription dose (7800), loaded study and DICOMPYLER hung. Here is 
the output from the CLI:

Found ROI #1: iso
Found ROI #2: laser
Found ROI #3: calc
Found ROI #4: Seeds
Found ROI #5: CTVp
Found ROI #6: RECTUM
Found ROI #7: BLADDER
Found ROI #8: PTV78
Found ROI #9: CTVn
Found ROI #10: PTV56
Found ROI #11: penumbra
Found ROI #12: PERITONEUM
Found ROI #13: PERITONEUM_PRV
Found ROI #14: RECTUM_PRV
Found ROI #15: BLADDER_PRV
Found ROI #16: Lt HOF
Found ROI #17: Rt HOF
Found ROI #18: ring 78
Found ROI #19: ring 56
Found ROI #20: markers
Found ROI #21: Ring
Found ROI #22: 2cm ring 78
Found ROI #23: 2cm ring 56
Found ROI #24: lt hotspot
Found ROI #25: rt hotspot
Found ROI #26: ant avoid
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.6/threading.py", line 484, in run
    self.__target(*self.__args, **self.__kwargs)
  File "./main.py", line 252, in LoadPatientDataThread
    patient['structures'] = dp(ptdata['rtss']).GetStructures()
  File "/home/andrew/dicompyler/dicomparser.py", line 254, in GetStructures
    structures[number]['color'] = np.array(roi.ROIDisplayColor, dtype=float)
  File "/usr/local/lib/python2.6/dist-packages/pydicom-0.9.5-py2.6.egg/dicom/dataset.py", line 237, in __getattr__
    raise AttributeError, "Dataset does not have attribute '%s'." % name
AttributeError: Dataset does not have attribute 'ROIDisplayColor'.

As you can see there are many ROIs.

Have we had this problem before??

Original issue reported on code.google.com by alexisan...@gmail.com on 21 Feb 2011 at 7:13

GoogleCodeExporter commented 9 years ago
This seems to be a new issue, in that the error seems to be that the RT 
Structure Set does does not have a color for ROI #26 - ant avoid. Could you 
please check Pinnacle to see what color is assigned to this structure?

Also, try the test dataset from the website to see if the your install works 
properly.

If there is no color assigned to the structure (or not present in the RT 
Structure Set file), we can add a function that will automatically generate a 
random color for the structure for display. That should take care of the 
problem.

Original comment by bastula on 21 Feb 2011 at 2:59

GoogleCodeExporter commented 9 years ago
I was able to replicate this issue by deleting ROIDisplayColor in one of the 
structures in the testdata.

The fix will be as described above: generating a random color if 
ROIDisplayColor does not exist.

Original comment by bastula on 21 Feb 2011 at 4:16

GoogleCodeExporter commented 9 years ago
Thanks fellas, that is the problem. The structures do have a colour assigned 
(one is automatically assigned when you create one in Pinnacle, but the display 
was turned off when exported.

The solution to assign a random colour if none is assigned corrects the defect.

ALSO ....

I noticed that with the many structures generated, there was no scroll bar in 
the left panel on the viewer when set to structures. Some were not visible as 
they were off the page.

A

Original comment by alexisan...@gmail.com on 21 Feb 2011 at 11:53

GoogleCodeExporter commented 9 years ago
Yes, that is a known bug as well, but undocumented. I created a custom control 
for the checkboxlist so that it has colors on the side. For some reason, the 
scrollbar never shows up.

I am not sure if I will fix it, yet, as I have been thinking about 
alternatives, since in the future the left bar may go away and become a 
treeview.

Original comment by bastula on 22 Feb 2011 at 12:03

GoogleCodeExporter commented 9 years ago
Given that there are so many names appearing, it would be nice if there was a 
division between the seen and unseen. Something where you ticked something to 
view and then it appeared in a selected tree or panel. Just a suggestion. 

A

Original comment by alexisan...@gmail.com on 22 Feb 2011 at 1:04

GoogleCodeExporter commented 9 years ago
Currently, the structures that are checked do appear in the dropdown control in 
Structure Information below the structure list. We can consider what you 
described when we redo the structure list.

Original comment by bastula on 22 Feb 2011 at 3:08

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 3a63c33c50.

Original comment by bastula on 23 Feb 2011 at 3:56

GoogleCodeExporter commented 9 years ago
I tried updating (hg update in the correct directory) but there was no new file 
coming across. My problem? Or something at your end?

Original comment by alexisan...@gmail.com on 23 Feb 2011 at 8:35

GoogleCodeExporter commented 9 years ago
Did you try hg pull first?

Original comment by bastula on 23 Feb 2011 at 8:39

GoogleCodeExporter commented 9 years ago
that's better, now it loads. Don't get any DVH data though. At least can
make anonymous and email you Dropbox link to see

A

Original comment by alexisan...@gmail.com on 23 Feb 2011 at 8:56

GoogleCodeExporter commented 9 years ago
Great! I will be working on independent DVH calculation next week during my 
spring break.

Original comment by bastula on 23 Feb 2011 at 8:58

GoogleCodeExporter commented 9 years ago
Confirming this occurred for plans imported from Tomotherapy. My fix was to 
modify GetStructures() in dicomparser. It doesn't seem to matter what color is 
initially assigned to the ROI:

                #BPT March 2011
                #Check to see of ROIDisplayColor exists
                if "ROIDisplayColor" in roi:
                    structures[number]['color'] = np.array(roi.ROIDisplayColor, dtype=float)
                else: #create color
                    structures[number]['color']= np.array([255,255,0])

Original comment by bton...@gmail.com on 3 Mar 2011 at 9:20

GoogleCodeExporter commented 9 years ago
Hi Brian,

Thanks for reporting this regarding Tomotherapy data.

Is this issue resolved for you if you apply the changeset from r3a63c33c50? It 
seems similar to the fix you suggested, except that it uses a random color for 
each structure.

Original comment by bastula on 3 Mar 2011 at 11:16

GoogleCodeExporter commented 9 years ago
I had made the change before I saw that you were addressing the problem, so I 
wanted to note that a fixed RGB assignment seems to "work".

The "random" approach should also work. It seems that the actual display colors 
are set at display time, since assigning a fixed ROI color does not actually 
produce ROI's that display in the same color.

Original comment by bton...@gmail.com on 4 Mar 2011 at 8:03