Skip to content

Commit 65eb33c

Browse files
committed
Fix Flips documentation and tests errors caused by master merge
This adds missing documentation for the Flip transformations, and adds FlipDim to the reference page. Also, fixes the "Big Pipeline/3D" unit test that was failing due to not being able to compose two ComposedProjectiveTransforms.
1 parent fe42f9b commit 65eb33c

File tree

5 files changed

+28
-1
lines changed

5 files changed

+28
-1
lines changed

docs/src/ref.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ BoundingBox
66
CenterCrop
77
CenterResizeCrop
88
Crop
9+
FlipDim
910
FlipX
1011
FlipY
1112
FlipZ

docs/src/transformations.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Projective transformations include:
2626
Affine transformations are a subgroup of projective transformations that can be composed very efficiently: composing two affine transformations results in another affine transformation. Affine transformations can represent translation, scaling, reflection and rotation. Available `Transform`s are:
2727

2828
```@docs; canonical=false
29+
FlipDim
2930
FlipX
3031
FlipY
3132
FlipZ

src/DataAugmentation.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export Item,
8484
apply,
8585
Reflect,
8686
WarpAffine,
87+
FlipDim,
8788
FlipX,
8889
FlipY,
8990
FlipZ,

src/projective/affine.jl

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,11 @@ end
258258

259259
"""
260260
FlipDim{N}(dim)
261+
261262
Reflect `N` dimensional data along the axis of dimension `dim`. Must satisfy 1 <= `dim` <= `N`.
263+
262264
## Examples
265+
263266
```julia
264267
tfm = FlipDim{2}(1)
265268
```
@@ -269,15 +272,33 @@ struct FlipDim{N} <: ProjectiveTransform
269272
FlipDim{N}(dim) where N = 1 <= dim <= N ? new{N}(dim) : error("invalid dimension")
270273
end
271274

272-
# 2D images use (r, c) = (y, x) convention
275+
"""
276+
FlipX{N}()
277+
278+
Flip `N` dimensional data along the x-axis. 2D images use (r, c) = (y, x)
279+
convention such that x-axis flips occur along the second dimension. For N >= 3,
280+
x-axis flips occur along the first dimension.
281+
"""
273282
struct FlipX{N}
274283
FlipX{N}() where N = FlipDim{N}(N==2 ? 2 : 1)
275284
end
276285

286+
"""
287+
FlipY{N}()
288+
289+
Flip `N` dimensional data along the y-axis. 2D images use (r, c) = (y, x)
290+
convention such that y-axis flips occur along the first dimension. For N >= 3,
291+
y-axis flips occur along the second dimension.
292+
"""
277293
struct FlipY{N}
278294
FlipY{N}() where N = FlipDim{N}(N==2 ? 1 : 2)
279295
end
280296

297+
"""
298+
FlipZ{N}()
299+
300+
Flip `N` dimensional data along the z-axis.
301+
"""
281302
struct FlipZ{N}
282303
FlipZ{N}() where N = FlipDim{N}(3)
283304
end

src/projective/compose.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ compose(composed::ComposedProjectiveTransform, tfm::ProjectiveTransform) =
2626
compose(tfm::ProjectiveTransform, composed::ComposedProjectiveTransform) =
2727
ComposedProjectiveTransform(tfm, composed.tfms...)
2828

29+
compose(composed1::ComposedProjectiveTransform, composed2::ComposedProjectiveTransform) =
30+
ComposedProjectiveTransform(composed1.tfms..., composed2.tfms...)
31+
2932

3033
# The random state is collected from the transformations that make up the
3134
# `ComposedProjectiveTransform`:

0 commit comments

Comments
 (0)