Open goodsave opened 5 years ago
I'm not exactly sure why it is so slow because it was ok with wxPython 2.8.10.1. I'm pretty sure that this is due to the upgrade to wxPython 4.
The main issue is that structure coordinate parsing happens for every slice every time you change the image slice position. This slowness happens with even 1 structure selected.
In the short term I recommend using the old released binary version (or if you can run from old source). The long term fix is to cache the structure data even before the 2D image opens.
ok, I carefully compared the code between the old version and the new version in 2dview.py, and found that there was not much difference between them.
I tried to use the old version, but the dependence of matplotlib could not be installed, so I gave up.
I'm going to try it in multithreading and try using the cache you mentioned.
If there is any progress, I will continue to comment here. Thank U!
Great thank you! Please let us know if you can provide a patch as we would be glad to integrate it back in.
On Thu, Oct 18, 2018 at 3:50 AM, Joker notifications@github.com wrote:
I carefully compared the code between the old version and the new version in 2dview.py, and found that there was not much difference between them.
I tried to use the old version, but the dependence of matplotlib could not be installed, so I gave up.
I'm going to try it in multithreading and try using the cache you mentioned.
If there is any progress, I will continue to comment here. Thank U!
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/bastula/dicompyler/issues/112#issuecomment-430928061, or mute the thread https://github.com/notifications/unsubscribe-auth/AADv3oRWF2Uu3-bhGl-P4ZWQz8aExVKVks5umEDBgaJpZM4XjEFo .
I wrote a simple cached version of the 2dview plug-in. You can get it in the attachment. But it's not very good because it‘ll takes a lot of time to cache after a patient is selected.
By the way, There is no improvement in using multithreading to rewrite computing coordinates,because Python multithreading can not effectively utilize multi-core CPU. My personal advice is to use C++ to rewrite the code of calculating coordinates and then use Python to invoke it if time permits.
Besides, Could you tell me what tools you pack into exe?
Thank you for posting your modification. Your solution seems to work, but is slow as you mentioned.
I think there can be some optimization done with GetContourPixelData
as it's purely a lookup function. It could be written using some Numpy ufuncs or functions.
For the exe, I just used py2exe, but I'm not sure if that is maintained anymore. You could try pyinstaller.
Allright,thank for your suggestion. I simply rewrote the part of the calculation coordinates with numpy. It's very fast now. The revised code is as follows:
def GetContourPixelData(self, pixlut, contour, prone=False, feetfirst=False): pixeldata = [] for p, point in enumerate(contour): if (not prone and not feetfirst): xIndex = np.argwhere(pixlut[0] > point[0]) elif (feetfirst or prone): xIndex = np.argwhere(pixlut[0] < point[0]) if (not prone): yIndex = np.argwhere(pixlut[1] > point[1]) elif (prone): yIndex = np.argwhere(pixlut[1] < point[1]) pixeldata.append((xIndex.min(), yIndex.min())) return pixeldata
Awesome! So no need for threading right?
No need for caching and multithreading. Python's multithreading has no effect in CPU intensive type. In addition,there are also some small BUG.
1.The position of the RS display is down to the right. Simple repair method:
path.MoveToPoint(point[0]-1, point[1]-1) path.AddLineToPoint(point[0]-1, point[1]-1)
2.Zoom button does not appear at the beginning.
3.Pyinstaller packaging in Python36 encountered various problems.
In the new version, Using 2D Viewer to view RT Structure, and selects multiple organs. Rolling with mouse is too laggy. In old version, mouse rolling will be smooth. Where do I need to repair it? I'm in a hurry to fix it.
my email : goodsave@qq.com I hope to receive your reply.