+
    úäûja$  ã                   ó¾   € ^ RI HtHtHt ^ RIt^ RIHtHtHt ^ RIt^ RI	H
t
 ^ RIHtHtHt ^ RIHtHt ^ RIHt ^ RIHt ^ R	IHt  ! R
 R]
4      t ! R R]4      tR# )é    )ÚAnyÚDictÚOptionalN)Úfloat16Úfloat32Úfloat64)Ú_AugmentationBase)Ú_transform_input3dÚ_transform_input3d_by_shapeÚ_validate_input_dtype)Ú_VOLUME_SHAPESÚ_raise_input_rank_error)Ú_to_device_nonblocking)ÚBoxes3D)ÚKeypoints3Dc                   óf   a € ] tR t^ t o RtV 3R lR ltRRRR/V 3R lR	 lltV 3R
 lR ltRtV t	R# )ÚAugmentationBase3Da{
  Build a custom 3D augmentation, applied per sample with probability ``p`` (default 0.5).

``output = MyAugmentation(...)(input)`` processes volumes of shape ``(B, C, D, H, W)`` once a subclass
implements ``apply_transform`` and supplies any parameter generation it needs. Use
:class:`GeometricAugmentationBase3D` when the operation moves coordinates, or :class:`IntensityAugmentationBase3D`
when it changes voxel values alone.

Args:
    p: probability for applying an augmentation. This param controls the augmentation probabilities
      element-wise for a batch.
    p_batch: probability for applying an augmentation to a batch. This param controls the augmentation
      probabilities batch-wise.
    same_on_batch: apply the same transformation across the batch.

Convention:
    - the working layout is ``(B, C, D, H, W)`` float. Bare 3D augmentations accept inputs of rank three
      and four and promote them by prepending batch and, for rank three, channel dimensions; ``keepdim=True``
      restores that original rank. Inside ``AugmentationSequential``, rank-4 input is rejected because
      ``(C, D, H, W)`` is ambiguous with the container's ``(B, C, H, W)`` image layout. The dtype guard
      accepts only ``float16``, ``bfloat16``, ``float32``, and ``float64``.
      :class:`~kornia.augmentation.RandomTransplantation3D` overrides ``forward`` and takes batched inputs
      only.
    - ``p`` gates samples and ``p_batch`` gates a whole call; ``same_on_batch=True`` shares the generated
      values. Of the concrete 3D constructors only :class:`~kornia.augmentation.RandomTransplantation3D`
      exposes ``p_batch`` in its constructor, though it can be set as an attribute on any 3D augmentation;
      :class:`CenterCrop3D` and
      :class:`RandomCrop3D` instead map their own ``p`` onto the call-wide gate. Parameters use the common
      augmentation RNG and ``forward(x, params=...)`` replays a complete generated dictionary. See
      :doc:`/get-started/conventions` for the canonical sampling, seeding, and serialization contract.
    - rigid subclasses expose the last sampled ``(B, 4, 4)`` ``transform_matrix``. The 3D bases do not
      implement ``inverse``: their subclasses have no ``inverse`` method, and a geometric 3D child makes an
      :class:`~kornia.augmentation.container.AugmentationSequential` inverse raise.
      :class:`~kornia.augmentation.RandomTransplantation3D` is the exception: it also derives from
      :class:`~kornia.augmentation.MixAugmentationBaseV2` and so carries that class's ``inverse``, which
      raises ``RuntimeError``.

See Also:
    - :class:`GeometricAugmentationBase3D`: base class for 3D geometric transforms.

