<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello James,</p>
    <p>Apparently something went wrong when generating the binary
      datafile, though I can't tell exactly why from your matlab code.</p>
    <p>This error occurs when the binary datafile doesn't have the
      expected size. The size is computed from the number of event, and
      what mandatory/optional fields are in your data. From your header,
      the datafile should contain 1966080 events with normalization and
      scatter correction factors. Each event will be composed of
      (time(uint32) + event value (FLNTBDATA) + scat factor (FLTNBDATA)
      + norm factor (FLTNBDATA) + 2*ID (2*uint32). As you said, default
      FLNTBDATA is 32-bits floats, so this means the code will expect a
      datafile with a size equal to 1966080*(6*4bytes) = 47185920 bytes.
      (The error message erroneously states the expected size is
      39321600 bytes because there is a small typo in your data header
      for the normalization field. It should be "Normali<b>z</b>ation
      correction flag" instead of "Normali<b>s</b>ation correction
      flag", unless it won't enable normalization factors).</p>
    <p>Now looking at your binary datafile with an hexa editor, it seems
      your conversion stopped after 58354 events (see attached file) for
      some reasons. Besides, each event has the correct number of
      fields, but it seems that all pixel data and scat factor are
      equals to 0.</p>
    <p>Hope it helps !</p>
    <p>Best regards,</p>
    <p>Thibaut</p>
    <p><br>
    </p>
    <p><br>
    </p>
    <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)
Bâtiment 1
CHRU Morvan - 2, Av. Foch
29609 Brest CEDEX - FRANCE
Tel: 06.75.12.24.90</pre>
    <br>
    <div class="moz-cite-prefix">On 02/08/2017 20:18, SCUFFHAM, James
      (ROYAL SURREY COUNTY HOSPITAL NHS FOUNDATION TRUST) wrote:<br>
    </div>
    <blockquote
      cite="mid:9475bdb1e33243a0af6928c506e6fb2b@NH-SLPEX096.AD1.NHS.NET"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        mso-fareast-language:EN-GB;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-GB;}
