# Projection data of special size runtime error

**URL:** <https://pytomography.discourse.group/t/projection-data-of-special-size-runtime-error/33>\
**Category:** Usage Questions\
**Created:** [May 22, 2024, 5:12pm UTC](https://pytomography.discourse.group/t/projection-data-of-special-size-runtime-error/33 "2024-05-22T17:12:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![json](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@json](https://pytomography.discourse.group/u/json)\
**Post date:** [May 22, 2024, 5:12pm UTC](https://pytomography.discourse.group/t/projection-data-of-special-size-runtime-error/33/1 "2024-05-22T17:12:49Z")

</div>

For SPECT reconstruction, when the projection matrix size is 160x128x240，if attenuation correction is performed based on CT, an error will occur, if don’t do attenuation correction, it will work correctly. If projection size is 128x128x240, it can run correctly, Has anyone encountered this problem? Where should I modify the code? Thanks!

The error message is following,

```auto
pytomography\transforms\SPECT\attenuation.py", line 114, in backward
    object_i*=norm_factor
RuntimeError: The size of tensor a (128) must match the size of tensor b (160) at non-singleton dimension 3

```

---

<div class="post-metadata">

**Author:** ![pearsonm](https://avatars.discourse-cdn.com/v4/letter/p/eb8c5e/32.png) [@pearsonm](https://pytomography.discourse.group/u/pearsonm)\
**Post date:** [May 23, 2024, 11:56pm UTC](https://pytomography.discourse.group/t/projection-data-of-special-size-runtime-error/33/2 "2024-05-23T23:56:28Z")

</div>

I don’t know the answer but here are a couple of suggestions.

Are the CT and SPECT both using the same dimensions? My experience is with clinical systems and I don’t think they will let you choose a non-square matrix.

There is a flag for SPECTAttenuationTransform initialization called assume\_padded that defaults to True, you could try setting it to False. The comment is

> Assumes objects and projections fed into forward and backward methods are padded, as they will be in reconstruction algorithms

There is also a comment in the code ` TODO: If CT extends beyond boundaries` so the code might fail if the matrices are not the same.

Mark

---

<div class="post-metadata">

**Author:** ![json](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@json](https://pytomography.discourse.group/u/json)\
**Post date:** [May 24, 2024, 8:44am UTC](https://pytomography.discourse.group/t/projection-data-of-special-size-runtime-error/33/3 "2024-05-24T08:44:24Z")

</div>

Thank you very much for your reply！
