Commit 7214292c authored by amichaut's avatar amichaut
Browse files

map_analysis supports missing image_size

parent 652caff8
This diff is collapsed.
This diff is collapsed.
......@@ -1123,7 +1123,16 @@ def get_image(data_dir, filename=None, verbose=False):
image_dict = {'image_fn': filename, 't_dim': t_dim, 'z_dim': z_dim, 'image_size': im.shape[-2:]}
image_dict = {'image_fn': None, 't_dim': None, 'z_dim': None, 'image_size': None}
# get image size
info = get_info(data_dir)
if 'image_width' in info.keys() and 'image_height' in info.keys():
if info['image_width'] is not None and info['image_height'] is not None:
image_size = (info['image_height'],info['image_width'])
image_size = None
print("WARNING: no image in directory, and image size is not defined in info.txt")
image_dict = {'image_fn': None, 't_dim': None, 'z_dim': None, 'image_size': image_size}
return image_dict
......@@ -96,7 +96,13 @@ def map_analysis(data_dir, data=None, image=None, refresh=False, parallelize=Fal
df_list = [df[df['subset'] == sub] for sub in df['subset'].unique()] # a list of df filtered by subset
# Make grid
image_size = [image['image_size'][1], image['image_size'][0]] # image width,image height in px
if image['image_size'] is None: # get image size using data, making it slighlty larger
xmax = df['x'].max() + 0.05 * (df['x'].max() - df['x'].min())
ymax = df['y'].max() + 0.05 * (df['y'].max() - df['y'].min())
image_size = (xmax, ymax) # image width,image height in px
image_size = (image['image_size'][1], image['image_size'][0]) # image width,image height in px
grids = tpr.make_grid(image_size,
Supports Markdown
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