# DICOM Image Spacing Issue at Z

**URL:** <https://discourse.slicer.org/t/dicom-image-spacing-issue-at-z/44025>\
**Category:** Support\
**Tags:** dicom\
**Created:** [August 8, 2025, 3:11pm UTC](https://discourse.slicer.org/t/dicom-image-spacing-issue-at-z/44025 "2025-08-08T15:11:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![txuh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/txuh/32/80793_2.png) [@txuh](https://discourse.slicer.org/u/txuh)\
**Post date:** [August 8, 2025, 3:11pm UTC](https://discourse.slicer.org/t/dicom-image-spacing-issue-at-z/44025/1 "2025-08-08T15:11:20Z")

</div>

I am writing a single DICOM with multiple frames.

After loading the dcm file via 3D Slicer (volume), the x/y image spacing is correct which I set the value (0.0195) at tag “0028,0030” (Pixel Spacing).

However, the image spacing at Z is always 1mm at 3D Slicer. I had tested tag “0018,0088” (Spacing Between Slices) and “0018,0050” (Slice Thickness) respectively or set both to value (0.05). This does not work. Can anyone advise?

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [August 8, 2025, 3:20pm UTC](https://discourse.slicer.org/t/dicom-image-spacing-issue-at-z/44025/2 "2025-08-08T15:20:46Z")

</div>

I don’t know what is happening, but two things to keep in mind:

1. Slicer should be calculating distance between slices based on `ImagePositionPatient` for the individual frames. Changing `SliceThickness` is not expected to have any effect in your test. `SpacingBetweenSlices` is probably also not taken into account - it is important only in those situations where volume is not sampled regularly (such as with sparse segmentations). If you could could identify two samples that have very different, and not 1, distance between adjacent slices based on `ImagePositionPatients`, and both would load with z spacing of 1, that would confirm the bug. Ideally, using publicly available data.
2. Multiframe DICOM remains uncommon, and it might well be that its support has bugs.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [August 8, 2025, 4:30pm UTC](https://discourse.slicer.org/t/dicom-image-spacing-issue-at-z/44025/3 "2025-08-08T16:30:01Z")

</div>

Building on what @fedorov said, you will want to specify the ImagePositionPatient for the frames in the PerFrameFunctionalGroupsSequence. In case it helps, [here’s some code](https://github.com/dcmjs-org/dcmjs/blob/2ca6bb1e86daf528a10c28585a02fe37bbbf1025/src/normalizers.js#L135) for creating multiframes from single frame dicom.

---

<div class="post-metadata">

**Author:** ![txuh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/txuh/32/80793_2.png) [@txuh](https://discourse.slicer.org/u/txuh)\
**Post date:** [August 8, 2025, 6:35pm UTC](https://discourse.slicer.org/t/dicom-image-spacing-issue-at-z/44025/4 "2025-08-08T18:35:28Z")

</div>

Thanks both replies. I add this to PerFrameFunctionalGroupsSequence. This time I use 0.04167 as spacing and it seems the DICOM tags are right after loading by 3D Slicer (DICOM). But the Z-spacing is still 1mm (volume).

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/8/38e146913604d5dd6b1db4097232d744986b4a9c.png)

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/c/fc5f32ee59721a85b8256e228110de13497b2cae.png)

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [August 8, 2025, 6:57pm UTC](https://discourse.slicer.org/t/dicom-image-spacing-issue-at-z/44025/5 "2025-08-08T18:57:37Z")

</div>

You could try dropping it on [OHIF Viewer](https://viewer.ohif.org/local) to see what it does. You should also compare your file’s structure to a file that is known to work.

Are you writing code that you are planning to share publicly? If you are doing something public it would be easier for us to help you debug.

---

<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:** [August 9, 2025, 9:30pm UTC](https://discourse.slicer.org/t/dicom-image-spacing-issue-at-z/44025/6 "2025-08-09T21:30:22Z")

</div>

Maybe 3D position information is ignored because the imaging modality does not indicate that it is a 3D volume. Is this a secondary capture (screenshot)?

You can try installing `SlicerDcm2nii` extension and use the “Advanced” mode in the DICOM module to load the series using `dcm2niix` reader.

---

<div class="post-metadata">

**Author:** ![txuh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/txuh/32/80793_2.png) [@txuh](https://discourse.slicer.org/u/txuh)\
**Post date:** [August 11, 2025, 2:02pm UTC](https://discourse.slicer.org/t/dicom-image-spacing-issue-at-z/44025/7 "2025-08-11T14:02:14Z")

</div>

Thanks for all your kind replies. I finally decide not include PerFrameFunctionalGroupsSequence in the DICOM, and manually adjust Z spacing in 3D slicer. That’s because my DICOM might be huge and include a large number of frames (e.g. \> 10,000 frames) and this tab could be very long. Thanks for all your kind helps.
