<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hi Konstantinos,</p>
    <p>The out of range projection index errors usually means the code
      can't correctly read the binary datafile as you said. Judging from
      the values in your cdf file, I think something went wrong during
      your conversion. Expected types are float for the data, and
      unsigned integers (4 bytes) for time & ids. I suggest trying
      something like this in your program: </p>
    <p>  uint32_t id1, id2,** timeMS;    float** data;</p>
    <p>  // recover data<br>
    </p>
    <p>  for (id1=0; id1<bins_elts; id1++)<br>
        {<br>
          for (id2=0; id2<nCrystalsTot; id2++)<br>
          {<br>
            fwrite((char*)(&timeMS[id1][id2]) ,  sizeof(uint32_t), 
      1, pFile);<br>
            fwrite((char*)(&data[id1][id2]) ,  sizeof(float),  1,
      pFile);<br>
            fwrite((char*)(&id1) ,  sizeof(uint32_t),  1, pFile);<br>
            fwrite((char*)(&id2) ,  sizeof(uint32_t),  1, pFile);<br>
          }<br>
        }</p>
    <p>Besides, I am not sure why your datafile header states 188811
      events, while I would expect 107928 events from your numbers (nb
      of projections * nb of pixels).</p>
    <p>Best regards,</p>
    <p>Thibaut</p>
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 15/05/2017 12:55, Konstantinos P.
      Chatzipapas, MSc wrote:<br>
    </div>
    <blockquote cite="mid:c4b5a51ee19152df2a201d7343ed9cde@upatras.gr"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <p>Dear users/developers,</p>
      <p>I am trying to create a program that will write experimental
        results to the appropriate .Cdf ascii format. I am using this
        loop:</p>
      <p>  char buffer [20];<br>
          sprintf(buffer, "CDF_CstrProj.Cdf");<br>
          pFile = fopen (buffer, "w");<br>
          for (id1=0; id1<bins_elts; id1++)<br>
          {<br>
            for (id2=0; id2<nCrystalsTot; id2++)<br>
            {<br>
              fprintf(pFile,"%6d ",timeMS[id1][id2]);<br>
              fprintf(pFile,"%6d ",data[id1][id2]);<br>
              fprintf(pFile,"%6d ",id1);<br>
              fprintf(pFile,"%6d ",id2);<br>
            }<br>
          }</p>
      <p>Where id1 is the projectionID (0-35) and id2 is the pixelID
        (0-2997). Data are the counts. I am using integers in data but I
        have also try it with floats. Then by using a .Cdh I try to
        reconstruct. There is a problem there. Probably castor-recon
        does not recognize the file correct, because I am getting this
        fault repeatedly (the "Projection index" only change:</p>
      <p>***** oIterativeAlgorithm::StepInnerLoopInsideSubsetLoop()
        -> A problem occured while computing the projection line !<br>
        ***** iScannerSPECTConv::GetPositionsAndOrientations() ->
        Projection index (538976288) out of range [0:35] !<br>
        ***** vProjector::Project() -> A problem occured while
        getting positions and orientations from scanner !<br>
        ***** oProjectorManager::ComputeProjectionLine() -> A problem
        occured while forward projecting an event !</p>
      <p>I am attaching the file in order that you take a look and help
        me.</p>
      <p> </p>
      <p>Thank you in advance,</p>
      <p>Konstantinos</p>
      <p> </p>
      <div>-- <br>
        <div class="pre" style="margin: 0; padding: 0; font-family:
          monospace">
          <hr> Konstantinos P. Chatzipapas <br>
           Physicist, MSc <br>
           Faculty of Medical Physics <br>
           <strong>University of Patras</strong> <br>
          <br>
               web page: <em><a moz-do-not-send="true"
              href="http://www.physicsmag.com">Physics Magazine</a></em></div>
      </div>
      <p> </p>
      <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>