From SlicerTotalSegmentator, I extract a function (see ) for segment the vertebrae.
_subset = ['vertebrae_S1', 'vertebrae_L5', 'vertebrae_L4',
'vertebrae_L3', 'vertebrae_L2', 'vertebrae_L1',
'vertebrae_T12', 'vertebrae_T11', 'vertebrae_T10',
'vertebrae_T9', 'vertebrae_T8', 'vertebrae_T7',
'spinal_cord']
def ttSegVert(inputFile, mNam, taSb=_subset):
# if isinstance(taSb, list):
outFile = rf'output/{mNam}.nii.gz'
# else:
# outFile = rf'{TMP}/{mNam}'
import shutil
ttSegCode = [shutil.which('PythonSlicer'),]
import sysconfig
ttSegCode += [os.path.join(sysconfig.get_path('scripts'),
"TotalSegmentator")]
ttSegCode += ['-i', f'{inputFile}',
'-o', f'{outFile}',
'--fast',
'--device', 'cpu',]
if isinstance(taSb, list):
ttSegCode += ['--ml', '--roi_subset', *taSb]
else: # [TODO]: 无法完成`taSb='vertebrae_body'`
ttSegCode += ["--task", taSb]
print(ttSegCode)
pros = ut.launchConsoleProcess(ttSegCode).wait()
print(pros)
return
Well, run ttSegVert(input, 'ttSegVert', _subset)
, got a good result.
However, runttSegVert(inputFile, 'ttSegVert
, ‘vertebrae_body’)`, got None…
@lassoan @jamesobutler @vertebra
Howto totalsegment
vertebrae_body? Or what’s wrong?