RAM.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:lung-cancer-detector 作者: YichenGong 项目源码 文件源码
def resample(patient, new_spacing=[1,1,1]):
    scan = get_scan(patient)
    image = get_3D_data(patient)

    # Determine current pixel spacing
    spacing = np.array([scan[0].SliceThickness] + scan[0].PixelSpacing, dtype=np.float32)

    resize_factor = spacing / new_spacing
    new_real_shape = image.shape * resize_factor
    new_shape = np.round(new_real_shape)
    real_resize_factor = new_shape / image.shape
    new_spacing = spacing / real_resize_factor

    image = nd.interpolation.zoom(image, real_resize_factor, mode='nearest')

    return image

# For the sake of testing the network, we'll be using the sample dataset
# For this, we'll use the maximum size of the image
# and PAD any image with -1000 values which is smaller than that

#PS: only the first dimension is different in sample dataset
#which is not the case in actual dataset
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号