Skip to content

Commit

Permalink
clearer variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrofelder committed Mar 13, 2024
1 parent f37b9c1 commit cf4c08b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions brainreg/core/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,24 +219,24 @@ def prep_registration(args):
logging.debug("Making registration directory")
ensure_directory_exists(args.brainreg_directory)

additional_images_downsample = {}
additional_images_to_downsample = {}

if args.additional_images:
file_names = [Path(path).name for path in args.additional_images]
has_duplicates = any(file_names.count(name) > 1 for name in file_names)
for images in args.additional_images:
channel_name = Path(images).name
path_names = [Path(path).name for path in args.additional_images] #could be files or folders containing e.g. lots of 2D tiffs
has_duplicates = any(path_names.count(name) > 1 for name in path_names)
for additional_channel_paths in args.additional_images:
channel_name = Path(additional_channel_paths).name
if not has_duplicates:
additional_images_downsample[channel_name] = images
additional_images_to_downsample[channel_name] = additional_channel_paths
else:
channel_name = Path(images).name
parent_folder = Path(images).parent.name
channel_name = Path(additional_channel_paths).name
parent_folder = Path(additional_channel_paths).parent.name
channel_name = f"{parent_folder}_{channel_name}"
additional_images_downsample[channel_name] = images
additional_images_to_downsample[channel_name] = additional_channel_paths

assert len(args.additional_images) == len(additional_images_downsample), "Something went wrong parsing additional channel names - please ensure additional channels have a unique combination of name and parent folder."
assert len(args.additional_images) == len(additional_images_to_downsample), "Something went wrong parsing additional channel names - please ensure additional channels have a unique combination of name and parent folder."

return args, additional_images_downsample
return args, additional_images_to_downsample


def main():
Expand Down

0 comments on commit cf4c08b

Please sign in to comment.