-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #449 from bnmajor/add-viewer-features
Add viewer features
- Loading branch information
Showing
7 changed files
with
282 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "492c7f7a-b291-4f01-9c85-9fea9da52fcc", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import sys\n", | ||
"!{sys.executable} -m pip install -q --pre itkwidgets" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ee6c9cad-31f9-4adc-8740-6bb2103ade97", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"from itkwidgets import view" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "684615f0-f389-460f-8de6-6e3fc986d022", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"number_of_points = 3000\n", | ||
"gaussian_mean = [0.0, 0.0, 0.0]\n", | ||
"gaussian_cov = [[1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 0.5]]\n", | ||
"point_set = np.random.multivariate_normal(gaussian_mean, gaussian_cov, number_of_points)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "7571e8e2-5b3e-4204-9934-d30472e2f427", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"view(point_sets=point_set)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "4f8a0ef9-68fb-44f0-bd6d-7ad31615ee06", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
def init_params_dict(itk_viewer): | ||
return { | ||
'annotations': itk_viewer.setAnnotationsEnabled, | ||
'axes': itk_viewer.setAxesEnabled, | ||
'bg_color': itk_viewer.setBackgroundColor, | ||
'blend_mode': itk_viewer.setImageBlendMode, | ||
'cmap': itk_viewer.setImageColorMap, | ||
'color_range': itk_viewer.setImageColorRange, | ||
'color_bounds': itk_viewer.setImageColorRangeBounds, | ||
'component_visible': itk_viewer.setImageComponentVisibility, | ||
'gradient_opacity': itk_viewer.setImageGradientOpacity, | ||
'gradient_opacity_scale': itk_viewer.setImageGradientOpacityScale, | ||
'interpolation': itk_viewer.setImageInterpolationEnabled, | ||
'gaussians': itk_viewer.setImagePiecewiseFunctionGaussians, | ||
'shadow_enabled': itk_viewer.setImageShadowEnabled, | ||
'sample_distance': itk_viewer.setImageVolumeSampleDistance, | ||
'label_blend': itk_viewer.setLabelImageBlend, | ||
'label_names': itk_viewer.setLabelImageLabelNames, | ||
'label_lut': itk_viewer.setLabelImageLookupTable, | ||
'label_weights': itk_viewer.setLabelImageWeights, | ||
'layer': itk_viewer.selectLayer, | ||
'layer_visible': itk_viewer.setLayerVisibility, | ||
'container_style': itk_viewer.setRenderingViewContainerStyle, | ||
'rotate': itk_viewer.setRotateEnabled, | ||
'ui_collapsed': itk_viewer.setUICollapsed, | ||
'units': itk_viewer.setUnits, | ||
'view_mode': itk_viewer.setViewMode, | ||
'x_slice': itk_viewer.setXSlice, | ||
'y_slice': itk_viewer.setYSlice, | ||
'z_slice': itk_viewer.setZSlice, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from .integrations.itk import HAVE_ITK | ||
import itkwasm | ||
import numpy as np | ||
from typing import Dict, List, Union | ||
import zarr | ||
|
||
|
||
Gaussian_Curve = Dict[str, float] | ||
Gaussians = Dict[str, List[Gaussian_Curve]] | ||
|
||
Style = Dict[str, str] | ||
|
||
Image = Union[np.ndarray, itkwasm.Image, zarr.Group] | ||
Point_Sets = Union[np.ndarray, itkwasm.PointSet, zarr.Group] | ||
if HAVE_ITK: | ||
import itk | ||
Image = Union[Image, itk.Image] | ||
Point_Sets = Union[Point_Sets, itk.GroupSpatialObject] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters