How to count clustered irregularly shaped cells without dapi?

Hello,

I have images of ganglia with the following staining:
1 Dapi
2 Tubb3 (af488)
3 TH (af568)
4 CHaT (af647)

I have a macro in imageJ in which I set the threshold for each channel, per image and export the data (for example area and %area).
Lately I have noticed that the cell sizes may play a role in the ganglia, so I want to count the cells in a ganglia so that I can learn more about the amount of cells and the size of the cells.

I am not very experienced in image analysis and I have tried to do this in imageJ and Cellprofiler. The biggest issues I ran into are that my cells are irregular in shape, and intensity. This makes segregating the cells a problem for me. Also my dapi staining is not usable in most of my sections, so I will have to use one of the other stainings (probably tubb3, since this is the most prominently present in the ganglia)

Can anyone advice me on how to handle and proceed with this problem? Ideally I would like to use imageJ, since I can then include the script into the one I already have.

Kindly,
Lieke
E11219A_gl16-01_s03_AF488.zip (8.5 MB)

Hi Lieke,

The image you have uploaded is an RGB file and each channel has very little detail (approx 30 levels of grey out of 256). Could you instead upload the original image?

M.

Hi,

Is this any better? The original file is around 300mb, which I can’ t upload because it is too big.
C2-E11219A_gl16.czi -AF488_8bitt.zip (11.5 MB)

If you generate a free gmail account, you should be able to share up to ~15GB images on GoogleDrive. Or FireFox Send can handle up to 1GB, I think.

Okay does this work? https://1drv.ms/u/s!AnS5aJ8Q-_bco2r5nKLvla-dHVeu?e=E6eaax

1 Like

Hi Lieke,

That’s much better, thank you. The files are large .czi so you could reduce them by cropping just the region of interest and clearing everything around. You could do this automatically using the third and fourth channels:

duplicate your image
split channels
use Image Calculator plus to add channel 3 and 4
Threshold and use Analyze Particle to select the large ganglion (I used the size filter: everything above 12 000 pixels selected)
Apply the ROI to the original image, crop and clear outside

Once done, you can start selecting your neurons If I were you, I would train an AI software to recognise them - Ilastik for example.

From your image, using Pixel Classification, I have this:Lieke Cropped _Simple Segmentation.tif (5.8 MB)

I trained Ilastik to recognise 4 features: 1) background (black), 2) nerve fibers (yellow), 3) nuclei (red) and 4) neurons (green) using the cropped image with the last three channels.

The export segmentation file contains an image with 4 values (1-4) which you can visualise using Glasbey LUT and threshold for value 3 to obtain the nuclei and 4 to obtain the cytoplasms. These binary files can then be used in CellProfiler to recognise PrimaryObjects.

The advantage of this training is that if you have more images of the same quality, you can script a trained Ilastik for analysis.

M.

1 Like

Hi @MatthieuV

Thank you for you help so far already! I have looked into iLastik and it seems quite user friendly. When I want to create a new project in iLastik, which option fits best with what I need? Do I just use the pixel classification?
And how do I script a trained ilastik for analysis? I noticed that I can save the project and export some data, but how do I integrate and automate this in a scrip? And do I make the script in fiji, or in some other way?

Sorry for all these questions, I am still very new to all this. I have only made some macro’ s in fiji. If you could point me in the right direction, that would be a great help already!

Kindly,
Lieke

Hi Lieke,

You first need to run “Pixel Classification” on Ilastik. If I were you, I’d run the classification on at least 3 different images to make sure that Ilastik recognises the features you are looking for regardless of variation between images. Once this is done, save the Ilastik project.

Go back to Fiji:

  1. Install Ilastik plugin in Fiji (Help> Update…, Manage Update sites>iLastik).
  2. In Plugin>Ilastik, click on “Configure Ilastik Executable location” and find where your Ilastik.exe is.
  3. Once this is done, go back to Plugin>Ilastik>Run Pixel Classification Prediction. You will be asked where the Ilastik project is. Your prediction file will open as a new window. This is a manual step to confirm that the prediction works. When you are happy, you can start scripting

As far as scripting this -and please bear in mind that I’m a newbie- the command lines probably will look like this:

#@File(label="Choose the Pixel Classification File", description="Enter an ilastik project (ilp) file", style="extension:ilp") IlastikProject

InputDir=getDirectory("Please choose folder containing your image files");
OutputDir=getDirectory("Where would you like the results to be saved?");
myList=getFileList(InputDir);

for (j = 0 ; j < myList.length ; j++ ){
	path=InputDir+myList[j];   
	open(path);
	FileName=File.nameWithoutExtension;
	FullFileName=File.name;
	print("Processing "+FileName);

	run("Run Pixel Classification Prediction", "projectfilename=["+IlastikProject+"] inputimage=["+FullFileName+"] pixelclassificationtype=Segmentation");
	run("glasbey_on_dark");
	rename(FileName+"_Segmentation");

//your image processing

}

The first line needs to be at the beginning of your macro and asks where the Ilastik project is. I’m not sure why it’s only showing “Choose a file” and not “Choose the Pixel Classification File”… but it works. Absence of a semicolon at the end of this line is not a mistake!

If anyone has better scripting, I’d be eternally grateful :wink:

M.