@@ -22,13 +22,16 @@ def InstallDependencies():
2222 pip_install ('fvcore==0.1.5.post20220504' )
2323 pip_install ('iopath==0.1.9' )
2424 if system == "Linux" :
25- # pip_install('--force-reinstall --no-deps --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py39_cu113_pyt1120/download.html') # pytorch3d
26-
27- code_path = '/' .join (os .path .dirname (os .path .abspath (__file__ )).split ('/' ))
28- print (code_path )
29- pip_install (f'{ code_path } /_CrownSegmentationcli/pytorch3d-0.7.0-cp39-cp39-linux_x86_64.whl' ) # py39_cu113_pyt1120
25+ try :
26+ code_path = '/' .join (os .path .dirname (os .path .abspath (__file__ )).split ('/' ))
27+ print (code_path )
28+ pip_install (f'{ code_path } /_CrownSegmentationcli/pytorch3d-0.7.0-cp39-cp39-linux_x86_64.whl' ) # py39_cu113_pyt1120
29+ except :
30+ pip_install ('--force-reinstall --no-deps --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py39_cu113_pyt1120/download.html' )
31+
3032 else :
31- pip_install ("--force-reinstall git+https://github.com/facebookresearch/pytorch3d.git" )
33+ raise Exception ('Module only works with Linux systems.' )
34+ # pip_install("--force-reinstall git+https://github.com/facebookresearch/pytorch3d.git")
3235
3336if sys .argv [1 ] == '-1' :
3437 InstallDependencies ()
@@ -265,21 +268,24 @@ def main(surf,out,rot,res,unet_model,scal,sepOutputs,chooseFDI,log_path):
265268
266269 if chooseFDI :
267270 surf = ConvertFDI (surf ,scal )
268-
271+ gum_label = 0
272+ else :
273+ gum_label = 33
274+
269275 if sepOutputs :
270276 # Isolate each label
271277 surf_point_data = surf .GetPointData ().GetScalars (scal )
272278 labels = np .unique (surf_point_data )
273279 out_basename = output [:- 4 ]
274280 for label in tqdm (labels , desc = 'Isolating labels' ):
275281 thresh_label = post_process .Threshold (surf , scal ,label - 0.5 ,label + 0.5 )
276- if label != 33 :
282+ if label != gum_label :
277283 utils .Write (thresh_label ,f'{ out_basename } _id_{ label } .vtk' ,print_out = False )
278284 else :
279285 # gum
280286 utils .Write (thresh_label ,f'{ out_basename } _gum.vtk' ,print_out = False )
281287 # all teeth
282- no_gum = post_process .Threshold (surf , scal ,33 - 0.5 ,33 + 0.5 ,invert = True )
288+ no_gum = post_process .Threshold (surf , scal ,gum_label - 0.5 ,gum_label + 0.5 ,invert = True )
283289 utils .Write (no_gum ,f'{ out_basename } _all_teeth.vtk' ,print_out = False )
284290
285291
0 commit comments