Export segmentation as bitmap images

Hello,

I’m in need of some assistance with exporting one segmentation to a sequence of bitmap (png) images so I can do some calculation on the success of automatic segmentation. Are there any plugins that go through the entire volume and only the segmentation data would be saved to an image, doesn’t really matter which axis, if it’s always the same?

A segmentation such as:
image

would be converted into an image:
Capture

Thanks,
Janko

Saving into consumer file format, such as png is usually a bad idea, as you lose essential information. These file formats don’t support storage of standard metadata fields, such as pixel and slice spacing, cannot store 16-bit images, etc.

What software do you plan to use to compute metrics on? All software environments that I know of can read nrrd and MetaIO images (and usually it is trivial to write a parser, in case it does not exist).

You may also consider using Segment Comparison module (in SlicerRT extension), which can compute Hausdorff distance and Dice coefficient.

Hey,

I was not aware nrrd is a common format, it seems Matlab has plugins for importing it. I’ll take a look at them.
I have to do a F-measure accuracy test for comparison of automatic segmentation to ground truth.

Thanks

You can find a good NRRD reader/writer in source code of Slicer’s MatlabBridge extension: nrrdread.m and nrrdwrite.m (it is a greatly improved version of some readers/writers found on Matlab exchange).

You may also consider running your F-measure accuracy test from Slicer, using MatlabBridge extension.

Hi,

I had a question, I am facing the issue which you just mentioned here:

I want to save the slices on which I have done segmentation, for further image processing operations. But the png image is saved as 8 bit(uint8) image while my original dicom images were uint16 type. Is there a way I can save export it from 3D slicer in orginal quality ?

Any guidance would be lot helpful.

Regards,
Pranay

You can get a volume node as a numpy array then write it to png slice by slice (see example here), but this should not be necessary, because your deep learning network can use numpy arrays as inputs.