microglia_analyzer.ma_worker module

class microglia_analyzer.ma_worker.MicrogliaAnalyzer(logging_f=None)[source]

Bases: object

analyze_graph()[source]
as_tsv(identifier)[source]
bindings_from_yolo(yolo_bboxes_str)[source]
bindings_to_yolo()[source]
classify_microglia()[source]
get_classification_version()[source]
get_mask(show_garbage)[source]
get_segmentation_version()[source]
reset_classification()[source]
reset_segmentation()[source]
segment_microglia()[source]
set_calibration(pixel_size, unit)[source]

Setter of the calibration. Before editing the internal state, checks that the pixel size is a float and Pint is used to check the unit.

set_classification_model(path, use='best', reload=False)[source]

Checks that the path corresponds to a folder. This folder must contain a “confusion_matrix.png” file to verify that the training is complete. In there, there must be a “weights” folder, containing either ‘best.pt’ or ‘last.pt’.

Parameters:
  • path (-) – Path of the model’s folder (containing ‘results.csv’ and ‘weights’).

  • use (-) – Either ‘best’ or ‘last’, to use either ‘best.pt’ or ‘last.pt’.

  • reload (-) – Whether to force the reload of the model from the online repo.

set_input_image(image)[source]

Setter of the input image. Checks that the image is 2D before using it.

set_min_surface(min_size)[source]
set_proba_threshold(threshold)[source]
set_segmentation_model(path, use='best')[source]

Checks that the path is a folder. In the folder, we search for the file “best.keras” or “last.keras”. To verify that the training was complete, we also check for the presence of “training_history.png”.

set_working_directory(path)[source]

Checks that the directory exists before setting it. Also outputs a warning in the logs if it is not empty.