Automatic Nuclei Count tif stacks
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am using this borrowed code to automatically count DAPI stained nuclei:
Hs.dirPath = pwd;
[Hs.dataFiles,Hs.dataNums] = getDataFiles(Hs.dirPath);
[Hs.foundChannels,Hs.fileNums,Hs.imgExts] = getImageFiles(Hs.dirPath);
for i = 1:length(Hs.fileNums)
Hs.fileNum = Hs.fileNums(i);
fileName = ['dapi' sprintf('%03d',Hs.fileNum) '.tif'];
Hs.DI = readmm(fileName);
Hs.DI = Hs.DI.imagedata;
Hs.DI = scale(max(Hs.DI(:,:,round(linspace(10,size(Hs.DI,10),50))),[],3));
binDapi = Hs.DI>adaptthresh(Hs.DI);
masktmp = imclearborder(binDapi | ~Hs.DI);
masktmp = bwareaopen(masktmp,50);
if any(masktmp(:))
binDapi = masktmp;
end
L = bwlabel(binDapi);
numObjects = max(L,[],1:2);
Hs.currObjs = [];
Hs.allMasks = [];
for j = 1:numObjects
fnumStr = sprintf('%03d',Hs.fileNum);
objMask = L == j;
newObj = improc2.buildImageObject(objMask, fnumStr, Hs.dirPath);
Hs.currObjs = [Hs.currObjs, newObj];
Hs.allMasks = cat(3,Hs.allMasks,objMask);
end
objects = Hs.currObjs;
save(sprintf('%s%sdata%03d.mat',Hs.dirPath,filesep,Hs.fileNum),'objects');
[Hs.dataFiles,Hs.dataNums] = getDataFiles(Hs.dirPath);
clear objects;
Hs.currObjs = [];
end
It ends up fusing nuclei that are on different planes. In the image shown here (Matlab Output on the left and original on the right)
there should be 14 nuclei but 1 and 6, 2 and 5 and 3 and 7 end up being counted as the same.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/537501/image.png)
I have tried changing the threshold etc. but it does not help with the stacks.
Any suggestions to modify the code? Thanks.
0 Commenti
Risposte (1)
Abhinav Aravindan
il 24 Apr 2024
I understand that you are encountering an issue with counting the number of nuclei in a TIF image, specifically when two nuclei are mistakenly counted as one. I recommend referring to the example in the “Image Processing Toolbox” on how to “Detect and Count Cell Nuclei in Whole Slide Images”.
I hope this helps solve your problem!
0 Commenti
Vedere anche
Categorie
Scopri di più su Automated Driving Toolbox in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!