For my research, I am doing MRI image analysis. I have the data in the form of gray levels (only 1 and 0 for dark and bright pixels) in a 3D array. I am looking for a solution to find the boundary between dark and white area and mark the boundary with gray(Similar to the red boundary of the black box as shown in the image). Is there a way to identify the whole boundary?
I have tried using bwboundaries() and bwtraceboundary() functions, but of not much use.
Thanks in advance