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,
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
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.