Hi and welcome to the forum
Seeing your image, and the low contrast between the two structures, I would not recommend a segmentation approach. You’ll notice that the black part of your mask image does not necessarily mark the edge of what you are measuring.
Another approach could be to detect peaks on the line profile you draw, and extract the two largest to finally computing the distance between these two.
I have attached an ImageJ macro that does this.
Just download the .ijm file and open it in Fiji, you should then be able to hit the Run button to start it. Draw a line on the image first to avoid the interactive prompt-
It seems to work rather well on your image, but I’d be curious of the result on the real dataset.
- Filter the image with a median filter to preserve edges and remove the white speckles.
- Get the values along the line and try to find exactly two peaks.
- Make a line where the two peaks were found and output the length.
If you want to see how it works, you should remove line 17
setBatchMode(true), then you can see the intermediate images that the macro uses.
Hope this helps!