brainglobe / cellfinder

Automated 3D cell detection in very large images
https://brainglobe.info/documentation/cellfinder/index.html
BSD 3-Clause "New" or "Revised" License
179 stars 39 forks source link

[BUG]failed cellfinder #145

Closed cindy12-gao closed 3 years ago

cindy12-gao commented 3 years ago

Describe the bug I`ve successfully made a registration between my background channel and atlas, but when I ran cellfinder, there is always error, which no atlas existing.

To Reproduce 2020-10-13 17:51:48 PM - WARNING - MainProcess prep.py:405 - Atlas does not exist, downloading.

Expected behavior I want detect brain signal and counting the cell signal in each brain area.

Log file

Screenshots (cellfinder) C:\Users\CIBR-ImFacility-WS2>cellfinder -s H:\cellfinder_data_test\signal -b H:\cellfinder_data_test\background -o H:\cellfinder_data_test\output --register --orientation coronal -x 1.625 -y 3 -z 1.625 2020-10-13 17:51:48 PM - INFO - MainProcess fancylog.py:267 - Starting logging Downloading... 2020-10-13 17:51:48 PM - INFO - MainProcess fancylog.py:269 - Multiprocessing-logging module found. Logging from all processes 2020-10-13 17:51:48 PM - INFO - MainProcess main.py:32 - Registering to atlas 2020-10-13 17:51:48 PM - INFO - MainProcess prep.py:401 - Checking whether the atlas exists 2020-10-13 17:51:48 PM - WARNING - MainProcess prep.py:405 - Atlas does not exist, downloading.

Desktop (please complete the following information):

Additional context my order: cellfinder -s H:\cellfinder_data_test\signal -b H:\cellfinder_data_test\background -o H:\cellfinder_data_test\output --register --orientation coronal -x 1.625 -y 3 -z 1.625

and it also confuse me that do I need define the orientation(coronal) asl just like the definition of brainreg? @adamltyson

cindy12-gao commented 3 years ago

cellfinder_2020-10-13_17-51-48.log

adamltyson commented 3 years ago

Hi @cindy12-gao, that warning is just that, a warning, it's not an issue. The software will just download the atlas that it needs.

That being said, I think there might be an incompatibility between the (newer) version of brainreg and the version of cellfinder you have. Could you try creating a new conda environment and installing the new version of cellfinder (pip install cellfinder==0.4.0)?

You will get version 0.4.0, which unfortunately is a fairly major change, and the usage instructions have changed. You can find the release notes here, new instructions here, and a tutorial here.

The main changes (for you, based on your command is that):

One last point, I just want to check your pixel sizes. Did you re-slice your data (e.g. from a horizontal acquisition to coronal)? I ask because it would be weird for you to have a z resolution (plane spacing) of 1.625 microns, and then an in plane resolution of 1.625 x 3 microns. If this is all right, then no problem!

Either way, the new way of entering your voxel sizes should be -v A B C where:

cindy12-gao commented 3 years ago

thank you for your answer~ Ive tried the version 0.4.0, it works well, and the -v definition I think is right. the data was captured by lightsheet and the orientation was horizontal, and then I rotated it to the coronal , so thats why the -V was strange. then there also was a problem that I can`t detect any cell from my data. the order as follows: cellfinder -s H:\cellfinder_data_test\signal -b H:\cellfinder_data_test\background -o H:\cellfinder_data_test\output -v 1.625 3 1.625 --orientation asl --no-register --start-plane 3000 --end-plane 3020 --soma-diameter 3

adamltyson commented 3 years ago

the data was captured by lightsheet and the orientation was horizontal, and then I rotated it to the coronal

Ok great, that makes sense.

Your parameters look ok, but I would check two things:

cindy12-gao commented 3 years ago

actually, Ive tested the whole brain slice, and the cell diameter was default, and the results shows no cell detected; so I analysis only 20 planes just want to test the parameter. Im confused why there is no cell detected?

adamltyson commented 3 years ago

Im confused why there is no cell detected?

I can't really tell without seeing the data. Are you able to share the whole image?

cindy12-gao commented 3 years ago

signal_coronal3000 signal_coronal3001 it`s the plane3000 and the plane 3001.

adamltyson commented 3 years ago

Hi @cindy12-gao, it looks like you have pretty low SNR and resolution. I can't say much more without seeing the full data.

Is your problem that you see no cell candidates, or no classified cells?

cindy12-gao commented 3 years ago

cellfinder_2020-10-19_18-26-02.log it`s the log file. I saved the data as PNG, maybe loss some resolution

