RodDalBen/SHINE_color

Possible Bug in separate.m

Closed this issue · 3 comments

Dear Shine Team,

first of all, thank you for sharing the toolbox and all the work you have put into this project! We have been using the toolbox for quite some time and are glad that you are offering a solution.

I've opened this Issue, because I found a possible bug in the file separate.m in line 61: background = image(find(max(imhist(image))));

Since the result of max(imhist(image)) is a single value the command: find(max(imhist(image))) always results in 1. That means that the command: background = image(find(max(imhist(image)))) is the same as background = image(1). The variable background holds the value of the first entry in the image matrix.

I assume that the value of the optional argument 3 should be computed . This would be possible with this code:
[~, background] = max(imhist(image));

Please let me know what you think and if I'm right with my assumption.
Best,

Tobias

Hi Tobias!

Thanks for your message. Indeed max(imhist(image)) returns a single value and therefore find(max(imhist(image))) always results 1. Thanks for pointing that out.

However, even with the suggested fix, during our tests, we are still getting a wrong mean and SD after processing the images. I will continue to investigate and get back with a solution.

Best,
Pedro

Hello Pedro,

thank you for your reply and for taking care of the problem.
Let me know if there is anything I can do to help.
Best,

Tobias

Hi Tobias, sorry for the long delay in answering. Rodrigo and I found the issue and we just pushed a new version to the main branch. It turns out that there was a variable being overwritten in processImage.m, causing the background value to be lost.

It should be working now. Thanks for your input and please let us know if you find any other issues.

Regards,
Pedro and Rodrigo