function c1 = calc_soc_indices(uid,fieldid,img_type, field_area)
mainPath = strcat(uid, "/");
mainPath = strcat(mainPath,fieldid);
        file_name = strcat(mainPath,"/IndexValues_");

        file_name = strcat(file_name,img_type);
        file_name = strcat(file_name,".csv");
        file_array = csvread(file_name);
        mask_file_name = strcat(mainPath,"/");
        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(file_array);
        size_mask_img = size(mask_image);
        index_0 = 0;
        index_1 = 0;
        index_2 = 0;
        index_3 = 0;
        index_4 = 0;
        index_5 = 0;
        index_6 = 0;
        index_7 = 0;
        index_8 = 0;
        index_9 =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;
				file_array(i,j)= file_array(i,j)*20;
                                if file_array(i,j) < 1
                                        index_0 = index_0 + 1;
                                elseif file_array(i,j) >=1 && file_array(i,j) < 1.5
                                        index_1 = index_1 + 1;
                                elseif file_array(i,j) >=1.5 && file_array(i,j) < 2
                                        index_2 = index_2 + 1;
                                elseif file_array(i,j) >=2 && file_array(i,j) < 2.25
                                        index_3 = index_3 + 1;
                                 elseif file_array(i,j) >=2.25 && file_array(i,j) < 2.5
                                        index_4 = index_4 + 1;
                                elseif file_array(i,j) >=2.5 && file_array(i,j) < 2.75
                                        index_5 = index_5 + 1;
                                elseif file_array(i,j) >=2.75 && file_array(i,j) < 3
                                        index_6 = index_6 + 1;
                                elseif file_array(i,j) >=3 && file_array(i,j) < 4
                                        index_7 = index_7 + 1;
                                elseif file_array(i,j) >=4 && file_array(i,j) < 5
                                        index_8 = index_8 + 1;
                                else
                                        index_9 = index_9 + 1;
                                end
                        end
                end
        end
        %% calculate areas
        index_0 = round(field_area*(index_0/mask_pixels));
        index_1 = round(field_area*(index_1/mask_pixels));
        index_2 = round(field_area*(index_2/mask_pixels));
        index_3 = round(field_area*(index_3/mask_pixels));
        index_4 = round(field_area*(index_4/mask_pixels));
        index_5 = round(field_area*(index_5/mask_pixels));
        index_6 = round(field_area*(index_6/mask_pixels));
        index_7 = round(field_area*(index_7/mask_pixels));
        index_8 = round(field_area*(index_8/mask_pixels));
        index_9 = round(field_area*(index_9/mask_pixels));
        good_area = index_9+index_8+index_7+index_6;
        avg_area = index_5+index_4+index_3;
	bad_area = mask_pixels-(good_area+avg_area);
        index_value = (index_0*1+index_1*1.5+index_2*2 +index_3*2.25+index_4*2.5+index_5*2.75+index_6*3+index_7*4+index_8*5+index_9*6)/field_area;
	index_value = index_value/20;
	index_value = round(index_value*100)/100;
        %%index_values = [index_value (index_0*100) (index_1*100) (index_2*100) (index_3*100) (index_4*100) (index_5*100) (index_6*100) (index_7*100) (index_8*100) (index_9*100) (mask_pixels*100) (good_area*100) (avg_area*100) (bad_area)];
        index_values = [round((index_value)) (index_0) (index_1) (index_2) (index_3) (index_4) (index_5) (index_6) (index_7) (index_8) (index_9) (field_area) (good_area) (avg_area) (bad_area)];

        f_name = strcat(mainPath, "/IndexValues_");
        f_name = strcat(f_name,img_type);
        f_name = strcat(f_name,".csv");
        csvwrite(f_name,index_values);
        c1 = 0;
        %imwrite(new_index_image,file_name);
        return
end
