Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 108edce6 authored by DEBREUVE Eric's avatar DEBREUVE Eric
Browse files

added an itk version to frangi

parent 240dcd09
No related branches found
No related tags found
No related merge requests found
.idea/
.mypy_cache/
__material__/
__pycache__/
__version__/
......
......@@ -29,6 +29,10 @@
# The fact that you are presently reading this means that you have had
# knowledge of the CeCILL license and that you accept its terms.
'''
Follows: https://github.com/ellisdg/frangi3d
'''
from type import array_t
import multiprocessing as pl_
......@@ -36,6 +40,7 @@ from ctypes import c_float as c_float_t
from multiprocessing.sharedctypes import Array as shared_array_t
from typing import Optional, Tuple
import itk as ik_
import numpy as np_
from scipy import ndimage as im_
......@@ -204,6 +209,39 @@ def _FrangiEnhancementOneScale(
shared_enhanced[:] = local_enhanced.flatten()[:]
def _ITKFrangiEnhancementOneScale(
img: array_t,
scale: float,
alpha: float = 0.5,
beta: float = 0.5,
frangi_c: float = 500.0,
bright_on_dark: bool = True,
shared_enhanced: shared_array_t = None,
) -> Optional[array_t]:
'''
Do not produce nice resultas as is. Parameter tuning?
'''
print(f" scale={scale}")
assert bright_on_dark
img = ik_.image_view_from_array(img)
hessian_image = ik_.hessian_recursive_gaussian_image_filter(img, sigma=scale)
vesselness_filter = ik_.Hessian3DToVesselnessMeasureImageFilter[ik_.ctype('float')].New()
vesselness_filter.SetInput(hessian_image)
# vesselness_filter.SetAlpha1(args.alpha1)
# vesselness_filter.SetAlpha2(args.alpha2)
# Do not view-version here since vesselness_filter is local
local_enhanced = ik_.array_from_image(vesselness_filter)
if shared_enhanced is None:
return local_enhanced
else:
shared_enhanced[:] = local_enhanced.flatten()[:]
def _EigenValuesOfHessianMatrix(img: array_t, scale: float) -> array_t:
#
global _hessian_matrices
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment