tmas.src.process_image_file

Module Contents

tmas.src.process_image_file.process_image_file(image_path: str, format_type: str, plate_design: Dict[str, Any], output_directory: str, show: bool = False) Dict[str, Dict[str, Any]] | None[source]

Process a single image file to detect bacterial growth and analyze MIC (Minimum Inhibitory Concentration) results.

This function checks the validity of an image file, applies necessary preprocessing steps, performs growth detection using an object detection model, and then analyzes the results to calculate MIC values for various drugs. The results are saved in the specified format.

Parameters:
  • image_path (str) – The full path to the image file to be processed.

  • format_type (str) – The format for saving MIC results, either ‘csv’ or ‘json’.

  • plate_design (Dict[str, Any]) – A dictionary containing the design details of the plate, including drug and dilution matrices.

  • output_directory (str) – The directory path where the output results and visualizations will be saved.

  • show (bool) – A boolean flag that determines whether to display the visualization images. Defaults to False.

Returns:

A dictionary containing MIC values if the image is processed successfully, or None if the image is invalid.

Return type:

Optional[Dict[str, Dict[str, Any]]]