File indexing completed on 2025-01-18 09:17:04
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <math.h>
0012 #include <stdint.h>
0013 #include <stdio.h>
0014 #include <string.h>
0015
0016 #include <vector>
0017
0018
0019 #define PI 3.14159265f
0020
0021
0022 struct PixeEvent
0023 {
0024 uint16_t energy_10eV;
0025 uint16_t pixelIndex;
0026 uint16_t sliceIndex;
0027 uint8_t projectionIndex;
0028 };
0029
0030
0031
0032 void Extract_Projection()
0033 {
0034
0035 FILE* in = fopen("../build/PixeEvent_std_AtExit_Detector135_Aperture70.DAT", "rb");
0036
0037
0038 FILE* out = fopen("../build/PixeEvent_std_AtExit_Detector135_Aperture70_50Projections.DAT", "wb");
0039
0040 if (in == NULL) {
0041 printf("error for opening the intput file\n");
0042 return;
0043 }
0044
0045 PixeEvent p;
0046 PixeEvent pp;
0047 vector<int> valid_projections;
0048 for (int i = 0; i < 50; ++i) {
0049 int p = 2 * i;
0050 valid_projections.push_back(p);
0051 }
0052
0053 while (fread(&p, 7, 1, in)) {
0054 int key = p.projectionIndex;
0055
0056 if (std::find(valid_projections.begin(), valid_projections.end(), key)
0057 != valid_projections.end()) {
0058 pp.energy_10eV = p.energy_10eV;
0059 pp.projectionIndex = p.projectionIndex / 2;
0060 pp.sliceIndex = p.sliceIndex;
0061 pp.pixelIndex = p.pixelIndex;
0062 pp.pixelIndex = p.pixelIndex;
0063
0064
0065 fwrite(&pp, 7, 1, out);
0066 }
0067 }
0068 fclose(in);
0069 fclose(out);
0070 }