span.hoenzb
        {mso-style-name:hoenzb;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Dear
            CASToR community,<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I
            am appealing for some help getting CASToR to reconstruct
            some SPECT projection data with scatter correction. 
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I
            have attached the Matlab code we’re using to convert SPECT
            projection data from Interfile into CASToR .cdh/.cdf files. 
            I also attach the result of this code when we feed it three
            interfiles (photopeak and upper/lower scatter windows).  The
            code estimates the scatter component (in counts/sec) using
            the Triple Energy Window method.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">When
            we run the resulting datafiles through castor-recon.exe, we
            get the attached error message.  As there is a mismatch
            between the expected and actual sizes, I suspect the problem
            relates to the bit depth of the variables as I write them to
            the .cdf file, or a problem with the header and CASToR not
            recognising the fact that I’ve included normalisation
            factors.  As we are using the pre-compiled binaries, we
            haven’t changed the default FLTNMDATA variable, so I am
            writing variables of this type as 32-bit floats. 
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I
            can’t spot any other issues with the conversion code, but
            I’m obviously missing something.  I would appreciate any
            help anyone can offer.  I have already had some very helpful
            email exchanges with Michael Ljungberg in Lund, who has
            already got this working.  But rather than continue to
            hassle Michael, I thought I would give him a break and
            appeal to the wider community!<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Kind
            regards,<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">James.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><b><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">James
              Scuffham, MSc, PhD, MIPEM       
              <o:p></o:p></span></b></p>
        <table class="MsoNormalTable" style="border-collapse:collapse"
          border="0" cellpadding="0" cellspacing="0">
          <tbody>
            <tr>
              <td style="width:196.8pt;padding:0cm 5.4pt 0cm 5.4pt"
                valign="top" width="262">
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D;mso-fareast-language:EN-US">Deputy
                    Head of Section                     
                    <o:p></o:p></span></p>
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D;mso-fareast-language:EN-US">Nuclear
                    Medicine Physics<o:p></o:p></span></p>
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D;mso-fareast-language:EN-US">Royal
                    Surrey County Hospital           
                    <o:p></o:p></span></p>
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D;mso-fareast-language:EN-US">Egerton
                    Road, Guildford, GU2 7XX<o:p></o:p></span></p>
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D;mso-fareast-language:EN-US">T:
                    01483 406708<o:p></o:p></span></p>
              </td>
              <td style="width:160.4pt;padding:0cm 5.4pt 0cm 5.4pt"
                valign="top" width="214">
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D;mso-fareast-language:EN-US">Associate
                    Tutor
                    <o:p></o:p></span></p>
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D;mso-fareast-language:EN-US">Department
                    of Physics<o:p></o:p></span></p>
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D;mso-fareast-language:EN-US">University
                    of Surrey<o:p></o:p></span></p>
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D;mso-fareast-language:EN-US">Guildford,
                    GU2 7XH<o:p></o:p></span></p>
              </td>
              <td style="width:178.6pt;padding:0cm 5.4pt 0cm 5.4pt"
                valign="top" width="238">
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
              </td>
            </tr>
            <tr>
              <td style="width:196.8pt;padding:0cm 5.4pt 0cm 5.4pt"
                width="262"><br>
              </td>
              <td style="width:160.4pt;padding:0cm 5.4pt 0cm 5.4pt"
                width="214"><br>
              </td>
              <td style="width:178.6pt;padding:0cm 5.4pt 0cm 5.4pt"
                width="238">
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
              </td>
            </tr>
          </tbody>
        </table>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
              lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
            lang="EN-US"> Castor-users
            [<a class="moz-txt-link-freetext" href="mailto:castor-users-bounces@lists.castor-project.org">mailto:castor-users-bounces@lists.castor-project.org</a>]
            <b>On Behalf Of </b>Kajal Aggarwal<br>
            <b>Sent:</b> 02 August 2017 10:10<br>
            <b>To:</b> tmerlin<br>
            <b>Cc:</b> <a class="moz-txt-link-abbreviated" href="mailto:castor-users@lists.castor-project.org">castor-users@lists.castor-project.org</a><br>
            <b>Subject:</b> Re: [Castor-users] Query related to
            castor-GateMacToGeom<o:p></o:p></span></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div>
          <div>
            <div>
              <div>
                <div>
                  <p class="MsoNormal" style="margin-bottom:12.0pt">Hello,<o:p></o:p></p>
                </div>
                <p class="MsoNormal" style="margin-bottom:12.0pt">Thank
                  you for the detailed explanation. I am having troubles
                  to reconstruct an image for a cylindrical PET system
                  simulated using Gate. I am generating .geom file and
                  .cdh and .cdf files (attached in this email) for my
                  .mac file and for the output root file. But the image
                  generated has some problem (see the screen-shot
                  below). Please guide me where I am going wrong.
                  <o:p></o:p></p>
              </div>
              <p class="MsoNormal" style="margin-bottom:12.0pt">Thank
                you very much for all your support.<o:p></o:p></p>
            </div>
            <p class="MsoNormal">Regards,<o:p></o:p></p>
          </div>
          <p class="MsoNormal">Kajal<o:p></o:p></p>
          <div>
            <div>
              <div>
                <div>
                  <p class="MsoNormal"><br>
                    <br>
                    <img id="Picture_x0020_1"
                      src="cid:part1.97A3E863.F4365B23@univ-brest.fr"
                      alt="Inline image 1" height="190" width="560"><br>
                    <br>
                    <br>
                    <img id="Picture_x0020_2"
                      src="cid:part2.FE9EB923.3E0849D6@univ-brest.fr"
                      alt="Inline image 2" height="179" width="560"> <o:p></o:p></p>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div>
          <p class="MsoNormal"><o:p> </o:p></p>
          <div>
            <p class="MsoNormal">On Tue, Aug 1, 2017 at 9:00 PM, tmerlin
              <<a moz-do-not-send="true"
                href="mailto:Thibaut.Merlin@univ-brest.fr"
                target="_blank">Thibaut.Merlin@univ-brest.fr</a>>
              wrote:<o:p></o:p></p>
            <div>
              <p>Hello Kajal,<o:p></o:p></p>
              <p>F.O.V variables are arbitrary computed as <i>scanner_radius(mm)/4</i>
                for the transaxial component, and the axial dimension
                (mm) of the rsector/block for the axial component. The
                transaxial/axial number of voxels are calculated from
                these values in order to get (large) isotropic 4mm
                voxels.<o:p></o:p></p>
              <p>The sole purpose of these variables is to be used as
                default for reconstruction dimensions/voxel sizes when
                using this scanner, in the case no dimensions have been
                initialized in command-line options. In practice, they
                are overwritten by the parameters entered in command
                line options (<i>-dim</i> for number of voxels, <i>-fov
                  /-vox</i> for field of view and voxel dimensions
                initializations ).<o:p></o:p></p>
              <p>Best regards,<o:p></o:p></p>
              <p>Thibaut<o:p></o:p></p>
              <div>
                <div>
                  <p class="MsoNormal"><o:p> </o:p></p>
                  <div>
                    <p class="MsoNormal">On 01/08/2017 16:54, Kajal
                      Aggarwal wrote:<o:p></o:p></p>
                  </div>
                </div>
              </div>
              <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
                <div>
                  <div>
                    <div>
                      <div>
                        <p class="MsoNormal"
                          style="margin-bottom:12.0pt">Hello everyone,<o:p></o:p></p>
                      </div>
                      <p class="MsoNormal">I am trying to create .geom
                        file from a .mac file for PET scanner system. In
                        the .geom file created, I would like to know how
                        the voxels number transaxial, voxels number
                        axial, field of view transaxial, field of view
                        axial are being calculated.<br>
                        <br>
                        <br>
                        <br clear="all">
                        <o:p></o:p></p>
                      <div>
                        <div>
                          <p class="MsoNormal"><br>
                            -- <o:p></o:p></p>
                          <div>
                            <div>
                              <div>
                                <p class="MsoNormal">Thanking you.<o:p></o:p></p>
                              </div>
                              <div>
                                <p class="MsoNormal"> <o:p></o:p></p>
                              </div>
                              <div>
                                <p class="MsoNormal">Yours sincerely,<o:p></o:p></p>
                              </div>
                              <div>
                                <p class="MsoNormal">Kajal Aggarwal<o:p></o:p></p>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                    <p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
                  </div>
                </div>
                <pre>_______________________________________________<o:p></o:p></pre>
                <pre>Castor-users mailing list<o:p></o:p></pre>
                <pre><a moz-do-not-send="true" href="mailto:Castor-users@lists.castor-project.org" target="_blank">Castor-users@lists.castor-project.org</a><o:p></o:p></pre>
                <pre><a moz-do-not-send="true" href="http://lists.castor-project.org/listinfo/castor-users" target="_blank">http://lists.castor-project.org/listinfo/castor-users</a><span class="hoenzb"><span style="color:#888888"><o:p></o:p></span></span></pre>
              </blockquote>
              <p class="MsoNormal" style="margin-bottom:12.0pt"><span
                  class="hoenzb"><span style="color:#888888"><o:p> </o:p></span></span></p>
              <pre><span style="color:#888888">-- </span><o:p></o:p></pre>
              <pre><span style="color:#888888">Thibaut MERLIN -- PhD<o:p></o:p></span></pre>
              <pre><span style="color:#888888"><o:p> </o:p></span></pre>
              <pre><span style="color:#888888">Docteur en Imagerie Médicale au Laboratoire de Traitement de l'Information Medicale (LaTIM - INSERM UMR 1101)<o:p></o:p></span></pre>
              <pre><span style="color:#888888">Bâtiment 1<o:p></o:p></span></pre>
              <pre><span style="color:#888888">CHRU Morvan - 2, Av. Foch<o:p></o:p></span></pre>
              <pre><span style="color:#888888">29609 Brest CEDEX - FRANCE<o:p></o:p></span></pre>
              <pre><span style="color:#888888">Tel: 06.75.12.24.90</span><o:p></o:p></pre>
            </div>
          </div>
          <p class="MsoNormal"><br>
            <br clear="all">
            <br>
            -- <o:p></o:p></p>
          <div>
            <div>
              <div>
                <p class="MsoNormal">Thanking you.<o:p></o:p></p>
              </div>
              <div>
                <p class="MsoNormal"> <o:p></o:p></p>
              </div>
              <div>
                <p class="MsoNormal">Yours sincerely,<o:p></o:p></p>
              </div>
              <div>
                <p class="MsoNormal">Kajal Aggarwal<o:p></o:p></p>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <font color="Black" face="Courier New" size="2"><br>
********************************************************************************************************************<br>
        <br>
        This message may contain confidential information. If you are
        not the intended recipient please inform the<br>
        sender that you have received the message in error before
        deleting it.<br>
        Please do not disclose, copy or distribute information in this
        e-mail or take any action in relation to its contents. To do so
        is strictly prohibited and may be unlawful. Thank you for your
        co-operation.<br>
        <br>
        NHSmail is the secure email and directory service available for
        all NHS staff in England and Scotland. NHSmail is approved for
        exchanging patient data and other sensitive information with
        NHSmail and other accredited email services.<br>
        <br>
        For more information and to find out how you can switch,
        <a class="moz-txt-link-freetext" href="https://portal.nhs.net/help/joiningnhsmail">https://portal.nhs.net/help/joiningnhsmail</a><br>
        <br>
      </font>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <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>
    <br>
    <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)
Bâtiment 1
CHRU Morvan - 2, Av. Foch
29609 Brest CEDEX - FRANCE
Tel: 06.75.12.24.90</pre>
  </body>
</html>