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_Slice()
0033 {
0034 int start_slice = 0;
0035 int end_slice = 0;
0036
0037 FILE* in = fopen("../build/PixeEvent_std_AtCreation.DAT", "rb");
0038
0039
0040 FILE* out = fopen("../build/PixeEvent_std_AtCreation_slice.DAT", "wb");
0041
0042
0043 if (in == NULL) {
0044 printf("error for opening the intput file\n");
0045 return;
0046 }
0047
0048 PixeEvent p;
0049 PixeEvent pp;
0050
0051 while (fread(&p, 7, 1, in)) {
0052 if (p.sliceIndex >= start_slice && p.sliceIndex <= end_slice) {
0053 pp.energy_10eV = p.energy_10eV;
0054 pp.projectionIndex = p.projectionIndex;
0055 pp.sliceIndex =
0056 p.sliceIndex - start_slice;
0057 pp.pixelIndex = p.pixelIndex;
0058 pp.pixelIndex = p.pixelIndex;
0059
0060
0061 fwrite(&pp, 7, 1, out);
0062 }
0063 }
0064 fclose(in);
0065 fclose(out);
0066 }