Sikerdebaard / dcmrtstruct2nii

DICOM RT-Struct to mask
MIT License
91 stars 27 forks source link

Vectorize Coordinate Transform #42

Closed mathiser closed 1 year ago

mathiser commented 1 year ago

Hi @Sikerdebaard I have been fiddling around with vectorizing the coordinate transform to increase the conversion performance. It is quite a drastic refactoring of the conversion, but it works quite well.

In my tests the current codebase converts a given patient in 2 minutes and 2 seconds, while this PR converts the same in 1 min 31 secs. The biggest consumer of time is still the generation of the mask from coordinates, which takes up around half of the execution time (and saving niftis about 15 %).

Feel free to have a look, and decide if this (or an edited version should be merged)

Mathis

mathiser commented 1 year ago

Hi again @Sikerdebaard Just checking in if this has any interest. Mathis

Sikerdebaard commented 1 year ago

I am a bit squeezed for time at the moment so I haven't had a chance to do the work / refactoring necessary to start testing this (and other) PR. I'll update once my agenda clears up a bit which should be in the next two weeks or so. Sorry for the delay.

mathiser commented 1 year ago

Thanks for getting back. No problem at all. Just wanted to be sure you received the PR. Take care!

mathiser commented 1 year ago

Hi again. I've found a bug this code, causing irregularities when run multiple times. Specifically, it is caused by np.empty. Running the code with np.zeroes instead fixes this. Closing this and opening a new PR soon.

Mathis