block_meta
¤
Classes:
| Name | Description |
|---|---|
BlockMeta |
Block meta data of a sample member (a tensor in a sample) |
LinearAxisTransform |
|
Functions:
| Name | Description |
|---|---|
split_multiple_shapes_into_blocks |
|
split_shape_into_blocks |
|
BlockMeta
dataclass
¤
BlockMeta(sample_shape: PerAxis[int], inner_slice: PerAxis[SliceInfo], halo: PerAxis[Halo], block_index: BlockIndex, blocks_in_sample: TotalNumberOfBlocks)
Block meta data of a sample member (a tensor in a sample)
Figure for illustration: The first 2d block (dashed) of a sample member (bold). The inner slice (thin) is expanded by a halo in both dimensions on both sides. The outer slice reaches from the sample member origin (0, 0) to the right halo point.
first block (at the sample origin)
┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─┐
╷ halo(left) ╷
╷ padding outside the sample ╷
╷ (0, 0)┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━┯━━━➔
╷ ┃ │ ╷ sample member
╷ ┃ inner │ outer ╷
╷ ┃ region │ region ╷
╷ ┃ /slice │ /slice ╷
╷ ┃ │ ╷
╷ ┣─────────────────┘ ╷
╷ ┃ outer region/slice ╷
╷ ┃ halo(right) ╷
└ ─ ─ ─ ─┃─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─┘
⬇
Note: - Inner and outer slices are specified in sample member coordinates. - The outer_slice of a block at the sample edge may overlap by more than the halo with the neighboring block (the inner slices will not overlap though).
- API Reference
- API Reference
Methods:
| Name | Description |
|---|---|
__post_init__ |
|
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 |
dims |
Collection[AxisId]
|
|
halo |
PerAxis[Halo]
|
halo enlarging the inner region to the block's sizes |
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
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_meta.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
get_transformed
¤
get_transformed(new_axes: PerAxis[Union[LinearAxisTransform, int]]) -> Self
Source code in src/bioimageio/core/block_meta.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
LinearAxisTransform
dataclass
¤
LinearAxisTransform(axis: AxisId, scale: float, offset: int)
-
API Reference
sampleLinearSampleAxisTransform
Methods:
| Name | Description |
|---|---|
compute |
|
Attributes:
| Name | Type | Description |
|---|---|---|
axis |
AxisId
|
|
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 | |
split_multiple_shapes_into_blocks
¤
split_multiple_shapes_into_blocks(shapes: PerMember[PerAxis[int]], block_shapes: PerMember[PerAxis[int]], *, halo: PerMember[PerAxis[HaloLike]], strides: Optional[PerMember[PerAxis[int]]] = None, broadcast: bool = False) -> Tuple[TotalNumberOfBlocks, Iterable[PerMember[BlockMeta]]]
Source code in src/bioimageio/core/block_meta.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
split_shape_into_blocks
¤
split_shape_into_blocks(shape: PerAxis[int], block_shape: PerAxis[int], halo: PerAxis[HaloLike], stride: Optional[PerAxis[int]] = None) -> Tuple[TotalNumberOfBlocks, Generator[BlockMeta, Any, None]]
Source code in src/bioimageio/core/block_meta.py
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 | |