<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body vlink="#551A8B" text="#000000" link="#0B6CDA" bgcolor="#ffffff"
alink="#EE0000">
<p>Hi,</p>
<p><br>
</p>
<p>Thank you both for your feedback!<br>
</p>
<p><br>
</p>
<p>Indeed there are several issues in the converter occurring when
one would like to enable ToF and integrate some custom
scatter/random corrections. <br>
</p>
<p><br>
</p>
<p>I hadn't checked <i>castor-GATERootToCastor</i> in v3.0 with ToF
option enabled, and as Jan experienced, it crashes because of
incorrect initialization of the ToF measurement range for the
projector classes. <br>
</p>
<p><br>
</p>
<p>Additionally, as Maxime suggested, it actually makes no sense to
use ToF in the projector to compute ACF. <br>
</p>
<p><br>
</p>
<p>-> Quick workaround is to perform the modification Jan
suggested, and also add the following line in red after the
ProjectorManager initialization:</p>
<p><br>
</p>
<p>"</p>
<p> ...<br>
</p>
<p> // Check parameters<br>
if (p_ProjectorManager->CheckParameters())<br>
{<br>
Cerr("***** castor-GATERootToCastor :: A problem occurred
while checking projector manager's parameters !" << endl);<br>
Exit(EXIT_FAILURE);<br>
}<br>
<br>
// Initialize projector manager<br>
if (p_ProjectorManager->Initialize())<br>
{<br>
Cerr("***** castor-GATERootToCastor :: A problem occurred
while initializing projector manager !" << endl);<br>
Exit(EXIT_FAILURE);<br>
}<br>
<font color="#ff0000">p_ProjectorManager->SetSensitivityModeOn();</font></p>
<p> ...</p>
<p>"<br>
</p>
<p><br>
</p>
<p>This will force the projector to use the non-ToF projector
functions anyway.</p>
<p><br>
</p>
<p>-> Regarding the correct initialization of the ToF measurement
range, I agree that it should be initialized with the system
coincidence window, rather than derived from the data as Marina
and Maxime suggested. This will be fixed in next update (with an
additional option to manually set it). A temporary workaround for
this is to set it directly in the castor datafile header once it
has been generated.</p>
<p><br>
</p>
<p>-> Regarding the reconstruction of v.2 CASToR datasets with
the v.3 code, there should not be any issue. The error message
comes from additional check in the v3 version.</p>
<p>However, the estimation of ACF during conversion was already
performed by the projectors with ToF enabled, so the ACF values
might be wrong!<br>
</p>
<p><br>
</p>
<p><br>
</p>
<p>Thank you all for your insights!</p>
<p><br>
</p>
<p>Best wishes,<br>
Thibaut<br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 23/01/2020 16:56, Maxime Toussaint
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:YQBPR0101MB1651261D3BF7D0A1F52D792BF60F0@YQBPR0101MB1651.CANPRD01.PROD.OUTLOOK.COM">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
255, 255);">
</div>
<span>Greetings,<br>
</span>
<div><br>
</div>
<div>I was curious about your discovery and started to check it
out. I am not totally sure but I think there is something else
in this bug.<br>
</div>
<div><br>
</div>
<div>The tool castor-GATERootToCastor only require a projector
object when evaluating attenuation coefficients. Since
these coefficients are independent of ToF, the projector should
not need ToF information. Worse, if the projector use the ToF
information, the attenuation coefficients will be evaluated from
a portion of the LOR which does not fit the reality. However, my
previous statement might not be true for on-the-fly system
matrix computing. I will leave it to more knowledgeable peers to
confirm or infirm that part. <br>
</div>
<div><br>
</div>
<div>In short, my understanding is that ToF should be disabled for
the tools castor-GATERootToCastor when evaluating attenuation
coefficients (Using the SetIgnoreToFFlag method, most likely)
which should remove the error you observed.<br>
</div>
<div><br>
</div>
<div>On that note, I also like the idea that the variable
m_ToFMeasurementRangeInPs can be user/scanner defined. While the
current approach defined in castor-GATERootToCastor, which is
data dependent(1), is efficient, it is true that we sometime
want to fix that value for comparison or whatnot.<br>
</div>
<div><br>
</div>
<div>Have a nice day,<br>
</div>
<div>Maxime <br>
</div>
<div><br>
</div>
<div>(1)
((iDataFilePET*)Out_data_file)->SetToFMeasurementRangeInPs(dt_max
- dt_min);<br>
</div>
<div><br>
</div>
<span></span>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size: 11pt;"
data-ogsc="" face="Calibri, sans-serif" color="#000000"><b>De
:</b> Castor-users
<a class="moz-txt-link-rfc2396E" href="mailto:castor-users-bounces@lists.castor-project.org"><castor-users-bounces@lists.castor-project.org></a> de la
part de Grahe, Jan <a class="moz-txt-link-rfc2396E" href="mailto:jan.grahe@pmi.rwth-aachen.de"><jan.grahe@pmi.rwth-aachen.de></a><br>
<b>Envoyé :</b> 23 janvier 2020 07:34<br>
<b>À :</b> <a class="moz-txt-link-abbreviated" href="mailto:castor-users@lists.castor-project.org">castor-users@lists.castor-project.org</a>
<a class="moz-txt-link-rfc2396E" href="mailto:castor-users@lists.castor-project.org"><castor-users@lists.castor-project.org></a><br>
<b>Objet :</b> [Castor-users] Bug
toolkits/castor-GATERootToCastor.cc</font>
<div> </div>
</div>
<div lang="EN-US">
<div class="x_WordSection1">
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
Dear CASToR developers,</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
I tried converting a PET list-mode generated by GATE into
the CASToR format using the castor-GATERootToCastor toolkit
and obtained an error:
</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
“….</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
sScannerManager::Initialize() -> From scanner
PET_PHILIPS_VEREOS</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
iScannerPET::Initialize() -> Initialize remaining stuff
for scanner to be ready</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
oProjectorManager::Initialize() -> Initialize projectors
and projection lines</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
--> Use ToF projector for listmode data</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
***** vProjector::CheckParameters() -> Inconsistent ToF
related parameters !</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
*****
oProjectorManager::ParseOptionsAndInitializeProjectors()
-> A problem occurred while checking forward projector
parameters !</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
***** oProjectorManager::Initialize() -> A problem
occurred while parsing projector options and initializing it
!”</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
Turns out, that the variable <i>m_ToFMeasurementRangeInMm</i>
has a value of “-0.1498962” in the
<i>oProjectorManager</i>, which caused the error in the <i>vProjector::CheckParameters()</i>.
This variable is obtained from the
<i>vDataFile* Out_data_file</i> using the method <i>GetToFMeasurementRangeInPs().</i>
The datafile is initialized in the
castor-GATERootToCastor.cc file and handed to the
<i>p_ProjectManager</i> using the <i>SetDataFile()</i>
method. However, the m_<i>ToFMeasurementRangeInPs</i>
variable is set to -1 in the constructor and not set in the
<i>castor-GATERootToCastor</i> toolkit before the <i>oProjectorManager</i>
requires this variable to be set when calling it’s
<i>Initialize() </i>function. </p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
Therefore, to use the toolkit with ToF right now I added the
red line in the toolkit (the block is approx. at line ~970
of the document):</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
“….</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
// Set ToF</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
if(ToF_reso>=0)</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
{</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
((iDataFilePET*)Out_data_file)->SetToFInfoFlag();</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
((iDataFilePET*)Out_data_file)->SetToFResolutionInPs(ToF_reso);</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
<span style="color: red;">((iDataFilePET*)Out_data_file)->SetToFMeasurementRangeInPs(myScannersToFrange);</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
}</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
”</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
This seems to solve the problem, but only with the <u>general
coincidence time window of the scanner</u> instead of the
longest coincidence time of all events in your datafile. Not
sure if that is correct or a factor of e.g. 2 has to be
applied. If there is no problem with that, you could fix
this bug generally by getting the coincidence time window of
the scanner and then later update it to the real variable
when all the events have been processed.</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
As this only happens in version 3.0, can I still reconstruct
images with CASToR 3.0 using datafiles generated with the
CASToR 2.0 framework?</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
Thanks and I hope this helps!</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
Jan </p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt;
font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Castor-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Castor-users@lists.castor-project.org">Castor-users@lists.castor-project.org</a>
<a class="moz-txt-link-freetext" href="http://lists.castor-project.org/listinfo/castor-users">http://lists.castor-project.org/listinfo/castor-users</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Thibaut MERLIN -- PhD
Docteur en Imagerie Médicale au Laboratoire de Traitement de l'Information Medicale (LaTIM - INSERM UMR 1101)
Institut Brestois de recherche en Bio-Santé (IBRBS)
12 Avenue Foch, 29200 Brest, FRANCE
Tel: 06.75.12.24.90</pre>
</body>
</html>