aim2fe module

Converts an AIM file to a HDF5 file. Adapted from the script from Denis Schenk, ISTB, University of Bern.

Author: Jarunan Panyasantisuk, ETH Scientific IT Services. Date: 13 November 2018.

Maintained by: Simone Poncioni, ARTORG Center for Biomedical Engineering Research, SITEM Insel, University of Bern Date: March 2024

aim2fe.aim2fe_psl(cfg, sample)[source]

Converts AIM image to Abaqus INP file using the provided configuration.

Parameters:
  • cfg (dict) – Dictionary of configuration parameters.

  • sample (str) – Sample identifier.

Raises:
  • TypeError – If there is an issue with the input types.

  • ValueError – If an unrecognized fabric or meshing type is encountered.

Returns:

A tuple containing the bone dictionary and the path to the Abaqus INP file.

Return type:

tuple

This function performs the following operations: 1. Sets filenames and reads image parameters. 2. Reads AIM images and image parameters, optionally using multithreading. 3. Adjusts image size if registration is enabled. 4. Saves images with colorbars. 5. Prepares material mapping by calculating BVTV and BMD values. 6. Generates a mesh if the meshing type is “spline”. 7. Computes MSL kernel list based on the fabric type. 8. Maps materials to the mesh. 9. Computes and stores summary and performance variables. 10. Plots MSL fabric if the meshing type is “spline”.

aim2fe.save_image_with_colorbar(data, output_path)[source]

Saves an image with a colorbar to the specified output path.

Parameters:
  • data (numpy.ndarray) – The image data to be displayed.

  • output_path (str) – The path where the image will be saved.

Returns:

None

This function performs the following operations: 1. Creates a new figure and axis. 2. Displays the image data using a viridis colormap. 3. Sets the title of the image based on the output path. 4. Adds a colorbar to the right of the image. 5. Adjusts the layout to be tight. 6. Saves the figure to the specified output path with a resolution of 300 dpi. 7. Clears the figure to free up memory.