Skip to content
Snippets Groups Projects

Local itk-vtk-viewer

2 files
+ 22
13
Compare changes
  • Side-by-side
  • Inline

Files

+ 21
13
@@ -45,7 +45,8 @@ def main():
# K3D
viz_parser = subparsers.add_parser("viz", help="Volumetric visualization.")
viz_parser.add_argument("--source", default=False, help="Path to the image file")
viz_parser.add_argument("source", help="Path to the image file")
viz_parser.add_argument("-m", "--method", type=str, metavar="METHOD", default="itk-vtk-viewer", help = "Which method is used to display file.")
viz_parser.add_argument(
"--destination", default="k3d.html", help="Path to save html file."
)
@@ -146,22 +147,29 @@ def main():
interface.launch(inbrowser=inbrowser, force_light_mode=False)
elif args.subcommand == "viz":
if not args.source:
print("Please specify a source file using the argument --source")
return
# if not args.source:
# print("Please specify a source file using the argument --source")
# return
# Load the data
print(f"Loading data from {args.source}")
volume = qim3d.io.load(str(args.source))
print(f"Done, volume shape: {volume.shape}")
# print(f"Loading data from {args.source}")
# print(f"Done, volume shape: {volume.shape}")
# Make k3d plot
print("\nGenerating k3d plot...")
qim3d.viz.vol(volume, show=False, save=str(args.destination))
print(f"Done, plot available at <{args.destination}>")
if args.method == 'itk-vtk-viewer':
print("\nGenerating itk-vtk-viewer plot...")
qim3d.viz.itk_vtk_viewer.viewer("Jou")
elif args.method == 'k3d':
volume = qim3d.io.load(str(args.source))
print("\nGenerating k3d plot...")
qim3d.viz.vol(volume, show=False, save=str(args.destination))
print(f"Done, plot available at <{args.destination}>")
if not args.no_browser:
print("Opening in default browser...")
webbrowser.open_new_tab(args.destination)
else:
raise NotImplementedError(F"Method '{args.method}' is not valid. Try 'k3d' or default 'itk-vtk-viewer'")
if not args.no_browser:
print("Opening in default browser...")
webbrowser.open_new_tab(args.destination)
elif args.subcommand == "preview":
image = DataLoader().load(args.filename)
Loading