block
¤
Classes:
| Name | Description |
|---|---|
Block |
A block/tile of a (larger) tensor |
Functions:
| Name | Description |
|---|---|
split_tensor_into_blocks |
divide a sample tensor into tensor blocks. |
Block
dataclass
¤
Block(sample_shape: PerAxis[int], inner_slice: PerAxis[SliceInfo], halo: PerAxis[Halo], block_index: BlockIndex, blocks_in_sample: TotalNumberOfBlocks, data: Tensor)
Bases: BlockMeta
flowchart TD
bioimageio.core.block.Block[Block]
bioimageio.core.block_meta.BlockMeta[BlockMeta]
bioimageio.core.block_meta.BlockMeta --> bioimageio.core.block.Block
click bioimageio.core.block.Block href "" "bioimageio.core.block.Block"
click bioimageio.core.block_meta.BlockMeta href "" "bioimageio.core.block_meta.BlockMeta"
A block/tile of a (larger) tensor
-
API Reference
blocksplit_tensor_into_blocks
-
API Reference
sampleSampleBlock
Methods:
| Name | Description |
|---|---|
__post_init__ |
|
from_meta |
|
from_sample_member |
|
get_transformed |
|
Attributes:
| Name | Type | Description |
|---|---|---|
block_index |
BlockIndex
|
the i-th block of the sample |
blocks_in_sample |
TotalNumberOfBlocks
|
total number of blocks in the sample |
data |
Tensor
|
the block's tensor, e.g. a (padded) slice of some larger, original tensor |
dims |
Collection[AxisId]
|
|
halo |
PerAxis[Halo]
|
halo enlarging the inner region to the block's sizes |
inner_data |
|
|
inner_shape |
PerAxis[int]
|
axis lengths of the inner region (without halo) |
inner_slice |
PerAxis[SliceInfo]
|
inner region (without halo) wrt the sample |
inner_slice_wo_overlap |
PerAxis[SliceInfo]
|
subslice of the inner slice, such that all |
local_slice |
PerAxis[SliceInfo]
|
inner slice wrt the block, not the sample |
outer_slice |
PerAxis[SliceInfo]
|
slice of the outer block (without padding) wrt the sample |
padding |
PerAxis[PadWidth]
|
padding to realize the halo at the sample edge |
sample_shape |
PerAxis[int]
|
the axis sizes of the whole (unblocked) sample |
shape |
PerAxis[int]
|
axis lengths of the block |
tagged_shape |
PerAxis[int]
|
alias for shape |
blocks_in_sample
instance-attribute
¤
blocks_in_sample: TotalNumberOfBlocks
total number of blocks in the sample
data
instance-attribute
¤
data: Tensor
the block's tensor, e.g. a (padded) slice of some larger, original tensor
inner_shape
cached
property
¤
inner_shape: PerAxis[int]
axis lengths of the inner region (without halo)
inner_slice
instance-attribute
¤
inner region (without halo) wrt the sample
inner_slice_wo_overlap
property
¤
subslice of the inner slice, such that all inner_slice_wo_overlap can be
stiched together trivially to form the original sample.
This can also be used to calculate statistics without overrepresenting block edge regions.
local_slice
cached
property
¤
inner slice wrt the block, not the sample
outer_slice
cached
property
¤
slice of the outer block (without padding) wrt the sample
padding
cached
property
¤
padding to realize the halo at the sample edge where we cannot simply enlarge the inner slice
sample_shape
instance-attribute
¤
sample_shape: PerAxis[int]
the axis sizes of the whole (unblocked) sample
__post_init__
¤
__post_init__()
Source code in src/bioimageio/core/block.py
36 37 38 39 40 41 42 43 44 45 46 | |
from_meta
classmethod
¤
Source code in src/bioimageio/core/block.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
from_sample_member
classmethod
¤
Source code in src/bioimageio/core/block.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
get_transformed
¤
get_transformed(new_axes: PerAxis[Union[LinearAxisTransform, int]]) -> Self
Source code in src/bioimageio/core/block.py
65 66 67 68 | |
split_tensor_into_blocks
¤
split_tensor_into_blocks(tensor: Tensor, block_shape: PerAxis[int], *, halo: PerAxis[HaloLike], stride: Optional[PerAxis[int]] = None, pad_mode: PadMode) -> Tuple[TotalNumberOfBlocks, Generator[Block, Any, None]]
divide a sample tensor into tensor blocks.
Source code in src/bioimageio/core/block.py
92 93 94 95 96 97 98 99 100 101 102 103 104 | |