@@ -749,36 +749,6 @@ def to_ras(self) -> Image:
749749 return ToCanonical ()(self )
750750 return self
751751
752- def to_video (
753- self ,
754- output_path : TypePath ,
755- frame_rate : float | None = 15 ,
756- seconds : float | None = None ,
757- direction : str = 'I' ,
758- verbosity : str = 'error' ,
759- ) -> None :
760- """Create a video showing all image slices along a specified direction.
761-
762- Args:
763- output_path: Path to the output video file.
764- frame_rate: Number of frames per second (FPS).
765- seconds: Target duration of the full video.
766- direction:
767- verbosity:
768-
769- .. note:: Only ``frame_rate`` or ``seconds`` may (and must) be specified.
770- """
771- from ..visualization import make_video # avoid circular import
772-
773- make_video (
774- self .to_ras (),
775- output_path ,
776- frame_rate = frame_rate ,
777- seconds = seconds ,
778- direction = direction ,
779- verbosity = verbosity ,
780- )
781-
782752 def get_center (self , lps : bool = False ) -> TypeTripletFloat :
783753 """Get image center in RAS+ or LPS+ coordinates.
784754
@@ -917,6 +887,36 @@ def hist(self, **kwargs) -> None:
917887 x = self .data .flatten ().numpy ()
918888 plot_histogram (x , ** kwargs )
919889
890+ def to_video (
891+ self ,
892+ output_path : TypePath ,
893+ frame_rate : float | None = 15 ,
894+ seconds : float | None = None ,
895+ direction : str = 'I' ,
896+ verbosity : str = 'error' ,
897+ ) -> None :
898+ """Create a video showing all image slices along a specified direction.
899+
900+ Args:
901+ output_path: Path to the output video file.
902+ frame_rate: Number of frames per second (FPS).
903+ seconds: Target duration of the full video.
904+ direction:
905+ verbosity:
906+
907+ .. note:: Only ``frame_rate`` or ``seconds`` may (and must) be specified.
908+ """
909+ from ..visualization import make_video # avoid circular import
910+
911+ make_video (
912+ self .to_ras (), # type: ignore[arg-type]
913+ output_path ,
914+ frame_rate = frame_rate ,
915+ seconds = seconds ,
916+ direction = direction ,
917+ verbosity = verbosity ,
918+ )
919+
920920
921921class LabelMap (Image ):
922922 """Image whose pixel values represent segmentation labels.
0 commit comments