Commit 035c87a1 authored by Fernando Perez-Garcia's avatar Fernando Perez-Garcia

Use different fonts depending on the host OS

parent ec9b56a1
......@@ -3,9 +3,10 @@ from pathlib import Path
import numpy as np
from . import metrics
from ...nifti import load
from ...utils import get_os
def get_mip_collage(images_dict, metrics_dict=None, fontsize=72):
def get_mip_collage(images_dict, metrics_dict=None):
"""
Example:
images_dict = {
......@@ -51,7 +52,15 @@ def get_mip_collage(images_dict, metrics_dict=None, fontsize=72):
f'Recall: {recall:.3f}',
]
text = '\n'.join(lines)
os = get_os()
if os == 'linux':
font_path = '/usr/share/fonts/truetype/ubuntu/Ubuntu-R.ttf'
fontsize = 48
elif os == 'mac':
fonts_dir = Path('/ Users/fernando/Library/Fonts')
font_path = fonts_dir / 'Meslo LG M DZ Regular for Powerline.ttf'
fontsize = 36
font = ImageFont.truetype(str(font_path), fontsize)
image = Image.new('RGB', (sj, sj), (0, 0, 0))
draw = ImageDraw.Draw(image)
image_size_x, image_size_y = image.size
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment