Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
Remove the if logic, forcing cropping even if Raw_Cropped_to_Eye set to True
  • Loading branch information
huynguyentran committed Jan 28, 2025
1 parent 90fdd4e commit e8ac6fd
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions eye_ai/eye_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,10 @@ def create_images_directory(self, bag_path: Path, ds_bag: DatasetBag, output_dir
out_path_dir = str(out_path_no_glaucoma) if diag == 'No Glaucoma' else str(out_path_glaucoma)

if crop_to_eye:
if row['Annotation_Function'] != 'Raw_Cropped_to_Eye':
svg_path = svg_root_path / f'Cropped_{image_rid}.svg'
bbox = self.get_bounding_box(svg_path)
cropped_image = image.crop(bbox)
cropped_image.save(f'{out_path_dir}/Cropped_{image_rid}.JPG')
else:
image.save(f'{out_path_dir}/Cropped_{image_rid}.JPG')
svg_path = svg_root_path / f'Cropped_{image_rid}.svg'
bbox = self.get_bounding_box(svg_path)
cropped_image = image.crop(bbox)
cropped_image.save(f'{out_path_dir}/Cropped_{image_rid}.JPG')
image_annot_df.loc[index, 'Cropped Filename'] = 'Cropped_' + image_file_name
else:
image.save(f'{str(out_path_dir)}/{image_rid}.JPG')
Expand Down

0 comments on commit e8ac6fd

Please sign in to comment.