# slice spacing in fluoroscopic angiography

**URL:** <https://discourse.slicer.org/t/slice-spacing-in-fluoroscopic-angiography/28184>\
**Category:** Support\
**Created:** [March 6, 2023, 3:39am UTC](https://discourse.slicer.org/t/slice-spacing-in-fluoroscopic-angiography/28184 "2023-03-06T03:39:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pwaver](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pwaver/32/18641_2.png) [@pwaver](https://discourse.slicer.org/u/pwaver)\
**Post date:** [March 6, 2023, 3:39am UTC](https://discourse.slicer.org/t/slice-spacing-in-fluoroscopic-angiography/28184/1 "2023-03-06T03:39:36Z")

</div>

Operating system: Ubuntu 22.04.2 LTS  
Slicer version:5.2.2  
Expected behavior: There is an image spacing warning on DICOM load of a fluoroscopic angiogram. Expect an edit of image spacing in the Volumes module to be sustained at least for the session.  
Actual behavior: After one or two clicks on the image panes the image spacing reverts to the wrong initial one. How to make an image spacing correction be retained?

---

<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:** [March 6, 2023, 3:56am UTC](https://discourse.slicer.org/t/slice-spacing-in-fluoroscopic-angiography/28184/2 "2023-03-06T03:56:02Z")

</div>

Slicer loads fluoroscopy images are time sequences: each timepoint is a separate image. You can apply a transform to change the physical scale of the entire sequence at once.

You could change the spacing of all images in the series by a few Python commands. However, what we see is that if someone uses Slicer (and not a basic 2D viewer) then fluoro images end up fused with 3D images, and then changing the pixel spacing is insufficient, but you need to compute a full projection transform.

What do you do with fluoro images in Slicer? Do you do just basic 2D visualization and measurements or you fuse them with 3D?

---

<div class="post-metadata">

**Author:** ![pwaver](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pwaver/32/18641_2.png) [@pwaver](https://discourse.slicer.org/u/pwaver)\
**Post date:** [March 6, 2023, 2:28pm UTC](https://discourse.slicer.org/t/slice-spacing-in-fluoroscopic-angiography/28184/3 "2023-03-06T14:28:58Z")

</div>

Thank you — this gives me good reason to learn the Slicer-python interface. Any pointers on the precise python lines to apply the code? I wish to perform image by image segmentation and measurement then aggregate the frame-wise result into 2DxT ~ 3D-ish.

---

<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:** [March 6, 2023, 10:46pm UTC](https://discourse.slicer.org/t/slice-spacing-in-fluoroscopic-angiography/28184/4 "2023-03-06T22:46:52Z")

</div>

> [@pwaver](#):
>
> Any pointers on the precise python lines to apply the code?

Something like this should work:

```python
volumeSequenceNode = slicer.mrmlScene.GetFirstNodeByClass("vtkMRMLSequenceNode")

# Modify spacing in all nodes in the sequence
for volumeIndex in range(volumeSequenceNode.GetNumberOfDataNodes()):
    volumeNode = volumeSequenceNode.GetNthDataNode(volumeIndex)
    volumeNode.SetSpacing(2.0, 2.5, 1.4)

# Force update of volume node from sequence
sequenceLogic = slicer.modules.sequences.logic()
volumeSequenceBrowserNode = sequenceLogic.GetFirstBrowserNodeForSequenceNode(volumeSequenceNode)
sequenceLogic.UpdateProxyNodesFromSequences(volumeSequenceBrowserNode)

```

You can find more examples in the [script repository](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#sequences).

To get started with Python scripting in Slicer, I would recommend the [PerkLab Bootcamp Slicer programming tutorial](https://github.com/PerkLab/PerkLabBootcamp/blob/master/Doc/day3_2_SlicerProgramming.pptx).

---

<div class="post-metadata">

**Author:** ![LeonaTow](https://avatars.discourse-cdn.com/v4/letter/l/bbce88/32.png) [@LeonaTow](https://discourse.slicer.org/u/LeonaTow)\
**Post date:** [March 27, 2023, 1:18am UTC](https://discourse.slicer.org/t/slice-spacing-in-fluoroscopic-angiography/28184/5 "2023-03-27T01:18:24Z")

</div>

Thanks for the link, you made my day.

---

<div class="post-metadata">

**Author:** ![pwaver](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pwaver/32/18641_2.png) [@pwaver](https://discourse.slicer.org/u/pwaver)\
**Post date:** [March 27, 2023, 1:28am UTC](https://discourse.slicer.org/t/slice-spacing-in-fluoroscopic-angiography/28184/6 "2023-03-27T01:28:02Z")

</div>

Agree, great answer by lassoan, thank you.

---

<div class="post-metadata">

**Author:** ![LeonaTow](https://avatars.discourse-cdn.com/v4/letter/l/bbce88/32.png) [@LeonaTow](https://discourse.slicer.org/u/LeonaTow)\
**Post date:** [March 27, 2023, 12:51pm UTC](https://discourse.slicer.org/t/slice-spacing-in-fluoroscopic-angiography/28184/7 "2023-03-27T12:51:30Z")

</div>

> [@lassoan](#):
>
> Something like this should work:
> 
> > ****
> >
> > Yeah, I am glad I found this post. If you want to create an essay but don’t know how, you might visit this website: [https://writinguniverse.com/essay-checklist/](https://writinguniverse.com/essay-checklist/) this instructs you on how to create an essay and how many different sorts of essays exist.
> 
> ```auto
> volumeSequenceNode = slicer.mrmlScene.GetFirstNodeByClass("vtkMRMLSequenceNode")
> 
> # Modify spacing in all nodes in the sequence
> for volumeIndex in range(volumeSequenceNode.GetNumberOfDataNodes()):
> volumeNode = volumeSequenceNode.GetNthDataNode(volumeIndex)
> volumeNode.SetSpacing(2.0, 2.5, 1.4)
> 
> # Force update of volume node from sequence
> sequenceLogic = slicer.modules.sequences.logic()
> volumeSequenceBrowserNode = sequenceLogic.GetFirstBrowserNodeForSequenceNode(volumeSequenceNode)
> sequenceLogic.UpdateProxyNodesFromSequences(volumeSequenceBrowserNode)
> 
> ```
> 
> You can find more examples in the [script repository](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#sequences).
> 
> To get started with Python scripting in Slicer, I would recommend the [PerkLab Bootcamp Slicer programming tutorial](https://github.com/PerkLab/PerkLabBootcamp/blob/master/Doc/day3_2_SlicerProgramming.pptx).

Yeah, I am glad I found this post.
