Giter Site home page Giter Site logo

Comments (10)

Henley13 avatar Henley13 commented on August 13, 2024

Hi @rahmas36,

Unfortunately the current bigfish.stack.read_image function does not read the .CZI file. You are the first user to ask and I did not have any sample to implement it. Would you mind send me a small .CZI file ? I will see how we can update our I/O functions for the next release.

In the meantime, you might need a small piece of code, maybe using an external package, to read your file in Python (independently from bigfish) or convert it in TIFF file (or any other format bigfish.stack.read_image can read). Inside the package, images are just treated like numpy arrays.

from big-fish.

rahmas36 avatar rahmas36 commented on August 13, 2024

Hi thanks for your reply. I am trying to load a tif file from my Downloads folder into Big-FISH but I get an error.

(bigfish_env) c02v50nrj1g5:~ samirrahman$ bigfish.stack.read_image(/Users/samirrahman/Downloads/NPC_CUX2_1.tif,sanity_check=False)
-bash: syntax error near unexpected token `/Users/samirrahman/Downloads/NPC_CUX2_1.tif,sanity_check=False'
Sorry, my experience with running command lines in Python is limited.

from big-fish.

rahmas36 avatar rahmas36 commented on August 13, 2024

Hi, I've been able to perform a maximum intensity projection and spot detection for one of my files, but the spot detection seems way off. I attached a screenshot of the result.
These are the command lines:

rna_mip = stack.maximum_projection(rna)
print("smfish channel (2D maximum projection)")
smfish channel (2D maximum projection)
print("\r shape: {0}".format(rna_mip.shape))
shape: (1460, 1936)
spots, threshold = detection.detect_spots(
images=rna,
return_threshold=True,
voxel_size=(300, 103, 103),
spot_radius=(350, 150, 150))
print("detected spots")
detected spots
print("\r shape: {0}".format(spots.shape))
shape: (84862, 3)
print("\r dtype: {0}".format(spots.dtype))
dtype: int64
print("\r threshold: {0}".format(threshold))
threshold: 21.0
plot.plot_detection(rna_mip, spots, contrast=True)

Do I have to play around with voxel size, and spot radius?
Screen Shot 2022-08-01 at 11 01 35 AM

from big-fish.

rahmas36 avatar rahmas36 commented on August 13, 2024

When I run the script on another gene CUX2 (the former is NEUROD1), the script works much better with the same parameters of spot detection.
Screen Shot 2022-08-01 at 11 33 32 AM

from big-fish.

Henley13 avatar Henley13 commented on August 13, 2024

Hi @rahmas36 ,

I am not sure what you mean by "running command lines in Python". You can't run Python code directly in the terminal. You should enter into a Python prompt instead (simply use the command python in your bash terminal) or write you Python code in a .py text file and run the script through you bash terminal with python my_path/my_script.py(and replace my_path/my_script.py with the actual path of your Python script). You can also use IPython notebooks to test your Python code.

As for your images, they seem highly saturated (but maybe it is just the contrast from the plot - you can use rescale=True in the plot function instead of contrast=True). Your first image might not have enough individual spots that can be detected and used as a reference to automatically calibrate the rest of the algorithm. For the bigfish.detection.detect_spot function you can provide a list of images instead of an individual image. The detection will be perform on all the images at once and this could help the analysis of images with few spots.

As you said, you can tune the voxel_size and object_size parameters. They should be given in nanometer for bigfish.detection.detect_spot. The voxel_size depends of your experiment. The object_size is the expected size of the spot you want to detect you can roughly estimate it by zooming in your images, around some individual spots. These parameters should be the same for every images of your experiment.

from big-fish.

rahmas36 avatar rahmas36 commented on August 13, 2024

Hi @henly13, thank you so much for your reply. I have been able to optimize spot detection quite well for my genes of interest, and nuclear segmentation works well, as long as nuclei are spaced apart rather than clumped. I also used the background signal in the GFP channel for cellular segmentation, which works ok, but could probably be improved. Is it possible to detect spots from RNAs labeled in different dyes at the same time. Also, how do you provide a list of multiple images?

from big-fish.

Henley13 avatar Henley13 commented on August 13, 2024

I have been able to optimize spot detection quite well for my genes of interest, and nuclear segmentation works well, as long as nuclei are spaced apart rather than clumped. I also used the background signal in the GFP channel for cellular segmentation, which works ok, but could probably be improved.

Good to know. Indeed the segmentation methods implemented are simple, but they allow a quick result and might be useful for a first try. You can probably optimize it with a dedicated segmentation model online. Some references are available in our example notebook.

Is it possible to detect spots from RNAs labeled in different dyes at the same time.

I am not sure to understand what you mean. Could you give me an example ?

Also, how do you provide a list of multiple images?

Your image is a multidimensional ndarray, just feed bigfish.detection.detect_spot with a Python list of these ndarrays. Something like:

import bigfish.detection as detection

# parameters
voxel_size = ...
spot_radius = ...

spots = detection.detect_spots(
        images=[image_1, image_2, image_3],
        voxel_size=voxel_size,
        spot_radius=spot_radius)

In this case, spots will be a list of coordinates arrays, one per image. If you don't mention it, the threshold will be estimated automatically, but the same threshold for all the images. In consequence, you should provide image with a similar intensity distribution, for example images of different fields of view, but from the same experiment.

from big-fish.

rahmas36 avatar rahmas36 commented on August 13, 2024

Hi I loaded 2 different images but when I print out spots, it only gives me the spots for one image.

path = os.path.join(path_input,"CUX2_NPC_1.tif")
rna1 = stack.read_image(path)
rna1_mip = stack.maximum_projection(rna1)
path = os.path.join(path_input,"CUX2_NPC_2.tif")
rna2 = stack.read_image(path)
rna2_mip = stack.maximum_projection(rna2)
spots, threshold = detection.detect_spots(
images=[rna1, rna2],
voxel_size=(200,72,72),
spot_radius=(1000,450,450))
print("\r shape: {0}".format(spots.shape))
shape: (78, 3)

from big-fish.

Henley13 avatar Henley13 commented on August 13, 2024

Hi @rahmas36,

With your code, spots should be a list of arrays (with the spots coordinates). You can check it's a List with print(type(spots)) and its length with print(len(spots)). By default, detection.detect_spots does not return the threshold value. To return the threshold value you need to specify return_threshold=True. So in your case I suspect that spots is your first coordinate array and threshold the second one (detected from rna2).

You can fix your code with:

spots = detection.detect_spots(
    images=[image_1, image_2],
    voxel_size=voxel_size,
    spot_radius=spot_radius)

Or:

spots, threshold = detection.detect_spots(
    images=[image_1, image_2],
    voxel_size=voxel_size,
    spot_radius=spot_radius,
    return_threshold=True)

from big-fish.

rahmas36 avatar rahmas36 commented on August 13, 2024

Hi, thanks for your reply. I was actually able to localize spots from mRNAs of 2 different genes a while back. I specified them as rna_1, and rna_2.

from big-fish.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.