@@ -22,13 +22,16 @@ def InstallDependencies():
22
22
pip_install ('fvcore==0.1.5.post20220504' )
23
23
pip_install ('iopath==0.1.9' )
24
24
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
+
30
32
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")
32
35
33
36
if sys .argv [1 ] == '-1' :
34
37
InstallDependencies ()
@@ -265,21 +268,24 @@ def main(surf,out,rot,res,unet_model,scal,sepOutputs,chooseFDI,log_path):
265
268
266
269
if chooseFDI :
267
270
surf = ConvertFDI (surf ,scal )
268
-
271
+ gum_label = 0
272
+ else :
273
+ gum_label = 33
274
+
269
275
if sepOutputs :
270
276
# Isolate each label
271
277
surf_point_data = surf .GetPointData ().GetScalars (scal )
272
278
labels = np .unique (surf_point_data )
273
279
out_basename = output [:- 4 ]
274
280
for label in tqdm (labels , desc = 'Isolating labels' ):
275
281
thresh_label = post_process .Threshold (surf , scal ,label - 0.5 ,label + 0.5 )
276
- if label != 33 :
282
+ if label != gum_label :
277
283
utils .Write (thresh_label ,f'{ out_basename } _id_{ label } .vtk' ,print_out = False )
278
284
else :
279
285
# gum
280
286
utils .Write (thresh_label ,f'{ out_basename } _gum.vtk' ,print_out = False )
281
287
# 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 )
283
289
utils .Write (no_gum ,f'{ out_basename } _all_teeth.vtk' ,print_out = False )
284
290
285
291
0 commit comments