From 366d8baea4d35305f8a427c5be555080dde828fa Mon Sep 17 00:00:00 2001 From: Yael Balbastre Date: Thu, 9 Jul 2026 08:02:56 +0100 Subject: [PATCH 1/2] [DOC] fix (cc.map -> cc.ctx.map) + improve readability of some examples --- docs/start.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/docs/start.md b/docs/start.md index 637c43b..a8d045f 100755 --- a/docs/start.md +++ b/docs/start.md @@ -240,25 +240,28 @@ This is done using the `cc.MappedTransform` meta-transform (or the `cc.ctx.map` utility function): ```python -# using positionals geom = cc.RandomElasticTransform() noise = cc.GaussianNoiseTransform() -trf = cc.SequentialTranform([geom, cc.map(noise, None)]) + +# using positionals +trf = cc.SequentialTranform([ + geom, # apply `geom` to all tensors + cc.ctx.map(noise, None) # apply `noise` to the first tensor only +]) img, lab = trf(img, lab) # using keywords -geom = cc.RandomElasticTransform() -noise = cc.GaussianNoiseTransform() -trf = cc.SequentialTranform([geom, cc.map(image=noise)]) +trf = cc.SequentialTranform([ + geom, # apply `geom` to all tensors + cc.ctx.map(image=noise) # apply `noise` to the `image` key. +]) img, lab = trf(image=img, label=lab) # using dictionaries dat = [dict(image=img1, label=lab1), dict(image=img2, label=lab2)] -geom = cc.RandomElasticTransform() -noise = cc.GaussianNoiseTransform() trf = cc.SequentialTranform([ geom, - cc.map(image=noise, nested=True) # !! must be `nested` + cc.ctx.map(image=noise, nested=True) # !! must be `nested` ]) dat = trf(dat) ``` @@ -269,11 +272,12 @@ Alternatively, a transform can be applied selectively to a set of keys ```python geom = cc.RandomElasticTransform() noise = cc.GaussianNoiseTransform() + +# Only apply `noise` to the `image` key trf = cc.SequentialTranform([geom, cc.ctx.include(noise, "image")]) img, lab = trf(image=img, label=lab) -geom = cc.RandomElasticTransform() -noise = cc.GaussianNoiseTransform() +# Apply `noise` to all tensors _except_ the `label` key. trf = cc.SequentialTranform([geom, cc.ctx.exclude(noise, "label")]) img, lab = trf(image=img, label=lab) ``` From 66916bed390198cedcd682ab56fcbe41e7f0af88 Mon Sep 17 00:00:00 2001 From: Yael Balbastre Date: Thu, 9 Jul 2026 08:06:27 +0100 Subject: [PATCH 2/2] [DOC] fix a couple of wrong references in api index --- docs/api/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/api/index.md b/docs/api/index.md index b6ff786..7e406dd 100755 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -88,12 +88,12 @@ We define aliases for these meta-transforms under `cc.ctx`: options: heading_level: 3 -??? quote "[cc.ctx.exclude](cts/#cornucopia.ctx.exclude) is [cc.RandomizedTransform](special/#cornucopia.special.RandomizedTransform)" +??? quote "[cc.ctx.exclude](cts/#cornucopia.ctx.exclude) is [cc.ExcludeKeysTransform](special/#cornucopia.special.RandomizedTransform)" ::: cornucopia.ctx.exclude options: heading_level: 3 -??? quote "[cc.ctx.consume](cts/#cornucopia.ctx.consume) is [cc.ExcludeKeysTransform](special/#cornucopia.special.ExcludeKeysTransform)" +??? quote "[cc.ctx.consume](cts/#cornucopia.ctx.consume) is [cc.ConsumeKeysTransform](special/#cornucopia.special.ExcludeKeysTransform)" ::: cornucopia.ctx.consume options: heading_level: 3 @@ -641,6 +641,6 @@ We define aliases for these meta-transforms under `cc.ctx`: heading_level: 3 ??? quote "[cc.SynthFromLabelTransform](intensity/#cornucopia.synth.SynthFromLabelTransform)(...)
Synthesize an MRI from an existing label map." - ::: cornucopia.synth.IntensityTransform + ::: cornucopia.synth.SynthFromLabelTransform options: heading_level: 3