From 3d286cfd4d4077014d9f318f9b7f27f9c6589f09 Mon Sep 17 00:00:00 2001 From: mmattmcw Date: Wed, 10 Jan 2024 09:43:32 -0500 Subject: [PATCH] add documentation to fourcell --- fourcell/README.md | 67 +++++++++++++++++++++++++++++++++++++++---- fourcell/calibrate.py | 16 +++++------ 2 files changed, 69 insertions(+), 14 deletions(-) diff --git a/fourcell/README.md b/fourcell/README.md index c7e2095..1d3e8f5 100644 --- a/fourcell/README.md +++ b/fourcell/README.md @@ -1,9 +1,4 @@ -# Four Cell Script - -Two scripts: - -1. Analyzes a calibration sheet on the plotter to generate a template. -2. Takes cells and inserts them into the template 4 at a time. +# Four Cell Scripts ## Analysis Steps @@ -52,3 +47,63 @@ _______________ _______________ | | | | --------------- --------------- ``` + +## normalize.py + +Normalize a scanned hole punch image. + +``` +usage: normalize.py [-h] input output + +positional arguments: + input Scan to normalize + output Normalized file to output +``` + +## calibrate.py + +Create a calibration file, apply to a scanned page, or scale image to desired DPI. + +``` +usage: calibrate.py [-h] [--dpi DPI] [--input INPUT] [--output OUTPUT] [--calibration CALIBRATION] {generate,calibrate,scale} + +positional arguments: + {generate,calibrate,scale} + The action to perform + +options: + -h, --help show this help message and exit + --dpi DPI, -d DPI DPI to generate + --input INPUT, -i INPUT + Input file + --output OUTPUT, -o OUTPUT + Output file + --calibration CALIBRATION, -c CALIBRATION + Calibration file +``` + +## template.py + +Create a template from normalized scan file. + +``` +usage: template.py [-h] normalized [registration] + +positional arguments: + normalized Normalized scan to build template from. + registration Registration mark to use. +``` + +## apply_image.py + +Create a printable rasterized image that can be hole punched and animated. + +``` +usage: apply_image.py [-h] name destination template ... + +positional arguments: + name Name of project + destination File to output image to + template Template file to use + images Images to place as cells +``` diff --git a/fourcell/calibrate.py b/fourcell/calibrate.py index 0d52364..6b3fa62 100644 --- a/fourcell/calibrate.py +++ b/fourcell/calibrate.py @@ -22,6 +22,14 @@ MEASUREMENTS={ 'F' : { 'y' : 100.0 } # Y 100mm } +parser = argparse.ArgumentParser(description='Create a calibration file, apply to a scanned page, or scale image to desired DPI.') +parser.add_argument('action', help='The action to perform', choices=ACTIONS) +parser.add_argument('--dpi', '-d', help='DPI to generate', required=False, type=int) +parser.add_argument('--input', '-i', help='Input file', required=False) +parser.add_argument('--output', '-o', help='Output file', required=False) +parser.add_argument('--calibration', '-c', help='Calibration file', required=False) +args = parser.parse_args() + def create_blank(width, height): rgb_color=(255,255,255) image = np.zeros((height, width, 3), np.uint8) @@ -181,14 +189,6 @@ def scale (args) : def main () : - parser = argparse.ArgumentParser(description='Create a calibration file, apply to a scanned page, or scale image to desired DPI.') - parser.add_argument('action', help='The action to perform', choices=ACTIONS) - parser.add_argument('--dpi', '-d', help='DPI to generate', required=False, type=int) - parser.add_argument('--input', '-i', help='Input file', required=False) - parser.add_argument('--output', '-o', help='Output file', required=False) - parser.add_argument('--calibration', '-c', help='Calibration file', required=False) - args = parser.parse_args() - if args.action == 'generate' : generate(args) elif args.action == 'calibrate' :