@@ -64,21 +64,21 @@ def main(options: Namespace, inputdir: Path, outputdir: Path):
64
64
65
65
nproc = len (os .sched_getaffinity (0 ))
66
66
logger .info ('Using {} threads.' , nproc )
67
- mapper = PathMapper .file_mapper (inputdir , outputdir , glob = '**/*.obj ' , suffix = '.obj ' )
67
+ mapper = PathMapper .file_mapper (inputdir , outputdir , glob = '**/*.mnc ' , suffix = '.mnc ' )
68
68
with ThreadPoolExecutor (max_workers = nproc ) as pool :
69
69
results = pool .map (lambda t , p : run_surface_fit (* t , p ), mapper , itertools .repeat (params ))
70
70
71
71
if not options .no_fail and not all (results ):
72
72
sys .exit (1 )
73
73
74
74
75
- def run_surface_fit (surface : Path , output : Path , params : list [str ]) -> bool :
75
+ def run_surface_fit (mask : Path , output : Path , params : list [str ]) -> bool :
76
76
"""
77
77
:return: True if successful
78
78
"""
79
- mask = locate_mask_for ( surface )
80
- if mask is None :
81
- logger .error ('No mask found for {}' , surface )
79
+ surface = locate_surface_for ( mask )
80
+ if surface is None :
81
+ logger .error ('No starting surface found for {}' , mask )
82
82
return False
83
83
84
84
cmd = ['surface_fit_script.pl' , * params , mask , surface , output ]
@@ -97,13 +97,8 @@ def run_surface_fit(surface: Path, output: Path, params: list[str]) -> bool:
97
97
return False
98
98
99
99
100
- def locate_mask_for (surface : Path ) -> Optional [Path ]:
101
- name = surface .with_suffix ('.mnc' ).name .replace ('._81920' , '' )
102
- mask = surface .with_name (name )
103
- if mask .exists ():
104
- return mask
105
-
106
- glob = surface .parent .glob ('*.mnc' )
100
+ def locate_surface_for (mask : Path ) -> Optional [Path ]:
101
+ glob = mask .parent .glob ('*.obj' )
107
102
first = next (glob , None )
108
103
second = next (glob , None )
109
104
if second is not None :
0 commit comments