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

Tiling Artefact (plant-seg 2.0.0a5) #367

Closed
Amerebeing opened this issue Nov 27, 2024 · 12 comments
Closed

Tiling Artefact (plant-seg 2.0.0a5) #367

Amerebeing opened this issue Nov 27, 2024 · 12 comments
Assignees
Labels
question Further information is requested

Comments

@Amerebeing
Copy link

Getting tiling artefact when using napari plugin of plantseg. I am using lightsheet_3D_unet_root_nuclei_ds1x model to segment my nuclei. The tiling artefact is affecting the final segmentation.
image

@Amerebeing Amerebeing changed the title Tiling Artefact Tiling Artefact(plant-seg 2.0.0a5) Nov 27, 2024
@qin-yu
Copy link
Collaborator

qin-yu commented Nov 27, 2024

Hey @Amerebeing thank you for reporting this issue!

I offer two things to try - either you send me this volume for me to try it; or you can try these yourself:

  1. rescale your volume to match the voxel size of the model by "Set Voxel Size" and "Rescale Image (to model voxel size)";
  2. increase the halo from 44 to, say, 64, in "Show advanced parameters" in "Image to Prediction", but you may need to reduce the patch shape accordingly.
  3. just try PlantSeg_3Dnuc_Platinum

You can do these separately or together and see if the prediction is improved.

@qin-yu qin-yu added the question Further information is requested label Nov 27, 2024
@qin-yu qin-yu changed the title Tiling Artefact(plant-seg 2.0.0a5) Tiling Artefact (plant-seg 2.0.0a5) Nov 27, 2024
@qin-yu
Copy link
Collaborator

qin-yu commented Nov 27, 2024

I just tried all three separately on one of my dateset, and all improved.

@qin-yu
Copy link
Collaborator

qin-yu commented Nov 27, 2024

@Amerebeing
Copy link
Author

I tried the suggested solutions which you had provided and that really helped me to get rid of the tiling artefact. But there is another issue with the final segmentation. I thought that the artefact in the final segmentation was because of the tiling in the boundary image which was being produced by Plantseg Model. But even after getting rid of tiling in boundary image i am getting these artefacts in the final segmentation.
Screenshot 2024-11-27 204238
This is the link for original image i am working with: https://drive.google.com/file/d/1XYk89fBXLXVfx3MPVP-RCTov_e6ncZLU/view?usp=drive_link

@Giannisbiol
Copy link

Hi,

I get also these kind of "thin" labels. I have noticed that playing a bit with the watershed and the agglomeration method, these can totally (mostly) vanish or become more abundant. If the boundary prediction is perfect though, then it looks even better. Unfortunately, in my case (roots), there is no standard set up of the segmentation. Most of the time if it is good on one image, it will be ok on the next one too but it can vary, even if acquisition parameters are all the same.

@qin-yu
Copy link
Collaborator

qin-yu commented Dec 4, 2024

Did you try the PlantSeg_3Dnuc_platinum model? It gives a nuclei probability map and a nuclei boundary probability map. If you use the Remove Objects with Low Foreground Probability widget, you can remove the false positives.

@qin-yu
Copy link
Collaborator

qin-yu commented Dec 4, 2024

I just tried to run PlantSeg_3Dnuc_platinum and default 3D watershed + GASP on your image and the result look okay:

segmentation  | raw
boundary pred | foreground pred

image

@qin-yu
Copy link
Collaborator

qin-yu commented Dec 4, 2024

Hey @Amerebeing, GoNuclear repo has three models: Cellpose, PlantSeg and StarDist, where PlantSeg_3Dnuc_platinum is the PlantSeg model. Here I used GoNuclear's run-stardist for you: Side_rAP2_16LDs_SAM4_nuclei_Z0.400_X0.291_Y0.291_Sz453_Sx800_Sy800_segmentation.tif.zip. If you are interested, check how to use it here: https://github.com/kreshuklab/go-nuclear/tree/main/stardist

image

@Amerebeing
Copy link
Author

hey @qin-yu The Platinum model performs well on my 3D volume when I downsample it by a factor of 2. Adjusting the Watershed and GASP parameters also helps in reducing artifacts in the final segmentation. I’d like to know the original voxel size the Platinum model was trained on, as my original volume (voxel size: 0.30 × 0.17 × 0.17) produces a faded probability map without downsampling.
image

On downsampling i am getting better results
image

@qin-yu
Copy link
Collaborator

qin-yu commented Dec 5, 2024

Hey @Amerebeing, for your convenience, here’s the voxel size:

original_voxel_size = {  # z, y, x
    1135: [0.28371836501901143, 0.12678642066720086, 0.12678642066720086],  # validation
    1136: [0.2837183895131086,  0.12756971653115998, 0.12756971653115998],  # training
    1137: [0.2837183895131086,  0.1266211463645486,  0.1266211463645486 ],  # training
    1139: [0.2799036917562724,  0.12674335484590543, 0.12674335484590543],  # training
    1170: [0.27799632231404964, 0.12698523961670266, 0.12698522349145364],  # training
}  # [0.2837, 0.1268, 0.1268] is taken as the median

original_median_extents = {  # z, y, x
    1135: [16, 32, 33],  # validation
    1136: [16, 32, 32],  # training
    1137: [16, 32, 32],  # training
    1139: [16, 32, 33],  # training
    1170: [16, 29, 30],  # training
    'average':
}  # [16, 32, 32] is taken as the median

For reference, the training data for my Platinum model is described in the GoNuclear repository: GoNuclear Training Data. You can also find detailed information in the paper: Materials and Methods.

The training data itself is available at the BioImage Archive: S-BIAD1026.

@qin-yu
Copy link
Collaborator

qin-yu commented Dec 13, 2024

Hey @Amerebeing is the issue solved?

@Amerebeing
Copy link
Author

Hey @qin-yu, thanks for checking in! I scaled my 3D volume by a factor of 0.7, and it's working perfectly. Any scaling below 0.7 causes the nuclei to merge, but the range of 0.7 to 0.75 seems to be the sweet spot. I'm quite happy 😊 with the results!

@qin-yu qin-yu closed this as completed Dec 16, 2024
@qin-yu qin-yu self-assigned this Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants