-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Support for faster C-based matrix and shape surface computation
Stats (Profiling 5 testcases): GLCM 9653 ms -> 7 ms GLDM 348 ms -> 7 ms NGTDM 133 ms -> 4ms This commit adds two C Python extensions and associated tests: * _cmatrices: C implementation for matrix computation associayed with GLCM, GLDM, GLDZM, GLRLM, GLSZM. and NGTDM features * _cshape: C implementation for Shape surface computation * tests/test_cmatrices: testing for matrix equality: Tests whether the python generated matrix is equal to the matrix generated by the C implementations (allows for machine precision errors) Details ------- * Add docstring to C modules * Use of C implementation optional. At initialization, the package tries to use C, but if loading has failed, or calculation is forced to python, python is used. Note that the import of _cmatrices is done after initialization of logger. This ensures error will be logged if import fails. * GLDM, NGTDM: C implementation accepts only one direction set of angles (i.e. 13 angles in a 3D image, 4 angles in a 2D). * GLSZM: Use "char" datatype for mask. (It is signed char in GLSZM). * C code is consistent with C89 convention. All variables (pointers for python objects) are initialized at top of each block. Optimizations ------------- * GLSZM: - Uses "while" loops. This allows to reduce the memory usage. We observed that with recursive functions it was 'unexpectedly' failing. - Optimized search that finds a new index to process in the region growing. Co-authored-by: Jean-Christophe Fillion-Robin <[email protected]>
- Loading branch information
Showing
14 changed files
with
1,342 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.