Segmentation to text file

Hi all,

I would like to export my segmentations to a text file (i.e. list of contour pixels) to create IMOD model files (with point2model). Two questions:

  1. I expect I would push the segmentation through the LabelContourImageFilter to get the edges, but is there an sitk.Cast to text? Would this use ImageFileWriter or just a txt dump?
  2. Would this text dump encode the origin and dimensions of the segmentation cf. reference image?


Sean Hatton

LabelContourImageFilter does not produce a mesh, but another image. There is no standard way to convert that into text.

Marching cubes, and newer and higher quality Cuberille produce a mesh. Meshes are usually in physical space, so they don’t carry image grid information.