How to segment multiple volumes at once?

Currently I can make use of Clara model in 3D slicer to segment CT scans one by one. But I have tens of scans to segment. Loading and segmenting take a lot of time. Thus I wonder if I can segment tens of volumes at once and save all segmentation files?


You can load data and run automatic segmentation using a couple of lines of Python code. See examples in the script repository. You may find “AI-assisted brain tumor segmentation” particulary relevant.

Thanks for your reply. I’ll try that!

Thank you for your great job. I modified the code in your second link. Now I can segment and visualize the liver organ. However, I didn’t know how to save the segmentation file into ‘nii’ format. The segmentationNode seems to be ‘MRMLCorePython.vtkRMLSegmentationNode’. When I try to save it using ‘slicer.util.saveNode’, it always return ‘False’. Looking forward to your response!

Nifti is developed for neuroimaging and for that it is a good choice, but it has several disadvantages when you try to use it as a general-purpose image file format.

Instead, I would recommend to use nrrd format. It has simple, human-readable header, can be easily customized to store custom fields, it has better support for multidimensional images, etc.

If you absolutely must use nifti (again, I would not recommend) then export the segmentation to binary labelmap and then you can save that in any format you want, including nifti.

Thanks for your quick response. The nrrd format works.

1 Like

Hi, Lasso,
I try to use Clara model to segment my local CT data. But currently, it doesn’t work now. The error is shown as below. Do you have any idea about that?
http.client.RemoteDisconnected: Remote end closed connection without response

There was a few-hour server outage yesterday and NVidia updated their extension in the last few days - any of these might have caused problems.

Which Slicer version are you using? Did the same version worked before? Do you use your own Clara server or the default Slicer server?

I use 3D slicer 4.11.0-2020-02-12 and the default slicer server.

The server has been working well for months but today there seems to be some network connectivity issues with the server. The service should be restored soon or you can set up your own server.

Thank you. It seems the environment has been restored. However, there is still one volume that can’t be segmented. It may due to the large size of the volume. By the way, Do you have idea if I want to use the Clara model when using in publication. I didn’t find any citation online.

You need to crop and resample input volume to approximately match inputs used for training.

I would refer to it as “NVidia Clara AIAA (NVidia, Santa Clara, California, U.S.A.) + the used model’s name” and also cite papers that describe how the models were trained, and of course 3D Slicer.