scipy.ndimage

Using regionprops in Python

徘徊边缘 提交于 2021-02-04 19:59:36
问题 I am trying to analyze greyscale TIFF stacks, in which a given frame will look like this. I filter it (using Gaussian blur), and then binarize it (using Otsu's method for threshold). MATLAB code, which works great: image_conncomp = bwconncomp(image_binary); # entire stack is held in image_binary for i=1:image_conncomp.NumObjects object_size = length(image_conncomp.PixelIdxList{i}); end Each white spot in the example image is picked up, and its volume (in pixels) is pretty accurately given by

Using regionprops in Python

那年仲夏 提交于 2021-02-04 19:59:32
问题 I am trying to analyze greyscale TIFF stacks, in which a given frame will look like this. I filter it (using Gaussian blur), and then binarize it (using Otsu's method for threshold). MATLAB code, which works great: image_conncomp = bwconncomp(image_binary); # entire stack is held in image_binary for i=1:image_conncomp.NumObjects object_size = length(image_conncomp.PixelIdxList{i}); end Each white spot in the example image is picked up, and its volume (in pixels) is pretty accurately given by

Any recommendation to resize 3d image array which consists of only 0 and 1?

不羁的心 提交于 2020-07-22 08:29:45
问题 I want to resize(downscale) the ground truth 3d images of brain tumor segmentation. Here are some g.t. + brain images: G.t. images are 3d numpy array and consist of only 0 and 1 value(only green voxel and black voxel, brain is not included in g.t. image). def resize(img, shape, mode='nearest', orig_shape=None, order=3): """ Wrapper for scipy.ndimage.zoom suited for MRI images. """ if orig_shape == None: orig_shape = img.shape assert len(shape) == 3, "Can not have more than 3 dimensions"