Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to normalize the nuclear distance channel? #7

Closed
JimmyCai91 opened this issue Nov 12, 2022 · 5 comments
Closed

How to normalize the nuclear distance channel? #7

JimmyCai91 opened this issue Nov 12, 2022 · 5 comments

Comments

@JimmyCai91
Copy link

Hi, great work!

Image data downloaded from those image_data0x.npy files has un-normalized nuclear distance channel. Would be nice if you can provide the way that to normalize the channel to -1 and 1.

Thanks.

@li-li-github
Copy link
Collaborator

Hi,

We didn't normalize nuclear distance and I think you shouldn't. Instead, it is rescaled by 0.01.

intensity_adjustment_default = {'pro': 1, 'nuc': 1, 'nucdist': 0.01}

@JimmyCai91
Copy link
Author

JimmyCai91 commented Nov 14, 2022

Hi,

We didn't normalize nuclear distance and I think you shouldn't. Instead, it is rescaled by 0.01.

intensity_adjustment_default = {'pro': 1, 'nuc': 1, 'nucdist': 0.01}

Hi @li-li-github

Thanks for your reply. I was using the main branch and didn't notice that there is a pytorch branch. Will take a look. Thanks.

Would you please also help to double check this rescale operation actually aligns with the statement in the paper's method section (https://www.nature.com/articles/s41592-022-01541-z#Sec15) that "The raw pixel intensities in the fluorescence channel are normalized between 0 and 1, and the nuclear distance channel is normalized between −1 and 1."

Thanks,

@Yuangaga
Copy link

Hi @li-li-github.

Thanks for your advice. As suggested, I have successfully achieved nuclear segmentation with StarDist.
截屏2022-11-15 下午2 57 56

But, I'm also curious about how to get the nucleus distance matrix from the segmented picture. Could I reference the code for computing nucleus distance? Thanks.

截屏2022-11-15 下午2 53 59

@li-li-github
Copy link
Collaborator

Hi @JimmyCai91 and @Yuangaga
I'm very sorry for the late reply.
After checking my old code and recalling my memory, I think what I meant was
making -1 <= the values in the nuclear distance channel =< 1
So it's not "normalized."

This was done by rescaling the channel with 0.01. Throughout the whole dataset that we are offering in this repo, the min value of the nuclear distance channel after rescaling is -1.053 and there are only 118 pixels that are lower than -1, so they should be negligible.
The max value is well below 1.

The idea of making the nuclear distance in [-1, 1] was because, without rescaling, the large values in the nuclear distance channel would overwhelm other channels, resulting in unsuccessful training.

I hope this answered your question.

@JimmyCai91
Copy link
Author

JimmyCai91 commented Dec 1, 2022

Hi @li-li-github ,

Thanks for the reply. It reads great!
I will close this issue.

Thanks,


@Yuangaga if you need more info, feel free to start a new issue.

li-li-github added a commit that referenced this issue Feb 23, 2023
* added vanilla.py, test_vanila.py

* modified vanilla.py

* modified vanilla.py

* finished vanilla.py for now

* added test_VanillaAE;
modified VanillaAE

* added basetrainer.py

* trying to stop codecov warning on PR

* trying to stop codecov warning on PR

* added test_basetrainer.py

* updated VanillaAETrainer;
modified BaseTrainer;
WIP: added test_VanillaAETrainer;

* First fittable VanillaAETrainer

* fixed a bug in BaseTrainer

* WIP: added vq.py

* WIP: modified vq.py

* refactored models to trainer

* added blank test_vq.py

* updated vq.py

* modified test_vq.py; fixed some bugs in vq.py

* WIP: refactor base trainer

* Major refactoring in trainer and model structure

* added index_histogram in VectorQuantizer

* fixed bugs in vq.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants