I solved the problem! After thresholding in ImageJ, I would click 'apply' which would change the image to binary and so lead to an erroneous count of voxels. By using the Voxel Counter plugin without clicking apply after thresholding, I would get the same results as my code in MATLAB.
Counting number of voxels above threshold from a tiff file
6 次查看(过去 30 天)
显示 更早的评论
Hello,
I have uploaded a tiff stack into matlab and am trying to count the number of voxels within a certain threshold. The max values of the image is 0 to 255, and my threshold is 75 to 255. The image has been color separated so that it is now just red and black. My code is as follows,
FileTif='ImageStack.tif';
InfoImage=imfinfo(FileTif);
mImage=InfoImage(1).Width;
nImage=InfoImage(1).Height;
NumberImages=length(InfoImage);
FinalImage=zeros(nImage,mImage,NumberImages,'uint16');
for i=1:NumberImages
FinalImage(:,:,i)=imread(FileTif,'Index',i,'Info',InfoImage);
end
idx = find(FinalImage >= 75 & FinalImage <= 255);
length(idx)
My question is whether or not this captures what I said I am trying to do. Or rather, when uploading a tiff stack in this fashion, are the elements of my 3D matrix FinalImage the color values ranging from 0 to 255? I am confident that I am correct as
max(FinalImage(:))
min(FinalImage(:))
returns 255 and 0 respectively, though confusion arises when I use a voxel counter plugin on ImageJ and get a different value. I am not sure if the discrepancy is due to the voxel counting method in the plugin or the way ImageJ thresholds the image stack. Any light shed on the discrepancy would be greatly appreciated!
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 3-D Volumetric Image Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!