c                ó8   <€ V ^8„  d   QhRS[ P                  RR/# )é   ÚinputÚreturnN©ÚtorchÚTensor)ÚformatÚ__classdict__s   "€ÚXC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\augmentation\_3d\base.pyÚ__annotate__ÚAugmentationBase3D.__annotate__J   s#   ø€ ÷ Añ A¡U§\¡\ð A°dñ Aó    c                óÈ   € \        V\        P                  \        \        \
        .R7       \        VP                  4      R9  d   \        VP                  \        4       R# R# )z[Check that the input has a float dtype and one of the ranks ``forward`` accepts: 3, 4 or 5.©Úaccepted_dtypesN)é   é   é   )
r   r   Úbfloat16r   r   r   ÚlenÚshaper   r   ©Úselfr   s   &&r   Úvalidate_tensorÚ"AugmentationBase3D.validate_tensorJ   s>   € ä˜e´e·n±nÄgÌwÔX_Ð5`ÕaÜˆu�{‰{Ó 9Ô,Ü# E§K¡K´Ö@ñ -r    r)   NÚmatch_channelTc                ó~   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  ,          RS[RS[ P                  /# )r   r   r)   r.   r   )r   r   r   Úbool)r   r   s   "€r   r   r   P   sD   ø€ ÷ fñ fÙ—\‘\ðfÙ-5±e·l±lÕ-CðfÙ[_ðfá	�‰ñfr    c               ó�   € \        V\        P                  \        \        \
        .R7       Vf   \        V4      # \        WVR7      # )zVConvert any incoming (D, H, W), (C, D, H, W) and (B, C, D, H, W) into (B, C, D, H, W).r"   )Úreference_shaper.   )r   r   r'   r   r   r   r
   r   )r+   r   r)   r.   s   &&$$r   Útransform_tensorÚ#AugmentationBase3D.transform_tensorP   s:   € ô 	˜e´e·n±nÄgÌwÔX_Ð5`ÕaØŠ=Ü% eÓ,Ð,ä*¨5ÐWdÔeÐer    c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# )r   r   r   r   )r   r   s   "€r   r   r   Z   s#   ø€ ÷ 2ñ 2¡U§\¡\ð 2±e·l±lñ 2r    c                óV   € \         P                  P                  P                  ^V4      # )zReturn 4x4 identity matrix.)ÚkorniaÚcoreÚopsÚeye_liker*   s   &&r   Úidentity_matrixÚ"AugmentationBase3D.identity_matrixZ   s   € ä�{‰{�‰×'Ñ'¨¨5Ó1Ð1r    © )
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r,   r3   r;   Ú__static_attributes__Ú__classdictcell__©r   s   @r   r   r       s?   ø‡ € ñ'÷RAð AðfØFJðfØbf÷fò f÷2ö 2r    r   c                   óô   a € ] tR t^_t o Rt]V 3R lR l4       tV 3R lR ltV 3R lR ltRV 3R	 lR
 llt	RV 3R lR llt
RV 3R lR lltRV 3R lR lltRV 3R lR lltRV 3R lR lltV 3R ltRtV tR# )ÚRigidAffineAugmentationBase3Da:  Record a matrix for a custom 3D transform, applied per sample with probability ``p`` (default 0.5).

``output = MyAugmentation(...)(input)`` records a ``(B, 4, 4)`` matrix once a subclass implements
``compute_transformation`` and ``apply_transform``. This base manages matrix sampling and storage;
use :class:`GeometricAugmentationBase3D` for coordinate transforms or :class:`IntensityAugmentationBase3D`
for value-only operations.

See the Convention block on :class:`~kornia.augmentation.AugmentationBase3D`.

Args:
    p: probability for applying an augmentation. This param controls the augmentation probabilities
      element-wise for a batch.
    p_batch: probability for applying an augmentation to a batch. This param controls the augmentation
      probabilities batch-wise.
    same_on_batch: apply the same transformation across the batch.
    keepdim: whether to keep the output shape the same as input ``True`` or broadcast it to the batch
      form ``False``.

See Also:
    - :class:`GeometricAugmentationBase3D`: applies and records 3D geometric transformations.

