import nibabel as nib
import numpy as np
from skimage.feature import canny
def canny_edges_3d(grayImage):
MIN_CANNY_THRESHOLD = 50
MAX_CANNY_THRESHOLD = 100
dim = np.shape(grayImage)
edges_x = np.zeros(grayImage.shape, dtype=bool)
edges_y = np.zeros(grayImage.shape, dtype=bool)
edges_z = np.zeros(grayImage.shape, dtype=bool)
edges = np.zeros(grayImage.shape, dtype=bool)
#print(np.shape(edges))
for i in range(dim[0]):
edges_x[i,:,:] = canny(grayImage[i,:,:], low_threshold=MIN_CANNY_THRESHOLD, high_threshold=MAX_CANNY_THRESHOLD, sigma = 0)
for j in range(dim[1]):
edges_y[:,j,:] = canny(grayImage[:,j,:], low_threshold=MIN_CANNY_THRESHOLD, high_threshold=MAX_CANNY_THRESHOLD, sigma = 0)
for k in range(dim[2]):
edges_z[:,:,k] = canny(grayImage[:,:,k], low_threshold=MIN_C
用canny算子做CT图像的边缘检测(3D)
最新推荐文章于 2023-07-02 23:55:19 发布