matlab - Counting number of voxels above threshold from a tiff stack -
i have uploaded tiff stack matlab , trying count number of voxels within threshold. max values of image 0 255, , threshold 75 255. image has been color separated red , black. code follows,
filetif='imagestack.tif'; infoimage=imfinfo(filetif); mimage=infoimage(1).width; nimage=infoimage(1).height; numberimages=length(infoimage); finalimage=zeros(nimage,mimage,numberimages,'uint16'); i=1:numberimages finalimage(:,:,i)=imread(filetif,'index',i,'info',infoimage); end idx = find(finalimage >= 75 & finalimage <= 255); length(idx) my question whether or not captures said trying do. or rather, when uploading tiff stack in fashion, elements of 3d matrix finalimage color values ranging 0 255? confident correct
max(finalimage(:)) min(finalimage(:)) returns 255 , 0 respectively, though confusion arises when use voxel counter plugin on imagej , different value. not sure if discrepancy due voxel counting method in plugin or way imagej thresholds image stack. light shed on discrepancy appreciated!
i solved problem , posting answer here if else needs it. clicking 'apply' after setting threshold change binary , lead erroneous result. if set threshold , use voxel counter plugin same result code in matlab.
Comments
Post a Comment