# Surface points to voxel coordinate conversion (my segmented surface is outside volume)

**URL:** <https://discourse.slicer.org/t/surface-points-to-voxel-coordinate-conversion-my-segmented-surface-is-outside-volume/4270>\
**Category:** Support\
**Created:** [October 3, 2018, 1:42pm UTC](https://discourse.slicer.org/t/surface-points-to-voxel-coordinate-conversion-my-segmented-surface-is-outside-volume/4270 "2018-10-03T13:42:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tron](https://avatars.discourse-cdn.com/v4/letter/t/3da27b/32.png) [@tron](https://discourse.slicer.org/u/tron)\
**Post date:** [October 3, 2018, 1:42pm UTC](https://discourse.slicer.org/t/surface-points-to-voxel-coordinate-conversion-my-segmented-surface-is-outside-volume/4270/1 "2018-10-03T13:42:31Z")

</div>

Operating system: Microsoft Windows 7 Professional  
Slicer version: 4.8.1  
Expected behavior:  
I load a CT head volume and manually segment the mandibular canal using the following sequence:  
Segment Editor, Paint/Draw, Add Segment (give it a name, e.g. test), Models Export, Save data (.vtk format).  
Now I would expect that the saved surface data (test.vtk) would contain physical coordinates in mm that are located inside the CT volume space (after converting voxel coordinates to physical coordinates by multiplying by the voxel size).

Actual behavior:  
Instead, the saved surface coordinates are representing points far outside of the volume, and even with negative values in the z-direction. (Transformimg by multiplying with -1 one or more of the diagonal of the transformation matrix does not solve the problem.)

Anyone know how to solve this problem?

Tron

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 3, 2018, 2:39pm UTC](https://discourse.slicer.org/t/surface-points-to-voxel-coordinate-conversion-my-segmented-surface-is-outside-volume/4270/2 "2018-10-03T14:39:43Z")

</div>

DICOM uses LPS coordinate system, so if you load the exported image into third-party software then you may need to choose this coordinate system for export. Use [Export to files](https://discourse.slicer.org/t/how-to-export-stl-files/3041) feature.

> [@tron](#):
>
> Now I would expect that the saved surface data (test.vtk) would contain physical coordinates in mm that are located inside the CT volume space (after converting voxel coordinates to physical coordinates by multiplying by the voxel size).

Image is specified in physical space, so the exported model is defined in physical space, too. There is no need for any further conversion. Note that “converting voxel coordinates to physical coordinates by multiplying by the voxel size” would produce incorrect results: you need to take into account not just image spacing (voxel size) but also image origin and axis directions.

> [@tron](#):
>
> even with negative values in the z-direction

This is completely normal. Origin of LPS coordinate system in DICOM files is often chosen to be near the center of object of interest, so S coordinate value is negative in half of the image.
