MCPcopy Index your code
hub / github.com/InteractiveComputerGraphics/splashsurf / collect

Method collect

splashsurf/src/reconstruct.rs:767–867  ·  view source on GitHub ↗

Returns an input/output file path struct for each input file (basically one task per input file)

(&self)

Source from the content-addressed store, hash-verified

765
766 /// Returns an input/output file path struct for each input file (basically one task per input file)
767 pub(crate) fn collect(&self) -> Vec<ReconstructionRunnerPaths> {
768 if self.is_sequence {
769 let input_file = &self.input_file;
770 let output_file = &self.output_file;
771
772 let input_dir = input_file
773 .parent()
774 .expect("expected an input path ending in a filename");
775 let output_dir = output_file
776 .parent()
777 .expect("expected an output path ending in a filename");
778
779 let input_pattern = input_file.file_name().unwrap().to_string_lossy();
780 let output_pattern = output_file.file_name().unwrap().to_string_lossy();
781
782 let (input_prefix, input_suffix) = input_pattern
783 .split_once("{}")
784 .expect("sequence input filename has to include pattern");
785
786 let input_re_str =
787 format!(r"{}(\d+){}", escape(input_prefix), escape(input_suffix));
788 let input_re = Regex::new(&input_re_str).expect("expected a valid regex");
789
790 let input_root = if input_dir == Path::new("") {
791 Path::new(".")
792 } else {
793 input_dir
794 };
795 info!(
796 "Looking for input sequence files in root \"{}\"",
797 input_root.display()
798 );
799
800 let mut paths = Vec::new();
801
802 for entry in WalkDir::new(input_root)
803 .max_depth(1)
804 .contents_first(true)
805 .sort_by(|a, b| {
806 let a = a.file_name().to_string_lossy();
807 let b = b.file_name().to_string_lossy();
808 lexical_sort::natural_cmp(&a, &b)
809 })
810 .into_iter()
811 .filter_map(|e| e.ok())
812 .filter(|e| e.file_type().is_file())
813 {
814 let entry_name = entry.file_name().to_string_lossy();
815 if input_re.is_match(&entry_name) {
816 let index = &input_re
817 .captures(&entry_name)
818 .expect("there should be a match")[1];
819 let index_usize =
820 usize::from_str(index).expect("index should be convertible to usize");
821
822 if let Some(start) = self.sequence_range.0 {
823 if index_usize < start {
824 continue;

Callers 15

build_rtreeFunction · 0.80
to_vecMethod · 0.80
newMethod · 0.80
keep_cells_implFunction · 0.80
keep_cellsMethod · 0.80
keep_indicesMethod · 0.80
find_bad_trianglesFunction · 0.80
process_collapse_queueFunction · 0.80
decompositionFunction · 0.80

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected