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 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Michael J
el 7 de Jul. de 2015
Respondida: Michael J
el 15 de Jul. de 2015
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 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre 3-D Volumetric Image Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!