# Slice Interpolation

**URL:** <https://discourse.slicer.org/t/slice-interpolation/2808>\
**Category:** Support\
**Created:** [May 11, 2018, 4:28pm UTC](https://discourse.slicer.org/t/slice-interpolation/2808 "2018-05-11T16:28:27Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![cphillips](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@cphillips](https://discourse.slicer.org/u/cphillips)\
**Post date:** [May 11, 2018, 4:28pm UTC](https://discourse.slicer.org/t/slice-interpolation/2808/1 "2018-05-11T16:28:27Z")

</div>

Operating system: Windows 7  
Slicer version: 4.8.1  
Expected behavior: 3D Slicer should show the exact number of slices as appear in a DICOM viewer  
Actual behavior: 3D Slicer shows extra (and I cannot find a “match” for some of the correct slices shown in DICOM)

I am working with MRI data. When I load it into 3D Slicer, it often adds extra slices than what are actually present (i.e. one scan has 8 slices, which I verified with the PHILIPS DICOM viewer, but in 3D slicer, the data shows up as having 13 slices). Now, sliding the slider at the top of each frame definitely interpolates between slices, but I am wondering if interpolation also occurs when I am using the arrow keys, which usually just navigates slice by slice. The reason I am wondering this is that I tried to match the slices I was seeing in the DICOM viewer with what I was seeing in 3D slicer, to filter out the extra, non-matching slices in Slicer, but some of the slices from the DICOM viewer are not precisely matched anywhere in what 3D slicer showed me. This error is present whether I load in the data in DICOM or NIFTY (.nii) form.

Any insights are much appreciated! Thank you.

---

<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:** [May 11, 2018, 4:38pm UTC](https://discourse.slicer.org/t/slice-interpolation/2808/2 "2018-05-11T16:38:18Z")

</div>

3D Slicer reconstructs 3D volumes from the input 2D image slices and no reference is kept to 2D slice indexes. However, you may find that one of the voxel indexes that slicer displays in the Data Probe section in the lower-left corner correlate with DICOM slice index (most likely there will be an offset of 1, since DICOM usually start the numbering at 1 instead of 0).

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

---

<div class="post-metadata">

**Author:** ![cphillips](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@cphillips](https://discourse.slicer.org/u/cphillips)\
**Post date:** [May 11, 2018, 5:36pm UTC](https://discourse.slicer.org/t/slice-interpolation/2808/3 "2018-05-11T17:36:30Z")

</div>

Sorry, I don’t think I was clear enough in my previous post. When I import the DICOM data itself into 3D Slicer, the some problem arises as with the NIFTY data. I am comparing the 2D slices as shown in 3D slicer to the 2D slices as shown in a different DICOM viewer software. How does 3D Slicer decide which slices to show? Are they an exact match to the “real” slices, or no?

---

<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:** [May 11, 2018, 5:51pm UTC](https://discourse.slicer.org/t/slice-interpolation/2808/4 "2018-05-11T17:51:03Z")

</div>

Slicer displays patient spact by default. Your images might have been acquired on a tilted plane, in which case you could see the discussion here (look for “Rotate to volume plane”)

> [@Display issue with RT structs and MR volume](https://discourse.slicer.org/t/display-issue-with-rt-structs-and-mr-volume/546/2):
>
> Hello Yannick, It looks like there is a problem with the planar contour to closed surface conversion. If you could send me an email with the data, I will see if I can figure out what the problem is. I will message you with my email. Thanks! Kyle

---

<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:** [May 11, 2018, 6:50pm UTC](https://discourse.slicer.org/t/slice-interpolation/2808/5 "2018-05-11T18:50:10Z")

</div>

> [@cphillips](#):
>
> Are they an exact match to the “real” slices, or no?

You always see the real image. The coordinates (both the anatomical/patient coordinates and voxel coordinates) are also all real and correct. You may turn off interpolation (Volumes module / Display / Interpolate checkbox) if you want to make sure that at a certain position in the image you see the contribution of exactly one pixel of the image slices.

If you could tell what your application (anatomy, procedure, imaging modality, etc) and your concerns are then we could give more specific answer.

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [May 11, 2018, 7:58pm UTC](https://discourse.slicer.org/t/slice-interpolation/2808/6 "2018-05-11T19:58:51Z")

</div>

If I understand correctly, I think the request is for the spacing mode `vtkMRMLSliceNode::PrescribedSliceSpacingMode` (“manual spacing”) to automatically match the volume spacing along the corresponding axis.

---

<div class="post-metadata">

**Author:** ![cphillips](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@cphillips](https://discourse.slicer.org/u/cphillips)\
**Post date:** [May 11, 2018, 8:19pm UTC](https://discourse.slicer.org/t/slice-interpolation/2808/7 "2018-05-11T20:19:13Z")

</div>

Thank you, rotating to the volume axis really helped. The application is research (calculating the volume of stroke lesions). Would having interpolate on or off have a big difference on the accuracy in this case (I doubt it would…)?

---

<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:** [May 11, 2018, 9:41pm UTC](https://discourse.slicer.org/t/slice-interpolation/2808/8 "2018-05-11T21:41:38Z")

</div>

Interpolation has no effect on anything but how smooth the image appears (if you see boundary of individual voxels or the transition is continuous).

Slice step size is already the same as the volume spacing along the corresponding axis, but this step size is not used when you browse slices using the slider above the viewer (only when mouse wheel or arrow keys are used).

---

<div class="post-metadata">

**Author:** ![Yong\_Wang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/yong_wang/32/3952_2.png) [@Yong\_Wang](https://discourse.slicer.org/u/Yong_Wang)\
**Post date:** [June 13, 2019, 6:50pm UTC](https://discourse.slicer.org/t/slice-interpolation/2808/9 "2019-06-13T18:50:35Z")

</div>

HI Lassoan,  
Thank you for the information. We are looking for the algorithm that this interpolation checkbox triggered. Is it linear or B-spline based interpolation? Is there code that we can refer to for this interpolation function?

It looks like the interpolation dramatically increase the spatial resolution and smooth the image with very smooth boundaries.

Thank you very much!  
Yong

---

<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:** [June 13, 2019, 7:38pm UTC](https://discourse.slicer.org/t/slice-interpolation/2808/10 "2019-06-13T19:38:50Z")

</div>

It is linear interpolation, implemented in [vtkImageReslice](https://vtk.org/doc/nightly/html/classvtkImageReslice.html) filter.

Note that this interpolation does not increate resolution, it just displays the continuous signal reconstructed from samples (instead of showing discrete samples).

---

<div class="post-metadata">

**Author:** ![Yong\_Wang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/yong_wang/32/3952_2.png) [@Yong\_Wang](https://discourse.slicer.org/u/Yong_Wang)\
**Post date:** [June 13, 2019, 9:39pm UTC](https://discourse.slicer.org/t/slice-interpolation/2808/11 "2019-06-13T21:39:28Z")

</div>

Thank you very much!

How can we know the values of the reconstructed continuous signals?

Yong

---

<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:** [June 14, 2019, 4:01am UTC](https://discourse.slicer.org/t/slice-interpolation/2808/12 "2019-06-14T04:01:59Z")

</div>

You can [reconstruct a continuous signal from discrete samples](https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem). For typical medical images, linear interpolation results are usually indiscernible from the optimal reconstruction results.

---

<div class="post-metadata">

**Author:** ![zxy630](https://avatars.discourse-cdn.com/v4/letter/z/e480ec/32.png) [@zxy630](https://discourse.slicer.org/u/zxy630)\
**Post date:** [July 28, 2023, 7:16am UTC](https://discourse.slicer.org/t/slice-interpolation/2808/13 "2023-07-28T07:16:13Z")

</div>

If I want to export dicom after interpolation, can you give me some guidance？

---

<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:** [July 29, 2023, 8:25pm UTC](https://discourse.slicer.org/t/slice-interpolation/2808/14 "2023-07-29T20:25:15Z")

</div>

See how to export images to DICOM in [Slicer documentation](https://slicer.readthedocs.io/en/latest/user_guide/modules/dicom.html#export-data-from-the-scene-to-dicom-database).
