<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD>
<BODY
style="WORD-WRAP: break-word; khtml-nbsp-mode: space; khtml-line-break: after-white-space">
<DIV><SPAN class=871153713-26052005><FONT face=Arial color=#0000ff size=2>Hi
Graeme,</FONT></SPAN></DIV>
<DIV><SPAN class=871153713-26052005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=871153713-26052005><FONT face=Arial color=#0000ff size=2>I
wrote one for the basic Michelogram. The latex is
below.</FONT></SPAN></DIV>
<DIV><SPAN class=871153713-26052005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=871153713-26052005><FONT face=Arial color=#0000ff
size=2>ross</FONT></SPAN></DIV>
<DIV><SPAN class=871153713-26052005><FONT face="Courier New" size=2>
<P>\appendix</P>
<P>\subsection{Rebinning GATE Coincidences}</P>
<P>\label{sec:Sinogram_builder}</P>
<P></P>
<P>GATE uses the Crystal, Block, and Module identification numbers to organize
detection events into sinograms. This nomenclature is comparable to that used in
actual scanners. In this scanner, the events are identified and stored by
subdividing the scanner into 36 Crystals per Block, 6 Blocks per Module (in a
two by three Block configuration), and 56 Modules for the complete gantry. </P>
<P>In this case, the GATE crystal, block, and module ID's for each coincidence
pair are converted into crystal-ring pairs via the following
equations\footnotemark[1]\footnotetext[1]{$INT$ and $MOD$ functions take the
integer and modulus of their arguments, respectively.},</P>
<P>\begin{eqnarray}</P>
<P>Ring_{1,2} = INT\left(\frac{CrystalID_{1,2}}{6}\right) \nonumber \\ </P>
<P>+ 6 \times INT\left(\frac{BlockID_{1,2}}{2}\right) , </P>
<P>\end{eqnarray}</P>
<P></P>
<P>\noindent and,</P>
<P></P>
<P>\begin{eqnarray} Crystal_{1,2} = MOD\left(CrystalID_{1,2},6\right) \nonumber
\\ </P>
<P>+ 6 \times \left[MOD\left(BlockID_{1,2},2\right) \right. \nonumber \\ </P>
<P>\left. + 2 \times ModuleID_{1,2}\right].</P>
<P>\label{eq:ring_num}</P>
<P>\end{eqnarray}</P>
<P>\noindent The subscripts 1,2 correspond to each of the detected events that
make up the coincidence pair. This indexing used by GATE is shown in
Figure~\ref{fig:singles_binning}.</P>
<P>\begin{figure}</P>
<P>\includegraphics [scale=.22,angle=0]{./singles_binning.eps}</P>
<P>\footnotesize{\caption{The indexing scheme used by GATE to define detector
locations within a Module. Note that the scanner has 56 Modules, each containing
6 Blocks, which in turn contain 36 Crystals
each.}\label{fig:singles_binning}}</P>
<P>\end{figure}</P>
<P>\subsection{Building Sinograms}</P>
<P>The crystal-ring pairs represent lines of response (LOR) that are rearranged
(binned) into a Michelogram format (developed by Christian
Michel~\cite{3DPET:1998}). In this format, the LOR's are binned into a block
matrix with indice dimensions in the $\phi$, \emph{r}, and $\theta$ directions,
where $\phi$ = azimuthal, \emph{r} = radial, and $\theta$ = ring difference
bins.</P>
<P>The azimuthal binning of the LOR's is achieved by noting that for each
projection plane the sum of the crystal numbers (C\#) for a coincidence pair
will always sum to one of two numbers that are unique to a particular projection
plane. These two numbers are offset from one another by the total number of
crystals in the scanner's ring (i.e. in the GE Advance/Discovery LS scanner
$N=672$, thus \emph{sum} = C\# and C\# + 672). The index \emph{i} for a given
$\phi$ can then be expressed as,</P>
<P>\begin{equation}</P>
<P>i = \left[ \left( Crystal_{1} + Crystal_{2} \right) + Const. \right], </P>
<P>\end{equation}</P>
<P>\noindent where the \emph{Const.} is an arbitrary offset which satisfies the
boundary condition $\phi = 0$. In the case of interlacing, $i \in [0,N/2)$, and
$\phi_i$ is therefore given by,</P>
<P>\begin{equation}</P>
<P>\phi_i = \frac{2 \pi i}{N}.</P>
<P>\end{equation}</P>
<P>Radial binning is done by observing that the radial distance from the center
of the scanner is related to the index difference of the crystals in the pair.
In terms of indexing, the index $j$ for $r$ can be expressed as,</P>
<P>\begin{equation}</P>
<P>\left| j \right| = N/2 - \left| Crystal_{1} - Crystal_{2} \right|, </P>
<P>\end{equation}</P>
<P>\noindent with $j \in [0,N/2)$ for the case of interlacing. The sign of
\emph{j} is determined by the position of the LOR relative to $\phi_i$:</P>
<P>\begin{equation} j = \left\{ \begin{array}{ll} </P>
<P>+\left|j\right| & \mbox{if } crystal_{1,2} \in \left[i, i + N/2 \right]
\\ </P>
<P>-\left|j\right| & {otherwise}\end{array} </P>
<P>\right. .</P>
<P>\end{equation}</P>
<P>\noindent Another way of stating this is that an LOR for a crystal pair in
the right-half plane, with respect to the LOR's projection plane, will have a
positive index, whereas the left-half plane will have a negative index. Thus for
a scanner of radius $R$, this results in the radial distance $r_j$ being
expressed by,</P>
<P>\begin{equation}</P>
<P>r_j = R \sin \left[\pi \left( \frac{j + 1/2}{N} \right) \right] . </P>
<P>\end{equation}</P>
<P>Lastly, the ring difference, or the index of the axial angle $\theta$, is
simply given by the ring difference as determined above in
equation~\ref{eq:ring_num}. Here coincidence pairs with $\theta > 0$ are
stored as $(ring_1, ring_2)$ while those with $\theta < 0$ are stored as
$(ring_2, ring_1)$. They are assigned in the following manner,</P>
<P></P>
<P>\begin{equation}</P>
<P>(ring_1, ring_2) ~\forall~ crystal_1 \in \left[i - N/4, i + N/4 \right] ,
</P>
<P>\end{equation}</P>
<P>\noindent and</P>
<P>\begin{equation}</P>
<P>(ring_2, ring_1) ~\forall~ crystal_2 \in \left[i - N/4, i + N/4 \right] .
</P>
<P>\end{equation}</P>
<P>\noindent The crystal that lies in the lower-half plane with respect to the
$i^{th}$ projection plane will define the first index.</P>
<P>In practice, the coincidence events described in this section are interlaced
from $\phi$ into $r$. This has the effect of halving the number of $\phi$
indices and doubling the number of $r$ indices; $i \in [0,N) \rightarrow
[0,N/2)$, and $j \in [0,N/4) \rightarrow [0,N/2)$.
Figure~\ref{fig:sinogram_binning} illustrates the indexing strategy used to
convert the detector and ring number pairs into sinogram counts.</P>
<P>\begin{figure}</P>
<P>\includegraphics [scale=.37,angle=0]{./sinogram_binning.eps}</P>
<P>\footnotesize{\caption{A simple example that shows the sinogram indexing for
two projection planes of a scanner with 16 detectors that interlaces with $\phi$
into $r$.}\label{fig:sinogram_binning}}</P>
<P>\end{figure}</P>
<P> </P>
<P> </P>
<P> </P>
<P><FONT face=Arial color=#0000ff></FONT> </P></FONT></SPAN></DIV>
<DIV><SPAN class=871153713-26052005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B>
gate-users-bounces@lphe1pet1.epfl.ch
[mailto:gate-users-bounces@lphe1pet1.epfl.ch] <B>On Behalf Of </B>Graeme
O'Keefe<BR><B>Sent:</B> Wednesday, May 25, 2005 7:25 PM<BR><B>To:</B> GATE
feedback and helpline for Users<BR><B>Subject:</B> Re: [gate-users] ASCII File
format<BR><BR></FONT></DIV>Hi Jan,
<DIV>
<DIV><BR class=khtml-block-placeholder></DIV>
<DIV>I am writing a sorter at the moment to convert gate ASCII output to Philips
UGM format sinograms.</DIV>
<DIV><BR class=khtml-block-placeholder></DIV>
<DIV>I have the sinogram storage sorted out but a small problem with the (xPosA,
xPosB) mapping to (rho, phi).</DIV>
<DIV><BR class=khtml-block-placeholder></DIV>
<DIV>Maybe someone has done it already, if not, it may be of use to some people
out there, I'll let you know when I've 'sorted' it out.</DIV>
<DIV><BR class=khtml-block-placeholder></DIV>
<DIV>I had the same problem with the ASCII output for cylindrical PET, here is
what I found.</DIV>
<DIV><BR class=khtml-block-placeholder></DIV>
<DIV>In GateCoincidenceDigi.cc, you will find:</DIV>
<DIV># GateCoicidenceDigi.cc </DIV>
<DIV>#std::ofstream& operator<<(std::ofstream& flux,
GateCoincidenceDigi* digi) </DIV>
<DIV>#{ </DIV>
<DIV># GatePulse pulse; </DIV>
<DIV># for (G4int iP=0; iP<2; iP++) { </DIV>
<DIV># pulse = digi->GetPulse(iP); </DIV>
<DIV># flux </DIV>
<DIV>#1 << " " << std::setw(7) <<
pulse.GetRunID() </DIV>
<DIV>#2 << " " << std::setw(7) <<
pulse.GetEventID() </DIV>
<DIV>#3 << " " << std::setw(5) <<
pulse.GetSourceID() </DIV>
<DIV>#4 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setprecision(3)
<< pulse.GetSourcePosition().x()/mm </DIV>
<DIV>#5 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setprecision(3)
<< pulse.GetSourcePosition().y()/mm </DIV>
<DIV>#6 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setprecision(3)
<< pulse.GetSourcePosition().z()/mm </DIV>
<DIV>#7 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setprecision(23) <<
pulse.GetTime()/s </DIV>
<DIV>#8 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setprecision(3)
<< pulse.GetEnergy()/MeV </DIV>
<DIV>#9 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setprecision(3)
<< pulse.GetGlobalPos().x()/mm </DIV>
<DIV>#10 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setprecision(3)
<< pulse.GetGlobalPos().y()/mm </DIV>
<DIV>#11 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setprecision(3)
<< pulse.GetGlobalPos().z()/mm </DIV>
<DIV>#12-17 << " " << std::setw(5) <<
pulse.GetOutputVolumeID() </DIV>
<DIV>#18 << " " << std::setw(5) <<
pulse.GetNPhantomCompton() </DIV>
<DIV>#19 << " " << std::setw(5) <<
pulse.GetNCrystalCompton() </DIV>
<DIV>#20 << " " << std::setw(5) <<
pulse.GetNPhantomRayleigh() </DIV>
<DIV>#21 << " " << std::setw(5) <<
pulse.GetNCrystalRayleigh() </DIV>
<DIV>#22 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setprecision(3)
<< pulse.GetScannerPos().z()/mm </DIV>
<DIV>#23 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setprecision(3)
<< pulse.GetScannerRotAngle()/deg; </DIV>
<DIV># } </DIV>
<DIV><BR class=khtml-block-placeholder></DIV>
<DIV>So for two pulses for a coin => 46 columns, the extra two columns per
pulse being from the Rayleigh events.</DIV>
<DIV>Four columns additional to documentation from Rayleigh scattering, columns
20, 21, 43, 44</DIV>
<DIV><BR class=khtml-block-placeholder>
<DIV>Likewise, the singles ASCII format is different from the documented singles
ASCII format.</DIV><BR class=khtml-block-placeholder></DIV>
<DIV>In GateSingleDigi.cc, you will find:</DIV>
<DIV>#GateSingleDigi.cc </DIV>
<DIV>#std::ofstream& operator<<(std::ofstream& flux,
GateSingleDigi* digi) </DIV>
<DIV>#{ flux </DIV>
<DIV>#1 << " " << std::setw(7) <<
digi->GetRunID() </DIV>
<DIV>#2 << " " << std::setw(7) <<
digi->GetEventID() </DIV>
<DIV>#3 << " " << std::setw(5) <<
digi->GetSourceID() </DIV>
<DIV>#4 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setw(10) <<
std::setprecision(3) << digi->GetSourcePosition().x()/mm </DIV>
<DIV>#5 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setw(10) <<
std::setprecision(3) << digi->GetSourcePosition().y()/mm </DIV>
<DIV>#6 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setw(10) <<
std::setprecision(3) << digi->GetSourcePosition().z()/mm </DIV>
<DIV>#7-12 << " " << std::setw(5) <<
digi->GetOutputVolumeID() </DIV>
<DIV>#13 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setw(30) <<
std::setprecision(23) << digi->GetTime()/s </DIV>
<DIV>#14 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setw(10) <<
std::setprecision(3) << digi->GetEnergy()/MeV </DIV>
<DIV>#15 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setw(10) <<
std::setprecision(3) << digi->GetGlobalPos().x()/mm </DIV>
<DIV>#16 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setw(10) <<
std::setprecision(3) << digi->GetGlobalPos().y()/mm </DIV>
<DIV>#17 << " " <<
std::resetiosflags(std::ios::floatfield) <<
std::setiosflags(std::ios::scientific) << std::setw(10) <<
std::setprecision(3) << digi->GetGlobalPos().z()/mm </DIV>
<DIV>#18 << " " << std::setw(4) <<
digi->GetNPhantomCompton() </DIV>
<DIV>#19 << " " << std::setw(4) <<
digi->GetNCrystalCompton() </DIV>
<DIV>#20 << " " << std::setw(4) <<
digi->GetNPhantomRayleigh() </DIV>
<DIV>#21 << " " << std::setw(4) <<
digi->GetNCrystalRayleigh() </DIV>
<DIV>#22 << " " << digi->GetComptonVolumeName()
</DIV>
<DIV>#23 << " " << digi->GetRayleighVolumeName()
</DIV>
<DIV># << G4endl; </DIV>
<DIV><BR class=khtml-block-placeholder></DIV>
<DIV>There are an additional three columns for Rayleigh scattering information,
column 20, 21 & 23.</DIV>
<DIV><BR class=khtml-block-placeholder></DIV>
<DIV>Hope this helps?</DIV>
<DIV>
<DIV>
<DIV><BR class=khtml-block-placeholder></DIV>
<DIV>regards,</DIV>
<DIV><BR class=khtml-block-placeholder></DIV>
<DIV>Graeme</DIV>
<DIV><BR><BR>
<DIV>
<DIV style="MARGIN: 0px"><FONT class=Apple-style-span face=Verdana>Graeme
O'Keefe</FONT></DIV>
<DIV style="MARGIN: 0px"><FONT class=Apple-style-span face=Verdana>Centre for
PET</FONT></DIV>
<DIV style="MARGIN: 0px"><FONT class=Apple-style-span face=Verdana>Austin
Hospital</FONT></DIV>
<DIV style="MARGIN: 0px"><FONT class=Apple-style-span face=Verdana>Tel:
(613)-9496-5767</FONT></DIV>
<DIV style="MARGIN: 0px"><FONT class=Apple-style-span face=Verdana>Fax: (613)
9458-5023</FONT></DIV></DIV><BR><BR class=khtml-block-placeholder></DIV>
<DIV>On 25/05/2005, at 5:49 PM, D.J. van der Laan wrote:</DIV><BR
class=Apple-interchange-newline>
<BLOCKQUOTE type="cite">
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MARGIN: 0px">I have a problem with the meaning of the columns in
the coincidence ASCII output. According to the manual and the FAQ the number
of columns in de coincidence file should be 42 for the cylindricalPET system,
but the files Gate produces have 46 columns. When looking at the file I
suspect that there are not 6 volume ID's per event, but 8. Is this
correct?</DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MARGIN: 0px">Thanks,</DIV>
<DIV style="MARGIN: 0px">Jan</DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MARGIN: 0px">--<SPAN
class=Apple-converted-space> </SPAN></DIV>
<DIV style="MARGIN: 0px">D.J. van der Laan</DIV>
<DIV style="MARGIN: 0px">Delft University of Technology</DIV>
<DIV style="MARGIN: 0px">Mekelweg 15, room 2.00.020</DIV>
<DIV style="MARGIN: 0px">2629 JB Delft</DIV>
<DIV style="MARGIN: 0px">The Netherlands</DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MARGIN: 0px">E: <A
href="mailto:d.j.vanderlaan@tnw.tudelft.nl">d.j.vanderlaan@tnw.tudelft.nl</A></DIV>
<DIV style="MARGIN: 0px">T: +31 15 2783776</DIV>
<DIV style="MARGIN: 0px">F: +31 15 2789011</DIV>
<DIV style="MARGIN: 0px">_______________________________________________</DIV>
<DIV style="MARGIN: 0px">gate-users mailing list</DIV>
<DIV style="MARGIN: 0px"><A
href="mailto:gate-users@lphe1pet1.epfl.ch">gate-users@lphe1pet1.epfl.ch</A></DIV>
<DIV style="MARGIN: 0px"><A
href="http://lphe1pet1.epfl.ch/mailman/listinfo/gate-users">http://lphe1pet1.epfl.ch/mailman/listinfo/gate-users</A></DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV><BR
class=Apple-interchange-newline></BLOCKQUOTE></DIV><BR></DIV>
<DIV><BR class=khtml-block-placeholder></DIV></DIV></BODY></HTML>