Skip to content
Snippets Groups Projects
Commit c44b28cb authored by s214735's avatar s214735 Committed by fima
Browse files

Docstrings

parent 191449a5
No related branches found
No related tags found
1 merge request!144Docstrings
Showing
with 223 additions and 161 deletions
......@@ -11,6 +11,7 @@ This offers quick interactions, making it ideal for tasks that require efficienc
## Graphical User Interfaces
The command line interface allows you to run graphical user interfaces directly from the terminal.
### `qim3d gui`
!!! quote "Reference"
......@@ -38,7 +39,7 @@ This offers quick interactions, making it ideal for tasks that require efficienc
!!! Example
Here's an example of how to open the [Data Explorer](gui.md#data_explorer)
Here's an example of how to open the [Data Explorer](gui.md#qim3d.gui.data_explorer)
``` title="Command"
qim3d gui --data-explorer
......@@ -85,16 +86,6 @@ This offers quick interactions, making it ideal for tasks that require efficienc
## Data visualization
The command line interface also allows you to easily visualize data.
......@@ -190,7 +181,8 @@ Or an specific path for destination can be used. We can also choose to not open
This writes to disk the `my_plot.html` file.
## File preview
Command line interface, which allows users to preview 3D structers or 2D images directly in command line.
File previewing can also be done directly from the command line interface to preview 3D structure or 2D images.
### `qim3d preview`
| Arguments | Description |
| --------- | ----------- |
......
# Data input and output
Dealing with volumetric data can be done by `qim3d` for the most common image formats available.
# Data handling
Dealing with volumetric data can be done by `qim3d` for the most common image formats available. This includes loading, saving and file conversions.
Currently, it is possible to directly load `tiff`, `h5`, `nii`,`txm`, `vol` and common `PIL` formats using one single function.
Additionally, synthtetic volumetric data can be generated using the `generate` module.
::: qim3d.io
options:
members:
- load
- load_mesh
- save
- save_mesh
- Downloader
- export_ome_zarr
- import_ome_zarr
- save_mesh
- load_mesh
::: qim3d.mesh
options:
members:
- from_volume
::: qim3d.generate
options:
members:
- noise_object
- noise_object_collection
# Detection in volumetric data
The `qim3d` library provides a set of detection methods for volumes.
::: qim3d.detection
options:
members:
- blobs
\ No newline at end of file
# Feature extraction
The `qim3d` library provides a set of methods for feature extraction on volumetric data
::: qim3d.features
options:
members:
- area
- volume
- sphericity
# Filtering data
The `qim3d` library provides a set of methods for filtering volumes.
::: qim3d.filters
options:
members:
- gaussian
- median
- maximum
- minimum
- tophat
::: qim3d.filters.Pipeline
options:
members:
- append
\ No newline at end of file
# Generating synthetic data
The `qim3d` library provides a set of methods for generating volumes consisting of a single synthetic blob or a collection of multiple synthetic blobs.
::: qim3d.generate
options:
members:
- blob
- collection
......@@ -2,4 +2,7 @@
The `qim3d` library aims to ease the creation of ML models for volumetric images
::: qim3d.models.unet
\ No newline at end of file
::: qim3d.ml.models
options:
members:
- UNet
\ No newline at end of file
# Operations on volumetric data
The `qim3d` library provides a set of methods for different operations on volumes.
::: qim3d.operations
options:
members:
- remove_background
- fade_mask
- overlay_rgb_images
\ No newline at end of file
......@@ -5,35 +5,7 @@ Here, we provide functionalities designed specifically for 3D image analysis and
::: qim3d.processing
options:
members:
- blob_detection
- structure_tensor
- local_thickness
- get_3d_cc
- gaussian
- median
- maximum
- minimum
- tophat
- get_lines
- segment_layers
\ No newline at end of file
- create_mesh
::: qim3d.processing.Pipeline
options:
members:
- append
::: qim3d.processing.operations
options:
members:
- remove_background
- watershed
- fade_mask
- overlay_rgb_images
::: qim3d.processing.features
options:
members:
- area
- volume
- sphericity
\ No newline at end of file
......@@ -7,7 +7,7 @@ Below, you'll find details about the version history of `qim3d`.
As the library is still in its early development stages, **there may be breaking changes** before `v1.0` without prior deprecation warnings. Therefore, it's advisable to review the release history for more information if you encounter any issues.
And remember to keep your pip installation [up to date](/qim3d/#get-the-latest-version) so that you have the latest features!
And remember to keep your pip installation [up to date](index.md/#get-the-latest-version) so that you have the latest features!
### v0.4.5 (21/11/2024)
......
# Segmenting data
The `qim3d` library provides a set of methods for data segmentation.
::: qim3d.segmentation
options:
members:
- watershed
- get_3d_cc
......@@ -2,7 +2,7 @@
A set of tools to ease managment of the system, with the common needs for large data in mind.
::: qim3d.utils.system
::: qim3d.utils
options:
members:
- Memory
\ No newline at end of file
......@@ -5,21 +5,22 @@ The `qim3d` library aims to provide easy ways to explore and get insights from v
options:
members:
- histogram
- slices
- slicer
- orthogonal
- vol
- slices_grid
- slicer_orthogonal
- circles
- chunks
- itk_vtk
- volumetric
- mesh
- local_thickness
- vectors
- plot_cc
- colormaps
- interactive_fade_mask
- fade_mask
::: qim3d.viz.colormaps
options:
members:
- objects
- segmentation
- qim
\ No newline at end of file
......@@ -7,14 +7,17 @@ repo_name: Gitlab
nav:
- qim3d: index.md
- Input & Output: io.md
- Data Generation: generate.md
- Processing: processing.md
- Data handling: datahandling.md
- Visualization: viz.md
- GUIs: gui.md
- Features: features.md
- Filters: filters.md
- Detection: detection.md
- Segmentation: segmentation.md
- Operations: operations.md
- Processing: processing.md
- ML Models: models.md
- GUIs: gui.md
- CLI: cli.md
- Release history: releases.md
......
......@@ -48,6 +48,7 @@ _submodules = [
'mesh',
'features',
'operations',
'detection'
]
# Creating lazy loaders for each submodule
......
......@@ -6,7 +6,15 @@ import qim3d
import os
QIM_TITLE = ouf.rainbow(
f"\n _ _____ __ \n ____ _(_)___ ___ |__ /____/ / \n / __ `/ / __ `__ \ /_ </ __ / \n/ /_/ / / / / / / /__/ / /_/ / \n\__, /_/_/ /_/ /_/____/\__,_/ \n /_/ v{qim3d.__version__}\n\n",
rf"""
_ _____ __
____ _(_)___ ___ |__ /____/ /
/ __ `/ / __ `__ \ /_ </ __ /
/ /_/ / / / / / / /__/ / /_/ /
\__, /_/_/ /_/ /_/____/\__,_/
/_/ v{qim3d.__version__}
""",
return_str=True,
cmap="hot",
)
......
......@@ -20,15 +20,15 @@ def blobs(
Extract blobs from a volume using Difference of Gaussian (DoG) method, and retrieve a binary volume with the blobs marked as True
Args:
vol: The volume to detect blobs in
background: 'dark' if background is darker than the blobs, 'bright' if background is lighter than the blobs
min_sigma: The minimum standard deviation for Gaussian kernel
max_sigma: The maximum standard deviation for Gaussian kernel
sigma_ratio: The ratio between the standard deviation of Gaussian Kernels
threshold: The absolute lower bound for scale space maxima. Reduce this to detect blobs with lower intensities
overlap: The fraction of area of two blobs that overlap
threshold_rel: The relative lower bound for scale space maxima
exclude_border: If True, exclude blobs that are too close to the border of the image
vol (np.ndarray): The volume to detect blobs in.
background (str): 'dark' if background is darker than the blobs, 'bright' if background is lighter than the blobs. Defaults to 'dark'.
min_sigma (float): The minimum standard deviation for Gaussian kernel. Defaults to 1.
max_sigma (float): The maximum standard deviation for Gaussian kernel. Defaults to 50.
sigma_ratio (float): The ratio between the standard deviation of Gaussian Kernels. Defaults to 1.6.
threshold (float): The absolute lower bound for scale space maxima. Reduce this to detect blobs with lower intensities. Defaults to 0.5.
overlap (float): The fraction of area of two blobs that overlap. Defaults to 0.5.
threshold_rel (float or None): The relative lower bound for scale space maxima. Defaults to None.
exclude_border (bool): If True, exclude blobs that are too close to the border of the image. Defaults to False.
Returns:
blobs: The blobs found in the volume as (p, r, c, radius)
......@@ -37,13 +37,14 @@ def blobs(
Example:
```python
import qim3d
import qim3d.detection
# Get data
vol = qim3d.examples.cement_128x128x128
vol_blurred = qim3d.processing.gaussian(vol, sigma=2)
vol_blurred = qim3d.filters.gaussian(vol, sigma=2)
# Detect blobs, and get binary mask
blobs, mask = qim3d.processing.blob_detection(
# Detect blobs, and get binary_volume
blobs, binary_volume = qim3d.detection.blobs(
vol_blurred,
min_sigma=1,
max_sigma=8,
......@@ -58,8 +59,8 @@ def blobs(
![blob detection](assets/screenshots/blob_detection.gif)
```python
# Visualize binary mask
qim3d.viz.slicer(mask)
# Visualize binary binary_volume
qim3d.viz.slicer(binary_volume)
```
![blob detection](assets/screenshots/blob_get_mask.gif)
"""
......
......@@ -12,11 +12,11 @@ def volume(obj: np.ndarray|trimesh.Trimesh,
Compute the volume of a 3D volume or mesh.
Args:
obj: Either a np.ndarray volume or a mesh object of type trimesh.Trimesh.
**mesh_kwargs: Additional arguments for mesh creation if the input is a volume.
obj (np.ndarray or trimesh.Trimesh): Either a np.ndarray volume or a mesh object of type trimesh.Trimesh.
**mesh_kwargs (Any): Additional arguments for mesh creation if the input is a volume.
Returns:
volume: The volume of the object.
volume (float): The volume of the object.
Example:
Compute volume from a mesh:
......@@ -27,8 +27,8 @@ def volume(obj: np.ndarray|trimesh.Trimesh,
mesh = qim3d.io.load_mesh('path/to/mesh.obj')
# Compute the volume of the mesh
volume = qim3d.processing.volume(mesh)
print('Volume:', volume)
vol = qim3d.features.volume(mesh)
print('Volume:', vol)
```
Compute volume from a np.ndarray:
......@@ -36,10 +36,12 @@ def volume(obj: np.ndarray|trimesh.Trimesh,
import qim3d
# Generate a 3D blob
synthetic_blob = qim3d.generate.blob(noise_scale = 0.015)
synthetic_blob = qim3d.generate.noise_object(noise_scale = 0.015)
synthetic_blob = qim3d.generate.noise_object(noise_scale = 0.015)
# Compute the volume of the blob
volume = qim3d.processing.volume(synthetic_blob, level=0.5)
volume = qim3d.features.volume(synthetic_blob, level=0.5)
volume = qim3d.features.volume(synthetic_blob, level=0.5)
print('Volume:', volume)
```
......@@ -58,11 +60,11 @@ def area(obj: np.ndarray|trimesh.Trimesh,
Compute the surface area of a 3D volume or mesh.
Args:
obj: Either a np.ndarray volume or a mesh object of type trimesh.Trimesh.
**mesh_kwargs: Additional arguments for mesh creation if the input is a volume.
obj (np.ndarray or trimesh.Trimesh): Either a np.ndarray volume or a mesh object of type trimesh.Trimesh.
**mesh_kwargs (Any): Additional arguments for mesh creation if the input is a volume.
Returns:
area: The surface area of the object.
area (float): The surface area of the object.
Example:
Compute area from a mesh:
......@@ -73,7 +75,8 @@ def area(obj: np.ndarray|trimesh.Trimesh,
mesh = qim3d.io.load_mesh('path/to/mesh.obj')
# Compute the surface area of the mesh
area = qim3d.processing.area(mesh)
area = qim3d.features.area(mesh)
area = qim3d.features.area(mesh)
print(f"Area: {area}")
```
......@@ -82,16 +85,19 @@ def area(obj: np.ndarray|trimesh.Trimesh,
import qim3d
# Generate a 3D blob
synthetic_blob = qim3d.generate.blob(noise_scale = 0.015)
synthetic_blob = qim3d.generate.noise_object(noise_scale = 0.015)
synthetic_blob = qim3d.generate.noise_object(noise_scale = 0.015)
# Compute the surface area of the blob
volume = qim3d.processing.area(synthetic_blob, level=0.5)
volume = qim3d.features.area(synthetic_blob, level=0.5)
volume = qim3d.features.area(synthetic_blob, level=0.5)
print('Area:', volume)
```
"""
if isinstance(obj, np.ndarray):
log.info("Converting volume to mesh.")
obj = qim3d.processing.create_mesh(obj, **mesh_kwargs)
obj = qim3d.mesh.from_volume(obj, **mesh_kwargs)
obj = qim3d.mesh.from_volume(obj, **mesh_kwargs)
return obj.area
......@@ -107,11 +113,11 @@ def sphericity(obj: np.ndarray|trimesh.Trimesh,
actual surface area.
Args:
obj: Either a np.ndarray volume or a mesh object of type trimesh.Trimesh.
**mesh_kwargs: Additional arguments for mesh creation if the input is a volume.
obj (np.ndarray or trimesh.Trimesh): Either a np.ndarray volume or a mesh object of type trimesh.Trimesh.
**mesh_kwargs (Any): Additional arguments for mesh creation if the input is a volume.
Returns:
sphericity: A float value representing the sphericity of the object.
sphericity (float): A float value representing the sphericity of the object.
Example:
Compute sphericity from a mesh:
......@@ -122,7 +128,8 @@ def sphericity(obj: np.ndarray|trimesh.Trimesh,
mesh = qim3d.io.load_mesh('path/to/mesh.obj')
# Compute the sphericity of the mesh
sphericity = qim3d.processing.sphericity(mesh)
sphericity = qim3d.features.sphericity(mesh)
sphericity = qim3d.features.sphericity(mesh)
```
Compute sphericity from a np.ndarray:
......@@ -130,10 +137,12 @@ def sphericity(obj: np.ndarray|trimesh.Trimesh,
import qim3d
# Generate a 3D blob
synthetic_blob = qim3d.generate.blob(noise_scale = 0.015)
synthetic_blob = qim3d.generate.noise_object(noise_scale = 0.015)
synthetic_blob = qim3d.generate.noise_object(noise_scale = 0.015)
# Compute the sphericity of the blob
sphericity = qim3d.processing.sphericity(synthetic_blob, level=0.5)
sphericity = qim3d.features.sphericity(synthetic_blob, level=0.5)
sphericity = qim3d.features.sphericity(synthetic_blob, level=0.5)
```
!!! info "Limitations due to pixelation"
......@@ -143,10 +152,13 @@ def sphericity(obj: np.ndarray|trimesh.Trimesh,
"""
if isinstance(obj, np.ndarray):
log.info("Converting volume to mesh.")
obj = qim3d.processing.create_mesh(obj, **mesh_kwargs)
obj = qim3d.mesh.from_volume(obj, **mesh_kwargs)
obj = qim3d.mesh.from_volume(obj, **mesh_kwargs)
volume = qim3d.processing.volume(obj)
area = qim3d.processing.area(obj)
volume = qim3d.features.volume(obj)
area = qim3d.features.area(obj)
volume = qim3d.features.volume(obj)
area = qim3d.features.area(obj)
if area == 0:
log.warning("Surface area is zero, sphericity is undefined.")
......
......@@ -110,7 +110,7 @@ class Tophat(FilterBase):
Returns:
The filtered image or volume.
"""
return tophat(input, dask=self.dask, chunks=self.chunks, **self.kwargs)
return tophat(input, dask=self.dask, **self.kwargs)
class Pipeline:
......@@ -118,13 +118,13 @@ class Pipeline:
Example:
```python
import qim3d
from qim3d.processing import Pipeline, Median, Gaussian, Maximum, Minimum
from qim3d.filters import Pipeline, Median, Gaussian, Maximum, Minimum
# Get data
vol = qim3d.examples.fly_150x256x256
# Show original
qim3d.viz.slices_grid(vol, axis=0, show=True)
fig1 = qim3d.viz.slices_grid(vol, num_slices=5, display_figure=True)
# Create filter pipeline
pipeline = Pipeline(
......@@ -139,7 +139,7 @@ class Pipeline:
vol_filtered = pipeline(vol)
# Show filtered
qim3d.viz.slices_grid(vol_filtered, axis=0)
fig2 = qim3d.viz.slices_grid(vol_filtered, num_slices=5, display_figure=True)
```
![original volume](assets/screenshots/filter_original.png)
![filtered volume](assets/screenshots/filter_processed.png)
......@@ -178,17 +178,17 @@ class Pipeline:
)
self.filters[name] = fn
def append(self, fn: Type[FilterBase]):
def append(self, fn: FilterBase):
"""
Appends a filter to the end of the sequence.
Args:
fn: An instance of a FilterBase subclass to be appended.
fn (FilterBase): An instance of a FilterBase subclass to be appended.
Example:
```python
import qim3d
from qim3d.processing import Pipeline, Maximum, Median
from qim3d.filters import Pipeline, Maximum, Median
# Create filter pipeline
pipeline = Pipeline(
......@@ -223,14 +223,14 @@ def gaussian(
Applies a Gaussian filter to the input volume using scipy.ndimage.gaussian_filter or dask_image.ndfilters.gaussian_filter.
Args:
vol: The input image or volume.
dask: Whether to use Dask for the Gaussian filter.
chunks: Defines how to divide the array into blocks when using Dask. Can be an integer, tuple, size in bytes, or "auto" for automatic sizing.
*args: Additional positional arguments for the Gaussian filter.
**kwargs: Additional keyword arguments for the Gaussian filter.
vol (np.ndarray): The input image or volume.
dask (bool, optional): Whether to use Dask for the Gaussian filter.
chunks (int or tuple or "'auto'", optional): Defines how to divide the array into blocks when using Dask. Can be an integer, tuple, size in bytes, or "auto" for automatic sizing.
*args (Any): Additional positional arguments for the Gaussian filter.
**kwargs (Any): Additional keyword arguments for the Gaussian filter.
Returns:
The filtered image or volume.
filtered_vol (np.ndarray): The filtered image or volume.
"""
if dask:
......@@ -251,13 +251,13 @@ def median(
Applies a median filter to the input volume using scipy.ndimage.median_filter or dask_image.ndfilters.median_filter.
Args:
vol: The input image or volume.
dask: Whether to use Dask for the median filter.
chunks: Defines how to divide the array into blocks when using Dask. Can be an integer, tuple, size in bytes, or "auto" for automatic sizing.
**kwargs: Additional keyword arguments for the median filter.
vol (np.ndarray): The input image or volume.
dask (bool, optional): Whether to use Dask for the median filter.
chunks (int or tuple or "'auto'", optional): Defines how to divide the array into blocks when using Dask. Can be an integer, tuple, size in bytes, or "auto" for automatic sizing.
**kwargs (Any): Additional keyword arguments for the median filter.
Returns:
The filtered image or volume.
filtered_vol (np.ndarray): The filtered image or volume.
"""
if dask:
if not isinstance(vol, da.Array):
......@@ -277,13 +277,13 @@ def maximum(
Applies a maximum filter to the input volume using scipy.ndimage.maximum_filter or dask_image.ndfilters.maximum_filter.
Args:
vol: The input image or volume.
dask: Whether to use Dask for the maximum filter.
chunks: Defines how to divide the array into blocks when using Dask. Can be an integer, tuple, size in bytes, or "auto" for automatic sizing.
**kwargs: Additional keyword arguments for the maximum filter.
vol (np.ndarray): The input image or volume.
dask (bool, optional): Whether to use Dask for the maximum filter.
chunks (int or tuple or "'auto'", optional): Defines how to divide the array into blocks when using Dask. Can be an integer, tuple, size in bytes, or "auto" for automatic sizing.
**kwargs (Any): Additional keyword arguments for the maximum filter.
Returns:
The filtered image or volume.
filtered_vol (np.ndarray): The filtered image or volume.
"""
if dask:
if not isinstance(vol, da.Array):
......@@ -303,13 +303,13 @@ def minimum(
Applies a minimum filter to the input volume using scipy.ndimage.minimum_filter or dask_image.ndfilters.minimum_filter.
Args:
vol: The input image or volume.
dask: Whether to use Dask for the minimum filter.
chunks: Defines how to divide the array into blocks when using Dask. Can be an integer, tuple, size in bytes, or "auto" for automatic sizing.
**kwargs: Additional keyword arguments for the minimum filter.
vol (np.ndarray): The input image or volume.
dask (bool, optional): Whether to use Dask for the minimum filter.
chunks (int or tuple or "'auto'", optional): Defines how to divide the array into blocks when using Dask. Can be an integer, tuple, size in bytes, or "auto" for automatic sizing.
**kwargs (Any): Additional keyword arguments for the minimum filter.
Returns:
The filtered image or volume.
filtered_vol (np.ndarray): The filtered image or volume.
"""
if dask:
if not isinstance(vol, da.Array):
......@@ -321,23 +321,19 @@ def minimum(
res = ndimage.minimum_filter(vol, **kwargs)
return res
def tophat(
vol: np.ndarray, dask: bool = False, chunks: str = "auto", **kwargs
) -> np.ndarray:
def tophat(vol, dask=False, **kwargs):
"""
Remove background from the volume.
Args:
vol: The volume to remove background from.
radius: The radius of the structuring element (default: 3).
background: Color of the background, 'dark' or 'bright' (default: 'dark'). If 'bright', volume will be inverted.
dask: Whether to use Dask for the tophat filter (not supported, will default to SciPy).
chunks: Defines how to divide the array into blocks when using Dask. Can be an integer, tuple, size in bytes, or "auto" for automatic sizing.
**kwargs: Additional keyword arguments.
vol (np.ndarray): The volume to remove background from.
dask (bool, optional): Whether to use Dask for the tophat filter (not supported, will default to SciPy).
**kwargs (Any): Additional keyword arguments.
`radius` (float): The radius of the structuring element (default: 3).
`background` (str): Color of the background, 'dark' or 'bright' (default: 'dark'). If 'bright', volume will be inverted.
Returns:
vol: The volume with background removed.
filtered_vol (np.ndarray): The volume with background removed.
"""
radius = kwargs["radius"] if "radius" in kwargs else 3
......
......@@ -147,12 +147,12 @@ def noise_object_collection(
Generate a 3D volume of multiple synthetic objects using Perlin noise.
Args:
collection_shape (tuple, optional): Shape of the final collection volume to generate. Defaults to (200, 200, 200).
collection_shape (tuple of ints, optional): Shape of the final collection volume to generate. Defaults to (200, 200, 200).
num_objects (int, optional): Number of synthetic objects to include in the collection. Defaults to 15.
positions (list[tuple], optional): List of specific positions as (z, y, x) coordinates for the objects. If not provided, they are placed randomly into the collection. Defaults to None.
min_shape (tuple, optional): Minimum shape of the objects. Defaults to (40, 40, 40).
max_shape (tuple, optional): Maximum shape of the objects. Defaults to (60, 60, 60).
object_shape_zoom (tuple, optional): Scaling factors for each dimension of each object. Defaults to (1.0, 1.0, 1.0).
min_shape (tuple of ints, optional): Minimum shape of the objects. Defaults to (40, 40, 40).
max_shape (tuple of ints, optional): Maximum shape of the objects. Defaults to (60, 60, 60).
object_shape_zoom (tuple of floats, optional): Scaling factors for each dimension of each object. Defaults to (1.0, 1.0, 1.0).
min_object_noise (float, optional): Minimum scale factor for Perlin noise. Defaults to 0.02.
max_object_noise (float, optional): Maximum scale factor for Perlin noise. Defaults to 0.05.
min_rotation_degrees (int, optional): Minimum rotation angle in degrees. Defaults to 0.
......@@ -165,7 +165,7 @@ def noise_object_collection(
min_threshold (float, optional): Minimum threshold value for clipping low intensity values. Defaults to 0.5.
max_threshold (float, optional): Maximum threshold value for clipping low intensity values. Defaults to 0.6.
smooth_borders (bool, optional): Flag for smoothing object borders to avoid straight edges in the objects. If True, the `min_threshold` and `max_threshold` parameters are ignored. Defaults to False.
object_shape (str, optional): Shape of the object to generate, either "cylinder", or "tube". Defaults to None.
object_shape (str or None, optional): Shape of the object to generate, either "cylinder", or "tube". Defaults to None.
seed (int, optional): Seed for reproducibility. Defaults to 0.
verbose (bool, optional): Flag to enable verbose logging. Defaults to False.
......@@ -189,10 +189,10 @@ def noise_object_collection(
# Generate synthetic collection of objects
num_objects = 15
synthetic_collection, labels = qim3d.generate.collection(num_objects = num_objects)
vol, labels = qim3d.generate.noise_object_collection(num_objects = num_objects)
# Visualize synthetic collection
qim3d.viz.vol(synthetic_collection)
qim3d.viz.volumetric(vol)
```
<iframe src="https://platform.qim.dk/k3d/synthetic_collection_default.html" width="100%" height="500" frameborder="0"></iframe>
......@@ -203,8 +203,8 @@ def noise_object_collection(
```python
# Visualize labels
cmap = qim3d.viz.colormaps.objects(nlabels=num_objects)
qim3d.viz.slicer(labels, cmap=cmap, vmax=num_objects)
cmap = qim3d.viz.colormaps.segmentation(num_labels=num_objects)
qim3d.viz.slicer(labels, color_map=cmap, value_max=num_objects)
```
![synthetic_collection](assets/screenshots/synthetic_collection_default_labels.gif)
......@@ -213,7 +213,7 @@ def noise_object_collection(
import qim3d
# Generate synthetic collection of dense objects
synthetic_collection, labels = qim3d.generate.collection(
vol, labels = qim3d.generate.collection(
min_high_value = 255,
max_high_value = 255,
min_object_noise = 0.05,
......@@ -224,7 +224,7 @@ def noise_object_collection(
max_gamma = 0.02)
# Visualize synthetic collection
qim3d.viz.vol(synthetic_collection)
qim3d.viz.vol(vol)
```
<iframe src="https://platform.qim.dk/k3d/synthetic_collection_dense.html" width="100%" height="500" frameborder="0"></iframe>
......@@ -233,7 +233,7 @@ def noise_object_collection(
import qim3d
# Generate synthetic collection of cylindrical structures
vol, labels = qim3d.generate.collection(num_objects = 40,
vol, labels = qim3d.generate.noise_object_collection(num_objects = 40,
collection_shape = (300, 150, 150),
min_shape = (280, 10, 10),
max_shape = (290, 15, 15),
......@@ -248,14 +248,14 @@ def noise_object_collection(
)
# Visualize synthetic collection
qim3d.viz.vol(vol)
qim3d.viz.volumetric(vol)
```
<iframe src="https://platform.qim.dk/k3d/synthetic_collection_cylinder.html" width="100%" height="500" frameborder="0"></iframe>
```python
# Visualize slices
qim3d.viz.slices_grid(vol, n_slices=15)
qim3d.viz.slices_grid(vol, num_slices=15)
```
![synthetic_collection_cylinder](assets/screenshots/synthetic_collection_cylinder_slices.png)
......@@ -264,7 +264,7 @@ def noise_object_collection(
import qim3d
# Generate synthetic collection of tubular (hollow) structures
vol, labels = qim3d.generate.collection(num_objects = 10,
vol, labels = qim3d.generate.noise_object_collection(num_objects = 10,
collection_shape = (200, 200, 200),
min_shape = (180, 25, 25),
max_shape = (190, 35, 35),
......@@ -279,13 +279,13 @@ def noise_object_collection(
)
# Visualize synthetic collection
qim3d.viz.vol(vol)
qim3d.viz.volumetric(vol)
```
<iframe src="https://platform.qim.dk/k3d/synthetic_collection_tube.html" width="100%" height="500" frameborder="0"></iframe>
```python
# Visualize slices
qim3d.viz.slices_grid(vol, n_slices=15, axis=1)
qim3d.viz.slices_grid(vol, num_slices=15, slice_axis=1)
```
![synthetic_collection_tube](assets/screenshots/synthetic_collection_tube_slices.png)
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment