bastula / dicompyler

Extensible radiation therapy research platform and viewer for DICOM and DICOM RT
http://www.dicompyler.com
268 stars 100 forks source link

Display DICOM coordinates / CT values / Dose values of the mouse in the 2D View #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be useful if in the 2D View that when moving the mouse, the DICOM 
coordinates / CT values / Dose values could be displayed on screen.

For the current mouse position, the function GetPatientToPixelLUT in 
dicomparser can be used, which returns mm coordinate arrays which correspond to 
the image pixels.

For the current CT value and dose value, this information can be queried via 
the image's pixel_array.

Original issue reported on code.google.com by bastula on 30 Mar 2011 at 3:14

GoogleCodeExporter commented 9 years ago
Attached a patch to display coordinates. Image information is displayed with 
wx.staticText instead of DrawText.

Original comment by gllm.ber...@gmail.com on 5 Apr 2011 at 8:35

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Guillaume,

Thanks for the patch. I tried it out and the coordinates show up great. 
However, there are few issues as a result of the patch:

1. Keyboard functionality is lost: (Up/Down) & (Page Up/Page Down)
2. The mousewheel scrolling is significantly slower
3. The coordinates don't update if your mouse cursor is over a wx.StaticText 
control

Regarding #1, I tried removing the 2 lines from OnKeyDown, but it doesn't help. 
I think this has to do with the event being bound to panel, and since now there 
is a sizer, it is getting blocked.

Regarding #2, I think this is a result of all the wx.StaticText controls that 
have to be updated each time the panel has to redraw. For whatever reason, 
drawing text with the GraphicsContext is faster (probably since it's drawing 
straight to CoreGraphics/Cairo/GDIPlus).

Regarding #3, this is again a result of the mouse cursor being polled when only 
over the panel. Since the child controls take precedence, the wx.StaticText 
will intercept those events.

Actually, I have already written a patch similar to yours but using the 
GraphicsContext DrawText methods. However, I have not committed it yet due to 
high CPU usage when moving the cursor. I have also noticed the same effect with 
your patch. I was actually quite excited to see that you used wx.StaticText 
instead, hoping that it would have reduced the CPU usage. Unfortunately, that 
is not the case. I think what we will end up doing is adding this feature in 
using GraphicsContext, but enabling it as a preference, with the default as 
off. Then users can turn it on at their discretion. The other option I thought 
was to have the coordinates show up elsewhere in a separate window or panel, 
but I have not explored that option yet.

Also, I am wondering why you chose to use wx.StaticText instead of adding 
another DrawText method? Did you have any difficulties or concerns with it?

Thanks,

Adit

Original comment by bastula on 5 Apr 2011 at 10:00

GoogleCodeExporter commented 9 years ago
This issue was updated by revision e97f857b3c45.

Original comment by bastula on 19 Apr 2011 at 4:39

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

Original comment by bastula on 20 Apr 2011 at 10:47