function c1 = calc_indices(uid,fieldid,img_type)

	file_name = strcat(uid,"/");
	file_name = strcat(file_name,img_type);
	file_name = strcat(file_name,".png");
	index_image = imread(file_name);
	mask_file_name = strcat(uid,"/");
	mask_file_name = strcat(mask_file_name,"mask_img.png");
	mask_image = imread(mask_file_name);
	%mask_image = imresize(mask_image,[600 600]);
	size_index = size(index_image)
	new_index_image = zeros(size_index(1),size_index(2),3);
	size_mask_img = size(mask_image)
	index_0 = 0;
	index_01 = 0;
	index_02 = 0;
	index_03 = 0;
	index_04 = 0;
	index_05 = 0;
	index_06 = 0;
	index_07 = 0;
	index_08 = 0;
	index_09 =0;
	good_area = 0;
	avg_area = 0;
	bad_area = 0;
	unmarked_pixels = 0;
	mask_pixels = 0;
	for i = 1:size_index(1)
		for j = 1:size_index(2)
			if mask_image(i,j) ==1
				mask_pixels = mask_pixels+1;
				if (index_image(i,j,1)>=129 && index_image(i,j,1)<186)
					if index_image(i,j,2)<150
		                                index_0 = index_0+1;
						new_index_image(i,j,1) =171;
						new_index_image(i,j,2) =5;
						new_index_image(i,j,3) =53;
					else
						index_06 = index_06+1;
						new_index_image(i,j,1) =186;
						new_index_image(i,j,2) =227;
						new_index_image(i,j,3) =131;
						end
				elseif (index_image(i,j,1)>=186 && index_image(i,j,1)<230)
					if index_image(i,j,2)<150
		                                index_01 = index_01+1;
						new_index_image(i,j,1) =234;
						new_index_image(i,j,2) =79;
						new_index_image(i,j,3) =59;
					else
						index_05 = index_05+1;
						new_index_image(i,j,1) =230;
						new_index_image(i,j,2) =243;
						new_index_image(i,j,3) =164;
						end
				elseif (index_image(i,j,1)>=230 && index_image(i,j,1)<255)
					if index_image(i,j,2)<150
		                                index_02 = index_02+1;
						new_index_image(i,j,1) =247;
						new_index_image(i,j,2) =136;
						new_index_image(i,j,3) =90;
					elseif index_image(i,j,2)<=150 && index_image(i,j,2)<200
						index_03 = index_03+1;
						new_index_image(i,j,1) =251;
						new_index_image(i,j,2) =192;
						new_index_image(i,j,3) =126;
					else 
						index_04 = index_04+1;
						new_index_image(i,j,1) =255;
						new_index_image(i,j,2) =240;
						new_index_image(i,j,3) =181;
					end
				elseif (index_image(i,j,1)>=17 && index_image(i,j,1)<=129)
						index_07 = index_07+1;
						new_index_image(i,j,1) =129;
						new_index_image(i,j,2) =191;
						new_index_image(i,j,3) =108;
				elseif (index_image(i,j,1)>6 && index_image(i,j,1)<=17)
						index_08 = index_08+1;
						new_index_image(i,j,1) =17;
						new_index_image(i,j,2) =167;
						new_index_image(i,j,3) =95;
				elseif (index_image(i,j,1)<=6)
						index_09 = index_09+1;
						new_index_image(i,j,1) =6;
						new_index_image(i,j,2) =101;
						new_index_image(i,j,3) =61;
				else
					index_04 = index_04+1;
					new_index_image(i,j,1) =index_image(i,j,1);
					new_index_image(i,j,2)=index_image(i,j,2);
					new_index_image(i,j,3)=index_image(i,j,3);
					unmarked_pixels = unmarked_pixels+1;
					
					%index_09 = index_09+1;
				
				end
			else
				new_index_image(i,j,1) =index_image(i,j,1);
				new_index_image(i,j,2)=index_image(i,j,2);
				new_index_image(i,j,3)=index_image(i,j,3);

			end
		end
	end
	unmarked_pixels
	mask_pixels
	good_area = index_09+index_08+index_07+index_06
	avg_area = index_05+index_04+index_03
	bad_area = mask_pixels-(good_area+avg_area)
	index_value = (index_0*0.1+index_01*0.2+index_02*0.3 +index_03*0.4+index_04*0.5+index_05*0.6+index_06*0.7+index_07*0.8+index_08*0.9+index_09*1.0)/mask_pixels
	if strcmp(img_type, "vari")
		index_value = (index_0*-0.8+index_01*-0.6+index_02*-0.4+index_03*-0.2+index_04*0+index_05*0.2+index_06*0.4+index_07*0.6+index_08*0.8+index_09*1.0)/mask_pixels
	end
	index_values = [round((index_value*100)) (index_0*100) (index_01*100) (index_02*100) (index_03*100) (index_04*100) (index_05*100) (index_06*100) (index_07*100) (index_08*100) (index_09*100) (mask_pixels*100) (good_area*100) (avg_area*100) (bad_area)];
	
%	index_values = [round((index_value*100)) (index_0*100) (index_01*100) (index_02*100) (index_03*100) (index_04*100) (index_05*100) (index_06*100) (index_07*100) (index_08*100) (index_09*100) (mask_pixels*100) (good_area*100) (avg_area*100) (bad_area)];
	f_name = strcat("IndexValues_",img_type);
	f_name = strcat(f_name,".csv");
	csvwrite(f_name,index_values)
	c1 = 0;
	new_index_image = new_index_image/255;
	imwrite(new_index_image,file_name);
	%imwrite(new_index_image,file_name);
	return
end
