I have to do an object recognition of the sample in MRI imaging using Matlab. I have values stored as a 3d array of grayscale values. (And the image has the sample in black color and the surrounding fluid in gray color). Looking for a feasible and efficient way to do this. Since the array is as big as 128*128*128, it is taking too much time. I tried to get the coordinates and the values by setting certain cutoff, but its not working as per my requirement as my idea is to find the biggest shape having continuous dark pixels. Any suggestions ?