adamltyson commented 3 years ago

Ok, so no cell candidates have been detected. If you can send me the data, I can take a look, otherwise I can only recommend adjusting the detection parameters.

cindy12-gao commented 3 years ago

its almost 200GB, Im not sure how to send you my data.

adamltyson commented 3 years ago

Do you have Dropbox, or some kind of institutional file sharing platform?

If you could send me 100 or so consecutive planes, that would help.

cindy12-gao commented 3 years ago

Ive shared the folder signal&background with the email address--notifications@github.com by Dropbox.Im not sure whether you can view the data. hope for your reply! thank you~

adamltyson commented 3 years ago

I think that address is just the email address GitHub send emails from. Could you share it with adam.tyson@ucl.ac.uk?

Thanks!

cindy12-gao commented 3 years ago

ok, I`ve share the folder with this email address. thank you~


发件人:Adam Tyson notifications@github.com 发送时间:2020年10月20日(星期二) 18:49 收件人:brainglobe/cellfinder cellfinder@noreply.github.com 抄 送:高辛未 gaoxinwei@cibr.ac.cn; Mention mention@noreply.github.com 主 题:Re: [brainglobe/cellfinder] [BUG]failed cellfinder (#145)

I think that address is just the email address GitHub send emails from. Could you share it with adam.tyson@ucl.ac.uk? Thanks! — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

adamltyson commented 3 years ago

Thanks for sending the data @cindy12-gao, I haven't forgotten, I'm just a bit swamped at the moment.

cindy12-gao commented 3 years ago

it doesn`t matter. can you try to detect signal from the data?


发件人:Adam Tyson notifications@github.com 发送时间:2020年11月5日(星期四) 18:07 收件人:brainglobe/cellfinder cellfinder@noreply.github.com 抄 送:高辛未 gaoxinwei@cibr.ac.cn; Mention mention@noreply.github.com 主 题:Re: [brainglobe/cellfinder] [BUG]failed cellfinder (#145)

Thanks for sending the data @cindy12-gao, I haven't forgotten, I'm just a bit swamped at the moment. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

adamltyson commented 3 years ago

Hi @cindy12-gao, I had a look at your data, and I found that the reason you weren't detecting any cell candidates was because there's a very narrow border of zero intensity around your images. cellfinder assumes that the very edges of your image contain background signal, so this messed up the detection. I've fixed this, and now candidates are detected.

detection

The cell detection works ok (but still needs optimising) with the default parameters, but the classification is very bad. I think this is due to three things:

Lastly, there are a lot of striping and stitching artefacts in the data, without this being fixed (and the channel alignment), you may not get very good analysis results.

P.S. I'll release the new, updated version of cellfinder later today. By tomorrow, you should be able to run pip install cellfinder --upgrade to get the new version. Can you let me know if this works?

cindy12-gao commented 3 years ago

thank you! can you send me the fixed parameters of the cell detection? it`ll teach me how to set the parameter.


发件人:Adam Tyson notifications@github.com 发送时间:2020年11月6日(星期五) 22:53 收件人:brainglobe/cellfinder cellfinder@noreply.github.com 抄 送:高辛未 gaoxinwei@cibr.ac.cn; Mention mention@noreply.github.com 主 题:Re: [brainglobe/cellfinder] [BUG]failed cellfinder (#145)

Hi @cindy12-gao, I had a look at your data, and I found that the reason you weren't detecting any cell candidates was because there's a very narrow border of zero intensity around your images. cellfinder assumes that the very edges of your image contain background signal, so this messed up the detection. I've fixed this, and now candidates are detected. [detection] The cell detection works ok (but still needs optimising) with the default parameters, but the classification is very bad. I think this is due to three things: The data is very different to the training set, you will need to retrain it The image channels aren't aligned very well, can this be improved? The classification network assumes that the first dimension in your dataset corresponds to the axial plane. Can you rerun cellfinder with the original, horizontally acquired data? Lastly, there are a lot of striping and stitching artefacts in the data, without this being fixed (and the channel alignment), you may not get very good analysis results. P.S. I'll release the new, updated version of cellfinder later today. By tomorrow, you should be able to run pip install cellfinder --upgrade to get the new version. Can you let me know if this works? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

adamltyson commented 3 years ago

I didn’t optimise the cell detection, I just used the default parameters.

Is the new software version working for you?

cindy12-gao commented 3 years ago

I`ve updated the version cellfinder==0.4.5