Call4Help: 3D Dense Nuclei Segmentation Challenge

Dear Image Segmentation Experts

@iarganda @dgault @ThomasBoudier

If you have any advice on how to segment such images, it would help us a lot!

(there are some jpeg artefacts, data looks better in real)

Data

Aim

Primarily: Count the nuclei, segmentation does not have to be super accurate.

Challenges

  • Nuclei of different intensities
  • Nuclei have quite different sizes
    • makes DoG + local maxima approaches harder
  • Nuclei are very close, sometimes touching
  • Borders between nuclei cannot always be resolved, especially along the z-axis
  • Nuclei frequently have a dark “hole” in their center
    • e.g. DoG does not enhance nucleus centers but (several) parts at their border

Attempts

For my first attempt can be seen in below macro.
It does at least ‘something’, but not very good yet…

/* 
 *  Segment 3D Nuclei
 *  Author: Christian Tischer
 *  
 *  Requirements: 
 *  - Update Site: IRPB-Plugins
 *  - Update Site: EMBL-CBA
 *  - ImageJ 1.52i
 *  
 */

// open data
//

run("Close All");
open( fullResDataSet );

// make isotropic
// .. the resolution in xy is much better than in z, but I somehow I felt that 
// whatever the algorithm does, it has to work with the worst resolution axis...
// (maybe this is wrong?)
//

getPixelSize(unit, pixelWidth, pixelHeight); 
run("Scale...", "x=&pixelWidth y=&pixelHeight z=1.0 interpolation=Bilinear average process create title=raw-iso");

// correct intensities along z-axis
// (this could be improved during imaging)
//

decayLength = 70.0; // in pixels
specimenStartSlice = 40.0; // in pixels

selectWindow("raw-iso");
makeOval(108, 42, 41, 44);
run("Plot Z-axis Profile");

selectWindow("raw-iso");
run("Select None");
for (i = 1; i <= nSlices; i++) 
{
	if ( i > specimenStartSlice )
	{
		corr = 1.0 / exp( - 1.0 / decayLength * ( i - specimenStartSlice ) );
		setSlice( i );
		run("Multiply...", "value=&corr slice");
	}
}

selectWindow("raw-iso");
makeOval(108, 42, 41, 44);
run("Plot Z-axis Profile");
selectWindow("raw-iso");
run("Select None");

// generate whole specimen mask
// (to later remove segmented "outside" regions) 
// 

// threshold
selectWindow("raw-iso");
run("Duplicate...", "title=raw-iso-bw duplicate");
setThreshold(25, 255);
setOption("BlackBackground", true);
run("Convert to Mask", "method=Default background=Dark black");

// remove noise and enlarge
run("Minimum 3D...", "x=2 y=2 z=2");
run("Maximum 3D...", "x=4 y=4 z=4");
rename("specimen-mask");

// generate nuclei mask
// (obviously a critical part,
// current choice of Niblack with radius 5 really is just some first shot, 
// one can probably optimize a lot here...)
//

selectWindow("raw-iso");
run("Duplicate...", "title=raw-iso-niblack duplicate");
run("Auto Local Threshold", "method=Niblack radius=5 parameter_1=0 parameter_2=0 white stack");
run("Fill Holes", "stack");

// apply specimen mask
imageCalculator("AND create stack", "raw-iso-niblack","specimen-mask");
rename("nuclei-mask");

// generate nuclei segmentation
//

// watershed
selectWindow("nuclei-mask");
run("Distance Transform Watershed 3D", "distances=[Borgefors (3,4,5)] output=[16 bits] normalize dynamic=0 connectivity=6");

// size filter
run("Label Size Opening", "min=50");
run("Remap Labels");

// display
rename("nuclei-segmentation");
run("glasbey on dark");
setMinAndMax(0, 1000);

// measure
//

run("Analyze Regions 3D", "volume centroid surface_area_method=[Crofton (13 dirs.)] euler_connectivity=C26");

// clean up
//

selectWindow("nuclei-maskdist-watershed"); close();

// visualise interactively in Bdv (one can, e.g., click on objects in the table..)
//

