Counting number of voxels above threshold from a tiff file

8 ビュー (過去 30 日間)
Michael J
Michael J 2015 年 7 月 7 日
回答済み: Michael J 2015 年 7 月 15 日
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!

採用された回答

Michael J
Michael J 2015 年 7 月 15 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange3-D Volumetric Image Processing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by