Skip to content

Support command line use as described in the README #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions segmentify/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@ def main(args):
imgs = np.array(imgs)

with gui_qt():
viewer = Viewer(imgs, heatmap=args.heatmap)


if __name__ == "__main__":
try:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The simple examples in the README and examples folder don't use heatmaps, and expecting but not getting one was cuasing an error.
I'm not quite sure how to pass in a heatmap using command line arguments, but I assume this part will work if you do?

args.heatmap
except AttributeError:
viewer = Viewer(imgs)
else:
viewer = Viewer(imgs, heatmap=args.heatmap)

def main_cli():
# parser
parser = argparse.ArgumentParser()
parser.add_argument("images", nargs="*", type=str, help="Image to view and segment.")
args = parser.parse_args()

main(args)

if __name__ == "__main__":
main_cli()
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ def parse_requirements_file(filename):
'Operating System :: MacOS',
],
install_requires=INSTALL_REQUIRES,
entry_points={'console_scripts': ['segmentify=segmentify.main:main_cli']},
)