简体   繁体   English

基于厚度的像素之间的着色区域

[英]Coloring area between pixels based on thickness

I'm trying to isolate the gray matter in a brain image and color it based on the cortical thickness at each point giving a result similar to this: Cortical thickness map based on this original: Original brain scan我正在尝试分离大脑图像中的灰质并根据每个点的皮质厚度对其进行着色,给出类似于以下的结果: Cortical thickness map based on this original: Original brain scan
So far I have segmented the white matter boundary and the gray matter boundary giving me this:到目前为止,我已经分割了白质边界和灰质边界,给了我这个:
White + Gray matter segmentation白+灰质分割
The next step is where I'm stuck.下一步是我卡住的地方。
I need to find the distance between the 2 boundaries by finding the closest white boundary pixel for each gray boundary pixel and record the distance between them as shown here: Distance我需要通过为每个灰色边界像素找到最近的白色边界像素来找到两个边界之间的距离,并记录它们之间的距离,如下所示:距离
This can be done simply with some for loops and Euclidian distance.这可以通过一些 for 循环和欧几里得距离简单地完成。
My problem is how to then color the pixels in between them/assign the distance value to the pixels between them.我的问题是如何为它们之间的像素着色/将距离值分配给它们之间的像素。

import numpy as np
import matplotlib.pyplot as plt
import nibabel as nib
from skimage import filters
from skimage import morphology


t1 = nib.load('raw_map1.nii').get_fdata()
t1map = nib.load('thickness_map1.nii').get_fdata()

filt_t1 = filters.gaussian(t1,sigma=1)
plt.imshow(filt_t1[:,128,:])

#Segment the white matter surface
wm = filt_t1 > 75
plt.imshow(wm[:,128,:])

med_wm = filters.median(wm)
plt.imshow(med_wm[:,128,:])

dilw = morphology.binary_dilation(med_wm)
edge_wm = dilw.astype(float) - med_wm
plt.imshow(edge_wm[:,128,:])

#Segment the gray matter surface
gm = (filt_t1 < 75) & (filt_t1 > 45)
plt.imshow(gm[:,128,:])

med_gm = filters.median(gm)
plt.imshow(med_gm[:,128,:])

dilg = morphology.binary_dilation(med_gm)
edge_gm = dilg.astype(float) - med_gm
plt.imshow(edge_gm[:,128,:])

dilw2 = morphology.binary_dilation(edge_wm)
plt.imshow(dilw2[:,128,:])

fedge_gm = edge_gm.astype(float) - dilw2
plt.imshow(fedge_gm[:,128,:])

fedge_gm2 = fedge_gm > 0
plt.imshow(fedge_gm2[:,128,:])

#Combine both surfaces
final = fedge_gm2 + edge_wm
plt.imshow(final[:,128,:])

You may use DL+DiReCT : https://github.com/SCAN-NRAD/DL-DiReCT您可以使用DL+DiReCThttps://github.com/SCAN-NRAD/DL-DiReCT

Starting from a brain scan (T1-weighted MRI) as input, DL+DiReCT labels anatomical regions including the cortex and calculates a voxel-wise cortical thickness map ( T1w_norm_thickmap.nii.gz ).从作为输入的脑部扫描(T1 加权 MRI)开始, DL+DiReCT标记包括皮层在内的解剖区域并计算体素方面的皮层厚度 map ( T1w_norm_thickmap.nii.gz )。 For every voxel inside the cortex, the intensity indicates the thickness of the cortex in mm.对于皮层内的每个体素,强度表示以毫米为单位的皮层厚度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM