3D slicer's segmented output for convolutional neural network training

Hi all,
I’m working on the field of brain segmentation using convolutional neural network CNN. I have already segmented the brain regions on Slicer, so now I want to export the input images(DICOM) and its corresponding outputs as 3D for CNN training.
How I can perform that ?

Any idea will be appreciated

Thanks

I would recommend saving both the CT and segmentation into nrrd or nifti format that you can easily read into numpy array and use in your network.

Thanks Mr Lassoan,
Is there any tool or module can export/save the files into nifti format in Slicer. By the way, I’m using Matlab.

Secondly, Should I perform registration for the MRI and its corresponding segmentation ?

Kind regards

No need for a module, you can run slicer.util.saveNode to save an image in nifti format.

I’m not sure this is the best idea: you cannot implement complete applications in Matlab, it is only affordable for academic use, and in general you just make your life harder by not using the same toolsets that most machine learning experts . For example, if you use tensorflow, pytorch, etc. then you can run training or inference directly within Slicer’s Python environment. You can interface Slicer with Matlab, too, but there are several additional layers and inconveniences.

If you segment an image then the resulting segmentation will be spatially aligned with it in physical space (and in most cases, you choose the segmentation to have the exact same geometry as the input image). Therefore, there should be no need for any additional registration step.

Thanks you so much for your perfect explanation.

[No need for a module, you can run slicer.util.saveNode to save an image in nifti format.]

Sorry Mr Lassoan for keep asking, Can I save only the visible segments into nifti file?.
If yes, Is it like what I’ve attached.

Thanks againPicture1

You can use “Export to files…” feature in Segment Editor module (“Segmentations…” button’s dropdown menu). Use latest Slicer Stable Release.

1 Like