Skip to content

Webknossos annotation

linc_convert.modalities.wk.webknossos_annotation

Convert annotation downloaded from webknossos into ome.zarr format.

convert

convert(wkw_dir=None, ome_dir=None, dic=None, general_config=None, zarr_config=None, nii_config=None)

Convert annotations (in .wkw format) from webknossos to ome.zarr format.

This script converts annotations from webknossos, following the czyx direction, to the ome.zarr format. The conversion ensures that the annotations match the underlying dataset.

Parameters:

Name Type Description Default
wkw_dir str

Path to the unzipped manual annotation folder downloaded from webknossos in .wkw format. For example: .../annotation_folder/data_Volume.

None
ome_dir str

Path to the underlying ome.zarr dataset, following the BIDS naming standard.

None
dic dict

A dictionary mapping annotation values to the following standard values if annotation doesn't match the standard. The dictionary should be in single quotes, with keys in double quotes, for example: dic = '{"2": 1, "4": 2}'. The standard values are: - 0: background - 1: Light Bundle - 2: Moderate Bundle - 3: Dense Bundle - 4: Light Terminal - 5: Moderate Terminal - 6: Dense Terminal - 7: Single Fiber

None
general_config GeneralConfig

General configuration

None
zarr_config ZarrConfig

Zarr related configuration

None
nii_config NiftiConfig

NIfTI header related configuration

None

get_mask_name

get_mask_name(level)

Return the name of the mask for a given resolution level.

Parameters:

Name Type Description Default
level int

The resolution level for which to return the mask name.

required

Returns:

Type Description
str

The name of the mask for the given level.

cal_distance

cal_distance(img)

Return the distance of non-zero values to the top border.

Parameters:

Name Type Description Default
img ndarray

The array to calculate distance of object inside to border

required

Returns:

Type Description
int

The distance of non-zero to the top border

find_borders

find_borders(img)

Return the distances of non-zero values to four borders.

Parameters:

Name Type Description Default
img ndarray

The array to calculate distance of object inside to border

required

Returns:

Type Description
int

The distance of non-zero values to four borders