function [baby_mass, baby_Ltot] = calculate_key_outputs_from_morphed_model(export_folder, file_pointers, baby_measurements, key_points)
% Imports the generated model and calculates the key measurements for it.
%
% :param export_folder: string - Name of folder to place BAT file.
%                                It is assumed the python file will also
%                                exist in this folder.
% :param file_pointers: struct - Struct with file names. Needs to contain
%                                at least the fields "piper_bat_name",
%                               "piper_script_name" and "piper_dir".
%
% :return None: 				If successful, a file is created.
%
% created by : ABR august@lightness.eu
% date : 2024-06-11

% Read the nodal coordinates (skips the final set with visualization nodes)
nMat = import_nodes_from_k_file([export_folder file_pointers.morphed_dir_name filesep file_pointers.k_file_out_name]);
eMat = import_elements_from_k_file(file_pointers.k_file_to_mod);

Vol = calculate_volume_from_surface_mesh(nMat, eMat);
baby_mass = 1000.0 * Vol*1e-9 * 1000.0;
disp('-----> SUMMARY AFTER MORPHING')
fprintf('     Estimated mass (rho = 1000kg/m^3) = %10.0f g \n', baby_mass)

node_kpis_ref = calculate_key_measurements(nMat, key_points);
disp('-----> CONTROL OF KRIEGED MESH')
fprintf('                      %10s %10s\n', 'Nodes','Target')
fprintf('     Total length   = %10.1f %10.1f\n', node_kpis_ref.total_length, baby_measurements(1))
fprintf('     Head circumf   = %10.1f %10.1f\n', node_kpis_ref.head_circumference, baby_measurements(4))
fprintf('     Shoulder width = %10.1f %10.1f\n', node_kpis_ref.shoulder_width, baby_measurements(3))
fprintf('     Shoulder-groin = %10.1f %10.1f\n', node_kpis_ref.shoulder_to_groin, baby_measurements(2))

baby_Ltot = node_kpis_ref.total_length;
