enh: generate both snapshot and thumbnail (XNAT size??)

parent 54fe8ff7
......@@ -11,9 +11,12 @@ def parse_args():
parser = ArgumentParser(prog='nithumb', description=DESCRIPTION)
parser.add_argument('inputfile', help='input NIfTI file')
parser.add_argument('snapshot', help='output snapshot')
parser.add_argument('thumbnail', help='output thumbnail')
parser.add_argument('--size', '-s', type=int, nargs=2, default=(128, 128),
help='size of the thumbnail')
parser.add_argument('--snapshot_size', '-ss', type=int, nargs=2, default=(128, 128),
help='size of the snapshot')
parser.add_argument('--thumbnail_size', '-ts', type=int, nargs=2, default=(64, 64),
help='size of the thumbnail')
return parser.parse_args()
......@@ -34,8 +37,9 @@ def main():
# Select the centre slice if 3D.
image = image[:, :, image.shape[2]//2] if image.ndim == 3 else image
# Generate and save the thumbnail.
Image.fromarray(image).resize(parsed.size).save(parsed.thumbnail)
# Generate and save the snapshot and its thumbnail.
Image.fromarray(image).resize(parsed.snapshot_size).save(parsed.snapshot)
Image.fromarray(image).resize(parsed.thumbnail_size).save(parsed.thumbnail)
if __name__ == '__main__':
......
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