pub struct Session { /* private fields */ }Expand description
점진 재구성 상태 값.
Implementations§
Source§impl Session
impl Session
Sourcepub fn new(cfg: SessionConfig) -> Self
pub fn new(cfg: SessionConfig) -> Self
설정으로 빈 세션을 만든다.
Examples found in repository?
examples/hooks.rs (line 43)
21fn main() -> Result<(), String> {
22 let out = std::env::args().nth(1).map(PathBuf::from).unwrap_or_else(|| std::env::temp_dir().join("cumulus3d_hooks"));
23 let src = out.with_extension("src");
24 if !src.join("gps_ref.txt").exists() {
25 common::make_dataset(&src);
26 }
27 if out.exists() {
28 std::fs::remove_dir_all(&out).map_err(|e| e.to_string())?;
29 }
30 let layout = Layout::discover(&src, 1)?;
31 let npos = layout.frames.len();
32
33 let mut cfg = SessionConfig::new(src.join("images"));
34 cfg.gps = read_gps_file(src.join("gps_ref.txt")).map_err(|e| e.to_string())?;
35 (cfg.span, cfg.overlap, cfg.total_positions, cfg.seed) = (4, 1, Some(npos), Some(7));
36 if cumulus3d_cuda::is_available() {
37 let mut d = DenseConfig::new(make_pm_backend("cuda"), parse_profile("fast")?);
38 d.undistort.max_image_size = 160;
39 cfg.dense = Some(d);
40 }
41
42 // 훅: 사건 문구 출력, 구역 점군 점 수, 경고·오류. 그리고 기본 출력 훅(파일).
43 let pipeline = Pipeline::new(Session::new(cfg))
44 .on_any(|e: &Event| {
45 if let Some(t) = e.timeline_text() {
46 println!("[event v{}] {t}", e.meta().version);
47 }
48 })
49 .on(EventKind::ZonePreview, |e: &Event| {
50 if let Event::ZonePreview { range, cloud, model, .. } = e {
51 println!(" 초벌 {}: 조밀 점 {} / 희소 점 {}", range.zone, cloud.len(), model.num_points3d());
52 }
53 })
54 .on(EventKind::ZoneRefined, |e: &Event| {
55 if let Event::ZoneRefined { range, cloud, model, .. } = e {
56 println!(" 정밀 {}: 조밀 점 {} / 희소 점 {}", range.zone, cloud.len(), model.num_points3d());
57 }
58 })
59 .on_message(|k, m| eprintln!(" {k:?}: {m}"));
60 let mut pipeline = sinks::attach(pipeline, &out, &SinkOptions::default()).map_err(|e| e.to_string())?;
61
62 for p in 0..npos {
63 pipeline.push(Input::Frames(FrameSet::new(CAMS.iter().map(|c| (*c, layout.name(c, p))))));
64 }
65 let (_, summary) = pipeline.finish();
66 println!("이벤트 {} 개, 훅 호출 {} 번, 훅 패닉 {}", summary.events, summary.hook_calls, summary.hook_panics);
67
68 for f in ["timeline.txt", "run.log", "snapshots/manifest.json", "snapshots/timeline.txt", "DONE"] {
69 let p = out.join(f);
70 println!("{} {}", if p.exists() { "있음" } else { "없음" }, p.display());
71 }
72 Ok(())
73}Sourcepub fn set_sink(&self, sink: Option<EventSink>)
pub fn set_sink(&self, sink: Option<EventSink>)
즉시 전달 수신기 설정/해제(세션 계열 공유). 설정 시 쌓여 있던 배경 이벤트를 먼저 전달한다.
Sourcepub fn emit_external(&self, make: impl FnOnce(Meta) -> Event)
pub fn emit_external(&self, make: impl FnOnce(Meta) -> Event)
외부(예: 훅 실행기)에서 이 세션의 버전 순서로 이벤트를 낸다. 수신기가 없으면 수신함에 쌓인다.
Sourcepub fn advance(self, input: Input) -> (Session, Vec<Event>)
pub fn advance(self, input: Input) -> (Session, Vec<Event>)
상태 전이(소유 버전, 복사 없음). step/poll/command/finish 는 이것의 얇은 감쌈.
Sourcepub fn apply(&mut self, input: Input) -> Vec<Event>
pub fn apply(&mut self, input: Input) -> Vec<Event>
제자리 상태 전이. 반환 이벤트는 버전 순(그동안 배경 작업이 낸 이벤트도 제자리에 끼워 넣는다).
Sourcepub fn frames(&self) -> &[Vec<FrameImage>]
pub fn frames(&self) -> &[Vec<FrameImage>]
위치별 프레임 묶음.
Sourcepub fn position_of(&self, name: &str) -> Option<usize>
pub fn position_of(&self, name: &str) -> Option<usize>
영상 이름의 위치.
Sourcepub fn model(&self) -> Option<&Reconstruction>
pub fn model(&self) -> Option<&Reconstruction>
현재 체인 모델(첫 모델 전에는 None).
Sourcepub fn store(&self) -> &FeatureStore
pub fn store(&self) -> &FeatureStore
특징 저장소.
Sourcepub fn graph(&self) -> &MatchGraph
pub fn graph(&self) -> &MatchGraph
대응 그래프.
Sourcepub fn config(&self) -> &SessionConfig
pub fn config(&self) -> &SessionConfig
세션 설정.
Sourcepub fn arrived_zones(&self) -> Vec<ZoneRange>
pub fn arrived_zones(&self) -> Vec<ZoneRange>
도착(처리)한 구역들.
Sourcepub fn previews(&self) -> &BTreeMap<usize, PreviewZone>
pub fn previews(&self) -> &BTreeMap<usize, PreviewZone>
구역별 초벌 결과.
Sourcepub fn refined(&self) -> BTreeMap<usize, RefinedZone>
pub fn refined(&self) -> BTreeMap<usize, RefinedZone>
구역별 정밀 결과(자세 확정된 것, 배경 작업과 공유되는 현재 값).
Sourcepub fn pending_jobs(&self) -> usize
pub fn pending_jobs(&self) -> usize
아직 끝나지 않은 배경 정밀 작업 수.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Finish 를 처리했는지.
Trait Implementations§
Source§impl Reducer for Session
crate::pipeline::Pipeline 이 구동하는 리듀서로서의 세션. finish 는 남은 구역을 닫고 배경 정밀 작업을 모두 기다린다.
impl Reducer for Session
crate::pipeline::Pipeline 이 구동하는 리듀서로서의 세션. finish 는 남은 구역을 닫고 배경 정밀 작업을 모두 기다린다.
Auto Trait Implementations§
impl !RefUnwindSafe for Session
impl !UnwindSafe for Session
impl Freeze for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.