c                óD   <€ V ^8„  d   QhRS[ S[P                  ,          /# )r   r   ©r   r   r   )r   r   s   "€r   r   Ú*RigidAffineAugmentationBase3D.__annotate__z   s   ø€ ÷ &ñ &¡(©5¯<©<Õ"8ñ &r    c                ó   € V P                   # ©N©Ú_transform_matrix)r+   s   &r   Útransform_matrixÚ.RigidAffineAugmentationBase3D.transform_matrixy   s   € à×%Ñ%Ð%r    c                óš   <€ V ^8„  d   QhRS[ P                  RS[S[S[ P                  3,          RS[S[S[3,          RS[ P                  /# ©r   r   ÚparamsÚflagsr   ©r   r   r   Ústrr   )r   r   s   "€r   r   rJ   }   sN   ø€ ÷ "ñ "Ù—\‘\ð"Ù+/±±U·\±\Ð0AÕ+Bð"ÙKOÑPSÑUXÐPXÍ>ð"á	�‰ñ"r    c                ó   € \         hrL   ©ÚNotImplementedError)r+   r   rS   rT   s   &&&&r   Úcompute_transformationÚ4RigidAffineAugmentationBase3D.compute_transformation}   s
   € ô "Ð!r    c                óš   <€ V ^8„  d   QhRS[ P                  RS[S[S[ P                  3,          RS[S[S[3,          RS[ P                  /# rR   rU   )r   r   s   "€r   r   rJ   ‚   sN   ø€ ÷ ñ Ù—\‘\ðÙ+/±±U·\±\Ð0AÕ+BðÙKOÑPSÑUXÐPXÍ>ðá	�‰ñr    c                ó  € V P                  V4      pV P                  V4      pV P                  WRVR7      pV P                  V4      pVP                  ^ ,          VP                  ^ ,          u;8X  d   VP                  ^ ,          8X  db   M M^\        VP                  ! R.^.VP                  4       ^,
          ,          O5!  VP                  4      p\        P                  ! W†V4      p	V	# \        VP                  4       4      '       d   TMTp	V	# )zIGenerate transformation matrices with the given input and param settings.)rS   rT   éÿÿÿÿ)Ú_gater3   rZ   r;   r)   r   ÚviewÚdimÚdevicer   Úwherer0   Úany)
r+   r   rS   rT   Úto_applyÚ	in_tensorÚtrans_matrix_appliedÚtrans_matrix_identityÚto_apply_expandedÚtrans_matrixs
   &&&&      r   Úgenerate_transformation_matrixÚ<RigidAffineAugmentationBase3D.generate_transformation_matrix‚   sð   € ð —:‘:˜fÓ%ˆà×)Ñ)¨%Ó0ˆ	à#×:Ñ:¸9Ð[`Ð:ÓaÐØ $× 4Ñ 4°YÓ ?Ðà×%Ñ% aÕ(¨H¯N©N¸1Õ,=Ö_ÐAV×A\ÑA\Ð]^ÕA_×_Ü 6Ø—’˜bÐL Q CÐ+?×+CÑ+CÓ+EÈÕ+IÕ$JÓLÐNb×NiÑNió!Ðô !Ÿ;š;Ð'8ÐPeÓfˆLð Ðô 48¸¿¹»×3GÒ3GÑ/ÐMbˆLàÐr    Nc          
      óÄ   <€ V ^8„  d   QhRS[ P                  RS[S[S[ P                  3,          RS[S[S[3,          RS[S[ P                  ,          RS[ P                  /# ©r   r   rS   rT   Ú	transformr   ©r   r   r   rV   r   r   )r   r   s   "€r   r   rJ   —   ód   ø€ ÷ "ñ "á�|‰|ð"ñ ‘S™%Ÿ,™,Ð&Õ'ð"ñ ‘C™�H�~ð	"ñ
 ™EŸL™LÕ)ð"ñ 
�‰ñ"r    c                ó   € \         hrL   rX   ©r+   r   rS   rT   ro   s   &&&&&r   Úinverse_inputsÚ,RigidAffineAugmentationBase3D.inverse_inputs—   ó
   € ô "Ð!r    c          
      óÄ   <€ V ^8„  d   QhRS[ P                  RS[S[S[ P                  3,          RS[S[S[3,          RS[S[ P                  ,          RS[ P                  /# rn   rp   )r   r   s   "€r   r   rJ       rq   r    c                ó   € \         hrL   rX   rs   s   &&&&&r   Úinverse_masksÚ+RigidAffineAugmentationBase3D.inverse_masks    rv   r    c          
      óœ   <€ V ^8„  d   QhRS[ RS[S[S[P                  3,          RS[S[S[3,          RS[S[P                  ,          RS[ /# rn   )r   r   rV   r   r   r   r   )r   r   s   "€r   r   rJ   ©   s\   ø€ ÷ "ñ "áð"ñ ‘S™%Ÿ,™,Ð&Õ'ð"ñ ‘C™�H�~ð	"ñ
 ™EŸL™LÕ)ð"ñ 
ñ"r    c                ó   € \         hrL   rX   rs   s   &&&&&r   Úinverse_boxesÚ+RigidAffineAugmentationBase3D.inverse_boxes©   rv   r    c          
      óœ   <€ V ^8„  d   QhRS[ RS[S[S[P                  3,          RS[S[S[3,          RS[S[P                  ,          RS[ /# rn   )r   r   rV   r   r   r   r   )r   r   s   "€r   r   rJ   ²   s\   ø€ ÷ "ñ "áð"ñ ‘S™%Ÿ,™,Ð&Õ'ð"ñ ‘C™�H�~ð	"ñ
 ™EŸL™LÕ)ð"ñ 
ñ"r    c                ó   € \         hrL   rX   rs   s   &&&&&r   Úinverse_keypointsÚ/RigidAffineAugmentationBase3D.inverse_keypoints²   rv   r    c          
      óÄ   <€ V ^8„  d   QhRS[ P                  RS[S[S[ P                  3,          RS[S[S[3,          RS[S[ P                  ,          RS[ P                  /# rn   rp   )r   r   s   "€r   r   rJ   »   rq   r    c                ó   € \         hrL   rX   rs   s   &&&&&r   Úinverse_classesÚ-RigidAffineAugmentationBase3D.inverse_classes»   rv   r    c          	      óª   <€ V ^8„  d   QhRS[ P                  RS[S[S[ P                  3,          RS[S[S[S[3,          ,          RS[ P                  /# )r   rf   rS   rT   r   )r   r   r   rV   r   r   )r   r   s   "€r   r   rJ   Ä   sU   ø€ ÷ 
ñ 
ÙŸ™ð
Ù/3±C¹¿¹Ð4EÕ/Fð
ÙOWÑX\Ñ]`ÑbeÐ]eÕXfÕOgð
á	�‰ñ
r    c                óz   € Vf   V P                   pV P                  WV4      pV P                  WW44      pW@n        V# rL   )rT   rk   Útransform_inputsrN   )r+   rf   rS   rT   rj   Úoutputs   &&&&  r   Ú
apply_funcÚ(RigidAffineAugmentationBase3D.apply_funcÄ   sA   € ð Š=Ø—J‘JˆEà×:Ñ:¸9ÈeÓTˆØ×&Ñ& y¸%ÓNˆØ!-Ôàˆr    c                óJ   <€ V ^8„  d   Qh/ S[ S[P                  ,          ;R&   # )r   rN   rI   )r   r   s   "€r   r   rJ   _   s   ø‡ ‚ ñ0  ¡§¡Õ-Ñ-ò1 r    rM   rL   )r>   r?   r@   rA   rB   ÚpropertyrO   rZ   rk   rt   ry   r}   r�   r…   r‹   Ú__annotate_func__rC   rD   rE   s   @r   rG   rG   _   sv   ø‡ € ñð2 ÷&ó ð&÷"ð "÷
ð ÷*"ò "÷"ò "÷"ò "÷"ò "÷"ò "÷
ò 
÷K ƒ r    rG   )Útypingr   r   r   r   r   r   r   r7   Úkornia.augmentation.baser	   Úkornia.augmentation.utilsr
   r   r   Ú!kornia.augmentation.utils.helpersr   r   Úkornia.core.utilsr   Úkornia.geometry.boxesr   Úkornia.geometry.keypointsr   r   rG   r=   r    r   Ú<module>r—      sK   ð÷$ 'Ñ &ã ß +Ñ +ã Ý 6ß lÑ lß UÝ 4Ý )Ý 1ô<2Ð*ô <2ô~oÐ$6ö or    