sample
¤
Classes:
| Name | Description |
|---|---|
LinearSampleAxisTransform |
|
Sample |
A dataset sample. |
SampleBlock |
A block of a dataset sample |
SampleBlockBase |
base class for |
SampleBlockMeta |
Meta data of a dataset sample block |
SampleBlockWithOrigin |
A |
Functions:
| Name | Description |
|---|---|
sample_block_generator |
|
sample_block_meta_generator |
|
Attributes:
| Name | Type | Description |
|---|---|---|
BlockT |
|
BlockT
module-attribute
¤
-
API Reference
sampleSampleBlockBase
-
API Reference
sample
LinearSampleAxisTransform
dataclass
¤
Bases: LinearAxisTransform
flowchart TD
bioimageio.core.sample.LinearSampleAxisTransform[LinearSampleAxisTransform]
bioimageio.core.block_meta.LinearAxisTransform[LinearAxisTransform]
bioimageio.core.block_meta.LinearAxisTransform --> bioimageio.core.sample.LinearSampleAxisTransform
click bioimageio.core.sample.LinearSampleAxisTransform href "" "bioimageio.core.sample.LinearSampleAxisTransform"
click bioimageio.core.block_meta.LinearAxisTransform href "" "bioimageio.core.block_meta.LinearAxisTransform"
-
API Reference
digest_specget_block_transform
Methods:
| Name | Description |
|---|---|
compute |
|
Attributes:
| Name | Type | Description |
|---|---|---|
axis |
AxisId
|
|
member |
MemberId
|
|
offset |
int
|
|
scale |
float
|
|
compute
¤
compute(s: int, round: Callable[[float], int] = floor) -> int
Source code in src/bioimageio/core/block_meta.py
41 42 | |
Sample
dataclass
¤
A dataset sample.
A Sample has members, which allows to combine multiple tensors into a single
sample.
For example a Sample from a dataset with masked images may contain a
MemberId("raw") and MemberId("mask") image.
- API Reference
- API Reference
Methods:
| Name | Description |
|---|---|
__getitem__ |
|
as_arrays |
Return sample as dictionary of arrays. |
as_single_block |
|
from_blocks |
|
pad |
Convenience method to pad sample members. |
split_into_blocks |
|
Attributes:
| Name | Type | Description |
|---|---|---|
id |
SampleId
|
Identifies the |
members |
Dict[MemberId, Tensor]
|
The sample's tensors |
shape |
PerMember[PerAxis[int]]
|
|
stat |
Stat
|
Sample and dataset statistics |
id
instance-attribute
¤
id: SampleId
Identifies the Sample within the dataset -- typically a number or a string.
__getitem__
¤
__getitem__(key: PerMember[Union[SliceInfo, slice, int, PerAxis[Union[SliceInfo, slice, int]], Tensor, xr.DataArray]]) -> Self
Source code in src/bioimageio/core/sample.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
as_arrays
¤
as_arrays() -> Dict[MemberId, NDArray[Any]]
Return sample as dictionary of arrays.
Source code in src/bioimageio/core/sample.py
91 92 93 | |
as_single_block
¤
Source code in src/bioimageio/core/sample.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
from_blocks
classmethod
¤
from_blocks(sample_blocks: Iterable[SampleBlock], *, fill_value: float = float('nan')) -> Self
Source code in src/bioimageio/core/sample.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
pad
¤
pad(pad_width: PerMember[PerAxis[Union[int, PadWidthLike]]], mode: Union[PerMember[PadMode], PadMode]) -> Self
Convenience method to pad sample members.
Source code in src/bioimageio/core/sample.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
split_into_blocks
¤
split_into_blocks(block_shapes: PerMember[PerAxis[int]], halo: PerMember[PerAxis[HaloLike]], pad_mode: Union[PadMode, PerMember[PadMode]], broadcast: bool = False) -> Tuple[TotalNumberOfBlocks, Iterable[SampleBlockWithOrigin]]
Source code in src/bioimageio/core/sample.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
SampleBlock
dataclass
¤
SampleBlock(sample_shape: PerMember[PerAxis[int]], sample_id: SampleId, blocks: Dict[MemberId, BlockT], block_index: BlockIndex, blocks_in_sample: TotalNumberOfBlocks, stat: Stat)
Bases: SampleBlockBase[Block]
flowchart TD
bioimageio.core.sample.SampleBlock[SampleBlock]
bioimageio.core.sample.SampleBlockBase[SampleBlockBase]
bioimageio.core.sample.SampleBlockBase --> bioimageio.core.sample.SampleBlock
click bioimageio.core.sample.SampleBlock href "" "bioimageio.core.sample.SampleBlock"
click bioimageio.core.sample.SampleBlockBase href "" "bioimageio.core.sample.SampleBlockBase"
A block of a dataset sample
-
API Reference
sampleSampleBlockWithOrigin
Methods:
| Name | Description |
|---|---|
get_transformed_meta |
|
Attributes:
| Name | Type | Description |
|---|---|---|
block_index |
BlockIndex
|
the n-th block of the sample |
blocks |
Dict[MemberId, BlockT]
|
Individual tensor blocks comprising this sample block |
blocks_in_sample |
TotalNumberOfBlocks
|
total number of blocks in the sample |
inner_shape |
PerMember[PerAxis[int]]
|
|
members |
PerMember[Tensor]
|
the sample block's tensors |
sample_id |
SampleId
|
identifier for the sample within its dataset |
sample_shape |
PerMember[PerAxis[int]]
|
the sample shape this block represents a part of |
shape |
PerMember[PerAxis[int]]
|
|
stat |
Stat
|
computed statistics |
blocks
instance-attribute
¤
Individual tensor blocks comprising this sample block
blocks_in_sample
instance-attribute
¤
blocks_in_sample: TotalNumberOfBlocks
total number of blocks in the sample
sample_shape
instance-attribute
¤
the sample shape this block represents a part of
get_transformed_meta
¤
get_transformed_meta(new_axes: PerMember[PerAxis[Union[LinearSampleAxisTransform, int]]]) -> SampleBlockMeta
Source code in src/bioimageio/core/sample.py
344 345 346 347 348 349 350 351 352 353 | |
SampleBlockBase
dataclass
¤
SampleBlockBase(sample_shape: PerMember[PerAxis[int]], sample_id: SampleId, blocks: Dict[MemberId, BlockT], block_index: BlockIndex, blocks_in_sample: TotalNumberOfBlocks)
Bases: Generic[BlockT]
flowchart TD
bioimageio.core.sample.SampleBlockBase[SampleBlockBase]
click bioimageio.core.sample.SampleBlockBase href "" "bioimageio.core.sample.SampleBlockBase"
base class for SampleBlockMeta and SampleBlock
-
API Reference
sample
Attributes:
| Name | Type | Description |
|---|---|---|
block_index |
BlockIndex
|
the n-th block of the sample |
blocks |
Dict[MemberId, BlockT]
|
Individual tensor blocks comprising this sample block |
blocks_in_sample |
TotalNumberOfBlocks
|
total number of blocks in the sample |
inner_shape |
PerMember[PerAxis[int]]
|
|
sample_id |
SampleId
|
identifier for the sample within its dataset |
sample_shape |
PerMember[PerAxis[int]]
|
the sample shape this block represents a part of |
shape |
PerMember[PerAxis[int]]
|
|
blocks
instance-attribute
¤
Individual tensor blocks comprising this sample block
blocks_in_sample
instance-attribute
¤
blocks_in_sample: TotalNumberOfBlocks
total number of blocks in the sample
sample_shape
instance-attribute
¤
the sample shape this block represents a part of
SampleBlockMeta
dataclass
¤
SampleBlockMeta(sample_shape: PerMember[PerAxis[int]], sample_id: SampleId, blocks: Dict[MemberId, BlockT], block_index: BlockIndex, blocks_in_sample: TotalNumberOfBlocks)
Bases: SampleBlockBase[BlockMeta]
flowchart TD
bioimageio.core.sample.SampleBlockMeta[SampleBlockMeta]
bioimageio.core.sample.SampleBlockBase[SampleBlockBase]
bioimageio.core.sample.SampleBlockBase --> bioimageio.core.sample.SampleBlockMeta
click bioimageio.core.sample.SampleBlockMeta href "" "bioimageio.core.sample.SampleBlockMeta"
click bioimageio.core.sample.SampleBlockBase href "" "bioimageio.core.sample.SampleBlockBase"
Meta data of a dataset sample block
Methods:
| Name | Description |
|---|---|
get_transformed |
|
with_data |
|
Attributes:
| Name | Type | Description |
|---|---|---|
block_index |
BlockIndex
|
the n-th block of the sample |
blocks |
Dict[MemberId, BlockT]
|
Individual tensor blocks comprising this sample block |
blocks_in_sample |
TotalNumberOfBlocks
|
total number of blocks in the sample |
inner_shape |
PerMember[PerAxis[int]]
|
|
sample_id |
SampleId
|
identifier for the sample within its dataset |
sample_shape |
PerMember[PerAxis[int]]
|
the sample shape this block represents a part of |
shape |
PerMember[PerAxis[int]]
|
|
blocks
instance-attribute
¤
Individual tensor blocks comprising this sample block
blocks_in_sample
instance-attribute
¤
blocks_in_sample: TotalNumberOfBlocks
total number of blocks in the sample
sample_shape
instance-attribute
¤
the sample shape this block represents a part of
get_transformed
¤
get_transformed(new_axes: PerMember[PerAxis[Union[LinearSampleAxisTransform, int]]]) -> Self
Source code in src/bioimageio/core/sample.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |
with_data
¤
with_data(data: PerMember[Tensor], *, stat: Stat) -> SampleBlock
Source code in src/bioimageio/core/sample.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
SampleBlockWithOrigin
dataclass
¤
SampleBlockWithOrigin(sample_shape: PerMember[PerAxis[int]], sample_id: SampleId, blocks: Dict[MemberId, BlockT], block_index: BlockIndex, blocks_in_sample: TotalNumberOfBlocks, stat: Stat, origin: Sample)
Bases: SampleBlock
flowchart TD
bioimageio.core.sample.SampleBlockWithOrigin[SampleBlockWithOrigin]
bioimageio.core.sample.SampleBlock[SampleBlock]
bioimageio.core.sample.SampleBlockBase[SampleBlockBase]
bioimageio.core.sample.SampleBlock --> bioimageio.core.sample.SampleBlockWithOrigin
bioimageio.core.sample.SampleBlockBase --> bioimageio.core.sample.SampleBlock
click bioimageio.core.sample.SampleBlockWithOrigin href "" "bioimageio.core.sample.SampleBlockWithOrigin"
click bioimageio.core.sample.SampleBlock href "" "bioimageio.core.sample.SampleBlock"
click bioimageio.core.sample.SampleBlockBase href "" "bioimageio.core.sample.SampleBlockBase"
A SampleBlock with a reference (origin) to the whole Sample
-
API Reference
samplesample_block_generator
Methods:
| Name | Description |
|---|---|
get_transformed_meta |
|
Attributes:
| Name | Type | Description |
|---|---|---|
block_index |
BlockIndex
|
the n-th block of the sample |
blocks |
Dict[MemberId, BlockT]
|
Individual tensor blocks comprising this sample block |
blocks_in_sample |
TotalNumberOfBlocks
|
total number of blocks in the sample |
inner_shape |
PerMember[PerAxis[int]]
|
|
members |
PerMember[Tensor]
|
the sample block's tensors |
origin |
Sample
|
the sample this sample block was taken from |
sample_id |
SampleId
|
identifier for the sample within its dataset |
sample_shape |
PerMember[PerAxis[int]]
|
the sample shape this block represents a part of |
shape |
PerMember[PerAxis[int]]
|
|
stat |
Stat
|
computed statistics |
blocks
instance-attribute
¤
Individual tensor blocks comprising this sample block
blocks_in_sample
instance-attribute
¤
blocks_in_sample: TotalNumberOfBlocks
total number of blocks in the sample
sample_shape
instance-attribute
¤
the sample shape this block represents a part of
get_transformed_meta
¤
get_transformed_meta(new_axes: PerMember[PerAxis[Union[LinearSampleAxisTransform, int]]]) -> SampleBlockMeta
Source code in src/bioimageio/core/sample.py
344 345 346 347 348 349 350 351 352 353 | |
sample_block_generator
¤
sample_block_generator(blocks: Iterable[PerMember[BlockMeta]], *, origin: Sample, pad_mode: Union[PadMode, PerMember[PadMode]]) -> Iterable[SampleBlockWithOrigin]
Source code in src/bioimageio/core/sample.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | |
sample_block_meta_generator
¤
sample_block_meta_generator(blocks: Iterable[PerMember[BlockMeta]], *, sample_shape: PerMember[PerAxis[int]], sample_id: SampleId)
Source code in src/bioimageio/core/sample.py
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | |