TomographicResolution Attribute Error

18 views
Skip to first unread message

jonathan...@gmail.com

unread,
Aug 6, 2025, 5:03:52 AMAug 6
to Pylinac
Hello !
I try to run the Tomographic Resolution test on an image but i get the following error when executed :

Traceback (most recent call last):
 \tomographic.py", line 5, in <module>
    tr.analyze()

  Python311\Lib\site-packages\pylinac\nuclear.py", line 765, in analyze
    dpmm = abs(self.stack.metadata.SpacingBetweenSlices)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 Python311\Lib\site-packages\pydicom\dataset.py", line 908, in __getattr__
    return object.__getattribute__(self, name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

AttributeError: 'FileDataset' object has no attribute 'SpacingBetweenSlices'

Any idea about how can i fix that ?

Thanks

tbe...@gmail.com

unread,
Aug 7, 2025, 5:44:53 AMAug 7
to Pylinac
Hi Jonathan,

your images seem to be missing the DICOM tag for 'SpacingBetweenSlices'
what kind of image are your trying to analyze?  Pylinacs nuclear module seems to expect a SPECT volume image.

regards
Thomas

alanm...@gmail.com

unread,
Sep 12, 2025, 8:33:50 AMSep 12
to Pylinac
Hi Jonathan

NMImageStack only takes multiframe images which not all manufacturers support. There is a workaround, but it is quite cumbersome. To make things worse some manufacturers specify only SliceThickness and others only SpacingBetweenSlices. If you have a multiframe image what you can do is

                if 'SpacingBetweenSlices' not in ds:
                    ds.SpacingBetweenSlices = ds.SliceThickness if hasattr(ds, 'SliceThickness') else 1

where ds is your dataset.
Regards
Alan
Reply all
Reply to author
Forward
0 new messages