This tool allows you to add a scale bar to microscope images in the .tif
format (1920x1440). It is designed to work with the OLYMPUS IX71 microscope but can be adjusted to work with other models.
To run the script, you must provide the path to the image and the type of scope. Available types include 4X_1X
, 4X_1.6X
, 10X_1X
, 10X_1.6X
, 40X_1X
, 40X_1.6X
. Check the calibrations of scopes for OLYMPUS IX71.
Command example:
python add_scale_bar.py image_path.tif 10X_1.6X
However, if the target image filename contains the scope type (e.g., 10X_1.6X), it will automatically detect it, and no scope type argument is required.
The constants at the beginning of the script (scale_pixel_4X_1X_100_um
, scale_pixel_10X_1X_100_um
, scale_pixel_40X_1X_100_um
) are specific to the OLYMPUS IX71 microscope. You must adjust these values if you are working with a different microscope. Calibrate and find the correct values for the specific magnification levels.
-
Clone the repository:
git clone https://github.com/KORINZ/scale-bar-addition-tool.git
-
Navigate to the directory:
cd scale-bar-addition-tool
-
Install the requirements:
pip install -r requirements.txt
The script requires the following Python libraries, which can be installed using the requirements.txt
file:
- PIL (Pillow)
- OpenCV (opencv-python)
- NumPy
You can adjust the scale bar's position, thickness, font size, image size, and image format in the code if needed. Consult the code comments for further guidance on these adjustments.
- Added support for BZ-9000 and APX100 microscopes