How can I use Python script in Chest Imaging Platform?

Hello everyone, I have about 200 CTvolumes to do. My procedure is as follow:


Load CTfiles → Open lung CT segmenter and use lungmask LTRCLobes → Open lung CT analyzer and lobe analysis → Export csv.


And I write a script like this:

import os
import slicer

# Nifti path
nifti_file_path = r'F:\CT\\benyuezhi\ST00001\SE00002\IM00001PulmonaryFunctions007a002_1.nii'

# load Nifti
nifti_node = slicer.util.loadVolume(nifti_file_path)
slicer.app.applicationLogic().GetSelectionNode().SetReferenceActiveVolumeID(nifti_node.GetID())
slicer.app.applicationLogic().PropagateVolumeSelection(0)

# open lungCTSegmenter
slicer.util.selectModule('LungCTSegmenter')

But I don’t know how to use the function of lungCTsementer with Python script.

Hi,

Processing 200 NIFTI volumes in Lung CT Segmenter and Analyzer is possible with the batch processing tool built within the GUIs. Depending on the size of the files as well as your hardware, the combined processing time including lobes and regions using the TotalSegmentator option will be around 26 hours.

Update to the latest versions.

Here is the wiki for batch processing with Lung CT Segmenter
Do this first and write to a separate (segmentation) output directory.

Here is the wiki for batch processing with Lung CT Analyzer
Use the (segmentation output directory as batch processing input directory and define a (final results) output directory.

Writing a Python script is also possible but requires more effort.