[Castor-users] Writing .Cdf file

tmerlin Thibaut.Merlin at univ-brest.fr
Wed May 17 21:05:08 CEST 2017


Hi Konstantinos,

Data values in your datafile appear to be very small, around 10^-44 (see 
attached, Float32). I think there is still something wrong in your 
conversion.

Best regards,

Thibaut


On 16/05/2017 00:18, Konstantinos P. Chatzipapas, MSc wrote:
>
> Hi again,
>
> Sorry about this. I am re-attaching the files. Something is wrong in 
> the previous ones. Question still the same. What is wrong?
>
> Kind Regards,
>
> Konstantinos
>
> Στις 15-05-2017 23:54, Konstantinos P. Chatzipapas, MSc έγραψε:
>
>> Hello,
>>
>> It worked, thank you very much. I have one more question.
>>
>> I created the files I am attaching. There is something wrong again. 
>> The reconstructed image is empty.. All black....
>>
>> Can you help me on this?
>>
>> Many thanks,
>>
>> Konstantinos
>>
>> Στις 15-05-2017 18:24, tmerlin έγραψε:
>>
>>     Hi Konstantinos,
>>
>>     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:
>>
>>       uint32_t id1, id2,** timeMS;    float** data;
>>
>>       // recover data
>>
>>       for (id1=0; id1<bins_elts; id1++)
>>       {
>>         for (id2=0; id2<nCrystalsTot; id2++)
>>         {
>>           fwrite((char*)(&timeMS[id1][id2]) , sizeof(uint32_t),  1,
>>     pFile);
>>           fwrite((char*)(&data[id1][id2]) ,  sizeof(float), 1, pFile);
>>           fwrite((char*)(&id1) ,  sizeof(uint32_t),  1, pFile);
>>           fwrite((char*)(&id2) ,  sizeof(uint32_t),  1, pFile);
>>         }
>>       }
>>
>>     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).
>>
>>     Best regards,
>>
>>     Thibaut
>>
>>
>>     On 15/05/2017 12:55, Konstantinos P. Chatzipapas, MSc wrote:
>>
>>         Dear users/developers,
>>
>>         I am trying to create a program that will write experimental
>>         results to the appropriate .Cdf ascii format. I am using this
>>         loop:
>>
>>           char buffer [20];
>>           sprintf(buffer, "CDF_CstrProj.Cdf");
>>           pFile = fopen (buffer, "w");
>>           for (id1=0; id1<bins_elts; id1++)
>>           {
>>             for (id2=0; id2<nCrystalsTot; id2++)
>>             {
>>               fprintf(pFile,"%6d ",timeMS[id1][id2]);
>>               fprintf(pFile,"%6d ",data[id1][id2]);
>>               fprintf(pFile,"%6d ",id1);
>>               fprintf(pFile,"%6d ",id2);
>>             }
>>           }
>>
>>         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:
>>
>>         ***** oIterativeAlgorithm::StepInnerLoopInsideSubsetLoop() ->
>>         A problem occured while computing the projection line !
>>         ***** iScannerSPECTConv::GetPositionsAndOrientations() ->
>>         Projection index (538976288) out of range [0:35] !
>>         ***** vProjector::Project() -> A problem occured while
>>         getting positions and orientations from scanner !
>>         ***** oProjectorManager::ComputeProjectionLine() -> A problem
>>         occured while forward projecting an event !
>>
>>         I am attaching the file in order that you take a look and
>>         help me.
>>
>>         Thank you in advance,
>>
>>         Konstantinos
>>
>>         -- 
>>         ------------------------------------------------------------------------
>>          Konstantinos P. Chatzipapas
>>          Physicist, MSc
>>          Faculty of Medical Physics
>>         *University of Patras*
>>
>>              web page: /Physics Magazine <http://www.physicsmag.com>/
>>
>>
>>
>>         _______________________________________________
>>         Castor-users mailing list
>>         Castor-users at lists.castor-project.org
>>         http://lists.castor-project.org/listinfo/castor-users
>>
>>
>>     -- 
>>     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
>>
>>
>>     _______________________________________________
>>     Castor-users mailing list
>>     Castor-users at lists.castor-project.org
>>     <mailto:Castor-users at lists.castor-project.org>
>>     http://lists.castor-project.org/listinfo/castor-users
>>
>>
>> _______________________________________________
>> Castor-users mailing list
>> Castor-users at lists.castor-project.org 
>> <mailto:Castor-users at lists.castor-project.org>
>> http://lists.castor-project.org/listinfo/castor-users

-- 
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.castor-project.org/pipermail/castor-users/attachments/20170517/539fa38a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: datak.png
Type: image/png
Size: 134542 bytes
Desc: not available
URL: <http://lists.castor-project.org/pipermail/castor-users/attachments/20170517/539fa38a/attachment-0001.png>


More information about the Castor-users mailing list