# Qusetions for SPECT reconstruction

**URL:** <https://castor-project.discourse.group/t/qusetions-for-spect-reconstruction/474>\
**Category:** General Discussions\
**Tags:** spect\
**Created:** [February 21, 2023, 2:21am UTC](https://castor-project.discourse.group/t/qusetions-for-spect-reconstruction/474 "2023-02-21T02:21:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![skykkm](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@skykkm](https://castor-project.discourse.group/u/skykkm)\
**Post date:** [February 21, 2023, 2:21am UTC](https://castor-project.discourse.group/t/qusetions-for-spect-reconstruction/474/1 "2023-02-21T02:21:33Z")

</div>

Dear Castor users,  
I am trying to use Castor for the SPECT/CT reconstruction.  
I performed GATE simulation to generate a root file with my own voxelized phantom and activity.  
I have two questions about using Castor with the root file generated from GATE.

Q1. Before I start Castor, I need to make sure about -conv option.  
As far as I know is, psf kernel size is dependent on the position of source (distance between source and detector).  
However, in Castor, psf is defined as a constant value with -conv option.  
Does Castor ignore the distance dependency of psf? or Is there a way Castor works about psf consideration that I don’t understand?

Q2. As I mentioned above, I am trying to reconstruct an image with root simulation data from GATE.  
First, I generated .geom file with the below command:

castor-GATEMacToGem -m my\_gate.mac -o SPECT\_CASTOR\_BENCHMARK

What I modify the my\_geom.geom is voxels number transaxial/axial because the value was different than I intended.

Then, I generated cdh/cdf file with below command:

castor-GATERootToCastor -i root.root -o output -m my\_gate.mac -s SPECT\_CASTOR\_BENCHMARK

Actually, I added the “-atn mumap.img” to perform attenuation correction and I got “Estimation of acf from an attenuation image (-atn option) only available for PET systems ! (detected system is SPECT).”  
So I exclude -atn option when generating cdf file.

Finally, what I tried to perform reconstruction with attenuation correction was castor-recon execution with the below command:

castor-recon -df output\_df.Cdh -opti MLEM -it 5:8 -proj incrementalSiddon -conv gaussin 4,4,3::psf -dim 128,128,128 -vox 3.87,3.87,3.87 -dout test -atn mumap.hdr

but I got an error message as below

 ![image](https://global.discourse-cdn.com/free1/uploads/castor_project/original/1X/738f865e2da5a69f792487ef3fbdbe47b65dbc0a.png)

Is there anything wrong with my execution?  
Could anybody explain how I can perform attenuation correction?

Thank you.

ps. I checked that CT4re\_mu2.hdr for attenuation correction was fine .

---

<div class="post-metadata">

**Author:** ![tmerlin](https://yyz2.discourse-cdn.com/free1/user_avatar/castor-project.discourse.group/tmerlin/32/216_2.png) [@tmerlin](https://castor-project.discourse.group/u/tmerlin)\
**Post date:** [February 24, 2023, 4:28pm UTC](https://castor-project.discourse.group/t/qusetions-for-spect-reconstruction/474/2 "2023-02-24T16:28:35Z")

</div>

Hi,  
For Q1, indeed the psf kernel depends on a number of factor and might be variant in most situations. At the moment there is only a stationary gaussian model available in castor, sorry for that.  
If one would want to implement a non-stationary kernel, the following guide provides some indications regarding the structure of ImageConvolver and which functions to modify: [https://castor-project.org/sites/default/files/2020-09/CASToR\_\_image\_convolver.pdf](https://castor-project.org/sites/default/files/2020-09/CASToR__image_convolver.pdf)

For Q2, attenuation correction for SPECT requires to provide the atn image as the correction factors are computed during reconstruction conversely to PET.  
This error occurs when Castor can’t correctly read some interfile fields, here the _matrix size [x]_ tags.  
Could you send the header to check what could cause the issue ?

Best,  
Thibaut

---

<div class="post-metadata">

**Author:** ![skykkm](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@skykkm](https://castor-project.discourse.group/u/skykkm)\
**Post date:** [February 27, 2023, 5:35am UTC](https://castor-project.discourse.group/t/qusetions-for-spect-reconstruction/474/3 "2023-02-27T05:35:15Z")

</div>

Thank you tmerlin.

I solved Q2, there is header error as you expected.  
I will try a non-stationary kernel that you indicated.

Thank you so much.

Sincerely,

Kim.

---

<div class="post-metadata">

**Author:** ![skykkm](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@skykkm](https://castor-project.discourse.group/u/skykkm)\
**Post date:** [February 28, 2023, 2:04am UTC](https://castor-project.discourse.group/t/qusetions-for-spect-reconstruction/474/4 "2023-02-28T02:04:04Z")

</div>

Hi, Thibaut,

I carefully read the guide as you suggested.  
But actually, I am not familiar with C language.  
So could you give me tips or any example source codes to build a non-stationary kernel?  
What I want to build is a kernel that has different FWHM according to the distance between COR and detector.  
In STIR, someone can select a kernel with a simple linear function of the distance.  
That is the exact one what I need.

Thank you.  
Best regard.
