File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -224,6 +224,11 @@ def get_side_projection(args, fp):
224224 buffer_size = x * y * np .dtype ('uint16' ).itemsize
225225 logging .debug (f'Allocated memory for a slice (i.e., buffer_size): { buffer_size } bytes' )
226226
227+ # Load font
228+ font_fp = '/' .join ([os .path .dirname (os .path .realpath (__file__ )), 'assets' , 'OpenSans-Regular.ttf' ])
229+ logging .debug (f"Font filepath: '{ font_fp } '" )
230+ font = ImageFont .truetype (font_fp , args .font_size )
231+
227232 pbar = tqdm (total = z , desc = "Generating side-view projection" ) # progress bar
228233 with open (fp , mode = 'rb' , buffering = buffer_size ) as ifp :
229234 # Load in the first slice
@@ -267,9 +272,6 @@ def get_side_projection(args, fp):
267272 img = ImageMath .eval ('im/256' , {'im' : img }).convert ('L' ).convert ('RGBA' )
268273 draw = ImageDraw .Draw (img )
269274
270- font_fp = '/' .join ([os .path .dirname (os .path .realpath (__file__ )), 'assets' , 'OpenSans-Regular.ttf' ])
271- logging .debug (f"Font filepath: '{ font_fp } '" )
272- font = ImageFont .truetype (font_fp , args .font_size )
273275 ascent , descent = font .getmetrics ()
274276 offset = (ascent + descent ) // 2
275277
You can’t perform that action at this time.
0 commit comments