run("Explore MorphoLibJ Segmentation", "labelmask=nuclei-segmentation intensityimage=raw-iso resultstabletitle=nuclei-segmentation-morpho");

Result

Obviously not very nice yet. Some over- and also under-segmentation.

PS

  • is it OK to use your Call4Help trademark here? Otherwise I am happy to remove it :slight_smile:
    @simonfn @szymon.stoma
  • The Kaggle nucleus segmentation challenge was about 2D images, wasn’t it? @AnneCarpenter
5 Likes

Hey @Christian_Tischer,

have you tried the Interactive H Watershed and his best friend the H Watershed?

After some Gaussian Blur (sigma 1.5) I was able to create a segmentation with reasonable quality. The parameter tuning I would do with the expert from biology side :wink:

Cheers,
Robert

10 Likes

I wasn’t aware…looks super useful!

1 Like

Very handy tool. Made by @Benoit back in the days. You can also constraint the resulting label maps as shown in here (slide 30++): https://github.com/mpicbg-scicomp/CourseIntroToIA/blob/master/F_Measurement3D_V5.pptx

Cheers,
Robert

Yes indeed! I am quite certain one can obtain the same results, e.g. using algorithms in MorpholibJ or 3D ImageSuite, but finding the right parameters is really greatly facilitated by this plugin.
Thanks a lot @Benoit!

For me, below worked quite well (there are still some issues at the top and bottom of the stack, but for instance applying an intensity correction along z, e.g. as in above macro should help with this).

open( isotropicImage )
run("Gaussian Blur...", "sigma=1.50 stack");
run("H_Watershed", "impin=[raw-iso.tif] hmin=3.0 thresh=11.0 peakflooding=100.0 outputmask=true allowsplitting=true");

image

2 Likes

Indeed, the 2018 Data Science Bowl at Kaggle was 2D only.

1 Like

Hi @Christian_Tischer, @Benoit, @haesleinhuepf

Yes I guess the difficult part is to find correct seeds for watershed segmentation, and the H-maxima is a very efficient and fast way t to do it.
I also tried the 3D Maxima Finder plugin and obtained similar result, I think the difference between H-maxima and maxima finder is that maxima finder have an additional parameter, the radius of the local maxima filter to find initial seeds and then discard the ones with too low difference (H parameter) with other seeds.

Screenshot_20190304_102731

Best,

Thomas

6 Likes

Hi Christian,

Why not use Ilastik pixel + Multi cut segmentation for Z? Is there any reason not to use Random Forest classifier here and use the conventional CV algorithms instead?

2 Likes

This made me smile :slight_smile: and I am feeling old. My question would be:

Is there any reason not to use conventional CV algorithms here and use Random Forest classifier instead?

4 Likes

Well, if I had to use a conventional CV algorithm I would go for DBScan for such images with python, but there you have to guess initial number of starting clusters and their size, with other tools like snakes you need nice boundaries by first applying median or Gaussian smoothing. But it works for one 3D stack, would it work for the next.

But with lastik pixel + multicut, you choose some parameters and get a superpixel segmented image, it is just that since Ilastik is there now and is easy to use, less parameter selection and higher reproducibilty.

So to answer your question would conventional CV algorithms have the same reproducibility as RF for the next 3D stack that you process or would you have to change radius of Gaussian blur or gradient threshold of snakes? That depends on image quality then also.

Also depending on what the user is ok with H watershed, Snakes, DBScan or just draw a bit in Ilastik :slight_smile:

1 Like

A DBScan reference paper
and
Python Script

1 Like

Yes, please use the Call4Help label.
This fits the idea of it, namely a tool-agnostic image-analysis problem.

2 Likes

Hi @Christian_Tischer,

Have you or anyone else on here tried either Stardist or Cellpose? Both look interesting and maybe able to solve this. I realise you asked this about a one year ago… so maybe you already have a good solution. Let us know what it was if you did.

Thanks!
Luciano

1 Like

Not yet, but would be worth a try for sure. CellPose is however only 2D for now.