Skip to content

Commit

Permalink
Merge pull request #584 from bioimage-io/concatenable
Browse files Browse the repository at this point in the history
add input axis flag `concatenable`
  • Loading branch information
FynnBe authored Apr 16, 2024
2 parents 7519a89 + 1eec08a commit 4bf1ba9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ Made with [contrib.rocks](https://contrib.rocks).

### bioimageio.spec Python package

#### bioimageio.spec 0.5.2

* new patch version model 0.5.2

#### bioimageio.spec 0.5.1

* new patch version model 0.5.1
Expand Down Expand Up @@ -236,6 +240,11 @@ Made with [contrib.rocks](https://contrib.rocks).

### Resource Description Format Versions

#### model 0.5.2

* Non-breaking changes
* added `concatenable` flag to index, time and space input axes

#### model 0.5.1

* Non-breaking changes
Expand Down
2 changes: 1 addition & 1 deletion bioimageio/spec/VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "0.5.1post1"
"version": "0.5.2"
}
31 changes: 28 additions & 3 deletions bioimageio/spec/model/v0_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ class SizeReference(Node):
1. The axis and the referenced axis need to have the same unit (or no unit).
2. Batch axes may not be referenced.
3. Fractions are rounded down.
4. If the reference axis is `concatenable` the referencing axis is assumed to be
`concatenable` as well with the same block order.
example:
An unisotropic input image of w*h=100*49 pixels depicts a phsical space of 200*196mm².
Expand Down Expand Up @@ -433,6 +435,10 @@ class BatchAxis(AxisBase):
def scale(self):
return 1.0

@property
def concatenable(self):
return True

@property
def unit(self):
return None
Expand All @@ -447,6 +453,10 @@ class ChannelAxis(AxisBase):
def size(self) -> int:
return len(self.channel_names)

@property
def concatenable(self):
return False

@property
def scale(self) -> float:
return 1.0
Expand Down Expand Up @@ -490,7 +500,12 @@ class _WithInputAxisSize(Node):


class IndexInputAxis(IndexAxisBase, _WithInputAxisSize):
pass
concatenable: bool = False
"""If a model has a `concatenable` input axis, it can be processed blockwise,
splitting a longer sample axis into blocks matching its input tensor description.
Output axes are concatenable if they have a `SizeReference` to a concatenable
input axis.
"""


class IndexOutputAxis(IndexAxisBase):
Expand Down Expand Up @@ -520,7 +535,12 @@ class TimeAxisBase(AxisBase):


class TimeInputAxis(TimeAxisBase, _WithInputAxisSize):
pass
concatenable: bool = False
"""If a model has a `concatenable` input axis, it can be processed blockwise,
splitting a longer sample axis into blocks matching its input tensor description.
Output axes are concatenable if they have a `SizeReference` to a concatenable
input axis.
"""


class SpaceAxisBase(AxisBase):
Expand All @@ -531,7 +551,12 @@ class SpaceAxisBase(AxisBase):


class SpaceInputAxis(SpaceAxisBase, _WithInputAxisSize):
pass
concatenable: bool = False
"""If a model has a `concatenable` input axis, it can be processed blockwise,
splitting a longer sample axis into blocks matching its input tensor description.
Output axes are concatenable if they have a `SizeReference` to a concatenable
input axis.
"""


_InputAxisUnion = Union[
Expand Down

0 comments on commit 4bf1ba9

Please sign in to comment.