%To quantify the total number of Zombie Red pixels %Input the directory and name of the image files fileDirectory = ; imageZRName = ; %Input the number of samples numberOfSample = ; %Input the region of interest for Zombie Red startDepthZR = ; endDepthZR = ; startTransverseZR = ; endTransverseZR = ; %Input the threshold for Zombie Red selection tValueZR = ; %Initialize the variables imageZRSelectedT(1:endDepthZR-startDepthZR+1,1:endTransverseZR-startTransverseZR+1) = 0; resultZR(1:numberOfSample) = 0; %Go through each image sample for i = 1:numberOfSample %load the images imageZR = imread(strcat(fileDirectory,imageZRName,int2str(i),'.tif')); %Select the region of interest for Zombie Red imageZRSelected = imageZR(startDepthZR:endDepthZR,startTransverseZR:endTransverseZR); %threshold for Zombie Red selection imageZRSelectedT((imageZRSelected>tValueZR)) = 1; %Show the Zombie Red pixels with an image figure(1) imshow(imageZRSelectedT,[]); %Calculate the total number of Zombie Red pixels resultZR(i) = sum(sum(imageZRSelectedT)); end