Resize 3D binary image by averaging
7 views (last 30 days)
Hi, I want to reduce the size of a binary image stack by averaging the values in 3D. For example if the image is 1260*1260*6. I wrote the code below to process the image to average the values in every 4*4*2 cube thereby creating a new matrix that is 315*315*3 in size.
The problem with this code is that its very slow. Please suggest a faster way. My actual image is super big 2000*2000*2000, so please consider the size when suggesting solutions.
Also, the object in the binary image whose size I want to reduce is cylindrical in shape (like a bunch of circles with equal size stacked together). Since I don't know how to average only the values in the circle, I am first cropping the largest square from the circle and then performing the average. If anyone can think of a way to average only the values in the circle.
I am not using imresize or interp3 because I don't any kind of interpolation, I just want a simple arithmetic average as 1 in the object represents solid and 0 represents void space, so I want to know the mean of solid and void space.