-
Notifications
You must be signed in to change notification settings - Fork 505
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
C matrices revised jcfr 20170216 #202
Conversation
Affects GLCM, GLRLM and GLSZM calculation. On initialization, extension is loaded and enabled by default. If an error occurs, a warning is logged and matrices will be calculated in full-python mode. Alternatively, full-python mode can be forced by a call to `radiomics.enableCExtensions(False)`. Added `requirements-setup.txt` to specify dependencies needed during setup (requires numpy and cython)
Affects shape class. Loading, enabling and disabling is done similarly to the `cmatrices` extension.
Instantiate temporary data array directly in C, without first creating and then deleting a numpy array.
Testing compares matrices calculated by python algorithms to those calculated by the C extension. Tests the calculation of surface area in a similar manner. Testing fails if C extension is not available or if any element in the matrix differs more than 1e-3 from the corresponding element in the other matrix.
…ibution Source distribution is generation using: python setup.py sdist For reference: https://docs.python.org/2/distutils/sourcedist.html#commands (cherry picked from commit c237fc0)
Python 3 has a revamped extension module initialization system. (See PEP 3121.)" See https://docs.python.org/3/howto/cporting.html#cporting-howto (cherry picked from commit 40d92c0)
Add a new parameter ('enableCExtensions') to the settings that can be specified in the parameter file or via `kwargs` at initialization of `featureextractor`. Add this parameter also to the parameter file schema. Apply this upon execute, as nothing happens if setting is not changed, but is checked regularly. Finally, fix a small bug, where a incorrect warning is logged when `enableCExtensions` is called when extensions are already enabled. In this case, nothing should happen.
Stats (Profiling 5 testcases using python 2.7): This PR adds two C Python extensions and associated tests:
Details
Optimizations
|
And at some point, we should probably look into running the C code through tool like |
Otherwise, LGTM |
@jcfr Here are two stack overflow threads covering using valgrind for python C extensions checking:
I will try to look into this in the coming weeks. Would you propose to wait with merging until complete, or list it as an issue to be resolved a bit later? |
No description provided.