microglia_analyzer.tiles.recalibrate module

microglia_analyzer.tiles.recalibrate.process_factor(input_calib, input_unit)[source]

We process the factor to pass from the input calibration to the original calibration. We will multiply the input image’s height and width by this factor to get the new size.

microglia_analyzer.tiles.recalibrate.recalibrate_image(input_image, input_calib, input_unit, inter=True)[source]

The image has to be recalibrated to have a pixel size of 0.325 µm. Its shape is either (Y, X) or (Y, X, C). If pixels are wider, it takes less pixels to represent a similar object. So, passing to a larger size should give a factor smaller than 1.0. The factor is calculated with the input length in the denominator.

Parameters:
  • input_image (np.array) – The image to recalibrate.

  • input_calib (float) – The calibration of the input image.

  • input_unit (str) – The unit of the input calibration.

Returns:

The recalibrated (interpolated) image.

Return type:

np.array

microglia_analyzer.tiles.recalibrate.recalibrate_shape(input_shape, input_calib, input_unit)[source]

The shape of the image has to be recalibrated to have a pixel size of 0.325 µm.

Parameters:
  • input_shape (tuple) – The shape of the input image.

  • input_calib (float) – The calibration of the input image.

  • input_unit (str) – The unit of the input calibration.

Returns:

The recalibrated shape.

Return type:

tuple