@@ -336,7 +336,7 @@ class DataConfig:
336336
337337 # Dataset type
338338 dataset_type : Optional [str ] = None # Type of dataset: None (volume), 'filename', 'tile', etc.
339-
339+
340340 # 2D data support
341341 do_2d : bool = False # Enable 2D data processing (extract 2D slices from 3D volumes)
342342
@@ -616,7 +616,7 @@ class MonitorConfig:
616616class FlipConfig :
617617 """Random flipping augmentation."""
618618
619- enabled : bool = True
619+ enabled : Optional [ bool ] = None # None=use preset default, True/False=explicit
620620 prob : float = 0.5
621621 spatial_axis : Optional [List [int ]] = None # None = all axes
622622
@@ -625,7 +625,7 @@ class FlipConfig:
625625class AffineConfig :
626626 """Affine transformation augmentation (rotation, scaling, shearing)."""
627627
628- enabled : bool = False # Disabled by default (can be combined with Rotate90d)
628+ enabled : Optional [ bool ] = None
629629 prob : float = 0.5
630630 rotate_range : Tuple [float , float , float ] = (0.2 , 0.2 , 0.2 ) # Rotation range in radians (~11°)
631631 scale_range : Tuple [float , float , float ] = (0.1 , 0.1 , 0.1 ) # Scaling range (±10%)
@@ -636,7 +636,7 @@ class AffineConfig:
636636class RotateConfig :
637637 """Random rotation augmentation."""
638638
639- enabled : bool = True
639+ enabled : Optional [ bool ] = None
640640 prob : float = 0.5
641641 max_angle : float = 90.0
642642 spatial_axes : Tuple [int , int ] = (1 , 2 ) # Axes to rotate: (1, 2) = Y-X plane (preserves Z)
@@ -646,7 +646,7 @@ class RotateConfig:
646646class ElasticConfig :
647647 """Elastic deformation augmentation."""
648648
649- enabled : bool = True
649+ enabled : Optional [ bool ] = None
650650 prob : float = 0.3
651651 sigma_range : Tuple [float , float ] = (5.0 , 8.0 )
652652 magnitude_range : Tuple [float , float ] = (50.0 , 150.0 )
@@ -656,7 +656,7 @@ class ElasticConfig:
656656class IntensityConfig :
657657 """Intensity augmentation."""
658658
659- enabled : bool = True
659+ enabled : Optional [ bool ] = None
660660 gaussian_noise_prob : float = 0.3
661661 gaussian_noise_std : float = 0.05
662662 shift_intensity_prob : float = 0.3
@@ -669,7 +669,7 @@ class IntensityConfig:
669669class MisalignmentConfig :
670670 """Misalignment augmentation for EM data."""
671671
672- enabled : bool = True
672+ enabled : Optional [ bool ] = None
673673 prob : float = 0.5
674674 displacement : int = 16
675675 rotate_ratio : float = 0.0
@@ -679,7 +679,7 @@ class MisalignmentConfig:
679679class MissingSectionConfig :
680680 """Missing section augmentation for EM data."""
681681
682- enabled : bool = True
682+ enabled : Optional [ bool ] = None
683683 prob : float = 0.3
684684 num_sections : int = 2
685685
@@ -688,7 +688,7 @@ class MissingSectionConfig:
688688class MotionBlurConfig :
689689 """Motion blur augmentation for EM data."""
690690
691- enabled : bool = True
691+ enabled : Optional [ bool ] = None
692692 prob : float = 0.3
693693 sections : int = 2
694694 kernel_size : int = 11
@@ -698,7 +698,7 @@ class MotionBlurConfig:
698698class CutNoiseConfig :
699699 """CutNoise augmentation."""
700700
701- enabled : bool = False
701+ enabled : Optional [ bool ] = None
702702 prob : float = 0.5
703703 length_ratio : float = 0.25
704704 noise_scale : float = 0.2
@@ -708,7 +708,7 @@ class CutNoiseConfig:
708708class CutBlurConfig :
709709 """CutBlur augmentation."""
710710
711- enabled : bool = True
711+ enabled : Optional [ bool ] = None
712712 prob : float = 0.3
713713 length_ratio : float = 0.25
714714 down_ratio_range : Tuple [float , float ] = (2.0 , 8.0 )
@@ -719,7 +719,7 @@ class CutBlurConfig:
719719class MissingPartsConfig :
720720 """Missing parts augmentation."""
721721
722- enabled : bool = True
722+ enabled : Optional [ bool ] = None
723723 prob : float = 0.5
724724 hole_range : Tuple [float , float ] = (0.1 , 0.3 )
725725
@@ -728,7 +728,7 @@ class MissingPartsConfig:
728728class MixupConfig :
729729 """Mixup augmentation."""
730730
731- enabled : bool = True
731+ enabled : Optional [ bool ] = None
732732 prob : float = 0.5
733733 alpha_range : Tuple [float , float ] = (0.7 , 0.9 )
734734
@@ -737,23 +737,64 @@ class MixupConfig:
737737class CopyPasteConfig :
738738 """Copy-Paste augmentation."""
739739
740- enabled : bool = True
740+ enabled : Optional [ bool ] = None
741741 prob : float = 0.5
742742 max_obj_ratio : float = 0.7
743743 rotation_angles : List [int ] = field (default_factory = lambda : list (range (30 , 360 , 30 )))
744744 border : int = 3
745745
746746
747+ @dataclass
748+ class StripeConfig :
749+ """Random stripe augmentation for EM artifacts.
750+
751+ Simulates horizontal, vertical, or diagonal stripe artifacts common in
752+ electron microscopy, such as curtaining or scan line artifacts.
753+
754+ Attributes:
755+ enabled: Whether to enable stripe augmentation (None=use preset default)
756+ prob: Probability of applying the augmentation
757+ num_stripes_range: Range for number of stripes as (min, max)
758+ thickness_range: Range for stripe thickness in pixels as (min, max)
759+ intensity_range: Range for stripe intensity values as (min, max)
760+ angle_range: Optional range for stripe angles in degrees as (min, max)
761+ 0° = horizontal, 90° = vertical, 45° = diagonal
762+ Use None for predefined orientations (horizontal/vertical/random)
763+ orientation: Stripe orientation when angle_range is None
764+ - 'horizontal': 0° stripes
765+ - 'vertical': 90° stripes
766+ - 'random': randomly choose between horizontal and vertical
767+ mode: How to apply stripes - 'add' (additive) or 'replace' (replacement)
768+ """
769+
770+ enabled : Optional [bool ] = None
771+ prob : float = 0.3
772+ num_stripes_range : Tuple [int , int ] = (2 , 10 )
773+ thickness_range : Tuple [int , int ] = (1 , 5 )
774+ intensity_range : Tuple [float , float ] = (- 0.2 , 0.2 )
775+ angle_range : Optional [Tuple [float , float ]] = None
776+ orientation : str = "random"
777+ mode : str = "add"
778+
779+
747780@dataclass
748781class AugmentationConfig :
749- """Complete augmentation configuration."""
782+ """Complete augmentation configuration.
783+
784+ All augmentations default to enabled=False for safety. Choose a preset mode:
785+
786+ - "none": Disable all augmentations (no changes to data)
787+ - "some": Enable only augmentations explicitly set to enabled=True in YAML
788+ - "all": Enable all augmentations by default (set to True in config)
789+
790+ For preset="all", users should set enabled=True for augmentations they want.
791+ """
750792
751793 preset : str = "some" # "all", "some", or "none" - controls how enabled flags are interpreted
752- enabled : bool = False
753794
754795 # Standard augmentations
755796 flip : FlipConfig = field (default_factory = FlipConfig )
756- affine : AffineConfig = field (default_factory = AffineConfig ) # Added AffineConfig
797+ affine : AffineConfig = field (default_factory = AffineConfig )
757798 rotate : RotateConfig = field (default_factory = RotateConfig )
758799 elastic : ElasticConfig = field (default_factory = ElasticConfig )
759800 intensity : IntensityConfig = field (default_factory = IntensityConfig )
@@ -765,6 +806,7 @@ class AugmentationConfig:
765806 cut_noise : CutNoiseConfig = field (default_factory = CutNoiseConfig )
766807 cut_blur : CutBlurConfig = field (default_factory = CutBlurConfig )
767808 missing_parts : MissingPartsConfig = field (default_factory = MissingPartsConfig )
809+ stripe : StripeConfig = field (default_factory = StripeConfig )
768810
769811 # Advanced augmentations
770812 mixup : MixupConfig = field (default_factory = MixupConfig )
@@ -785,7 +827,7 @@ class InferenceDataConfig:
785827 default_factory = list
786828 ) # Axis permutation for test data (e.g., [2,1,0] for xyz->zyx)
787829 output_path : str = "results/"
788-
830+
789831 # 2D data support
790832 do_2d : bool = False # Enable 2D data processing for inference
791833
@@ -1036,7 +1078,7 @@ def configure_instance_segmentation(cfg: Config, boundary_thickness: int = 5) ->
10361078 # Augmentation configuration
10371079 "AugmentationConfig" ,
10381080 "FlipConfig" ,
1039- "AffineConfig" , # Added AffineConfig
1081+ "AffineConfig" , # Added AffineConfig
10401082 "RotateConfig" ,
10411083 "ElasticConfig" ,
10421084 "IntensityConfig" ,
@@ -1046,6 +1088,7 @@ def configure_instance_segmentation(cfg: Config, boundary_thickness: int = 5) ->
10461088 "CutNoiseConfig" ,
10471089 "CutBlurConfig" ,
10481090 "MissingPartsConfig" ,
1091+ "StripeConfig" ,
10491092 "MixupConfig" ,
10501093 "CopyPasteConfig" ,
10511094 # Utility functions
0 commit comments