|
31 | 31 |
|
32 | 32 | # %% definition of useful objects and variables |
33 | 33 |
|
34 | | -scanner = stir.Scanner_get_scanner_from_name('SAFIRDualRingPrototype') |
35 | | -scanner.set_num_transaxial_blocks_per_bucket(1) |
| 34 | +scanner = stir.Scanner.get_scanner_from_name('SAFIRDualRingPrototype') |
| 35 | +scanner.set_num_transaxial_blocks_per_bucket(2) |
| 36 | +scanner.set_transaxial_block_spacing(scanner.get_transaxial_crystal_spacing()*scanner.get_num_transaxial_crystals_per_block()*1.2) |
36 | 37 | scanner.set_intrinsic_azimuthal_tilt(0) |
37 | 38 | # scanner.set_num_axial_crystals_per_block(1) |
38 | | -# scanner.set_axial_block_spacing(scanner.get_axial_crystal_spacing()*scanner.get_num_axial_crystals_per_block()) |
| 39 | +scanner.set_axial_block_spacing(scanner.get_axial_crystal_spacing()*scanner.get_num_axial_crystals_per_block()*1.2) |
39 | 40 | # scanner.set_num_rings(1) |
40 | 41 | scanner.set_scanner_geometry("BlocksOnCylindrical") |
41 | 42 | # scanner.set_up() |
|
91 | 92 | c = next(color_v) |
92 | 93 | tB_num2 = -1 |
93 | 94 |
|
94 | | -for v in range(0, Nv, 5): |
| 95 | +for v in range(0, Nv, 1): |
| 96 | + # TODO no clue where this comes from |
95 | 97 | tB_nim_i, tB_num_f = divmod(v / NtCpBl, 1) |
96 | 98 | tB_num = int(tB_nim_i) |
97 | 99 | bin = stir.Bin(0, v, 0, 0) |
98 | 100 |
|
99 | 101 | if tB_num > tB_num2: |
100 | 102 | c = next(color_v) |
101 | | - |
| 103 | + label = "Block %s" % tB_num |
| 104 | + else: |
| 105 | + label = "_nolegend" |
102 | 106 | tB_num2 = tB_num |
103 | 107 | b1 = proj_data_info_blocks.find_cartesian_coordinate_of_detection_1(bin) |
104 | 108 | b2 = proj_data_info_blocks.find_cartesian_coordinate_of_detection_2(bin) |
105 | 109 |
|
106 | 110 | plt.plot((b1.x(), b2.x()), (b1.y(), b2.y()), color=c) |
107 | | - plt.plot(b1.x(), b1.y(), 'o', color=c, label="Block %s - det %s" % (tB_num, v)) |
| 111 | + plt.plot(b1.x(), b1.y(), 'o', color=c, label=label) |
108 | 112 |
|
109 | | - # Shrink current axis % |
| 113 | + # Shrink current x-axis % |
110 | 114 | box = ax.get_position() |
111 | | - ax.set_position([box.x0 - box.y0 * 0.04, box.y0 + box.y0 * 0.01, box.width, box.height]) |
| 115 | + ax.set_position([box.x0 - box.x0 * 0.04, box.y0, box.width, box.height]) |
112 | 116 | ax.set_aspect('equal', 'box') |
113 | 117 | plt.legend(loc='best', bbox_to_anchor=(1., 1.), fancybox=True) |
114 | | - # plt.show() #if debugging we can se how the LORs are order |
| 118 | + # plt.show() #if debugging we can see how the LORs are order |
| 119 | +# TODO no idea labels come. Probably from HFS patient? |
115 | 120 | plt.gca().invert_yaxis() |
116 | 121 | plt.text(-65, 65, "PL") |
117 | 122 | plt.text(65, 65, "PR") |
118 | 123 | plt.text(-65, -65, "AL") |
119 | 124 | plt.text(65, -65, "AR") |
120 | | -plt.savefig('2D-2BlocksPerBuckets-ObliqueAt0degrees-XY-LOR.png', format='png', dpi=300) |
| 125 | +plt.savefig(f'2D-{scanner.get_num_transaxial_blocks_per_bucket()}BlocksPerBuckets-ObliqueAt{scanner.get_intrinsic_azimuthal_tilt()/math.pi*180}degrees-XY-LOR.png', format='png', dpi=300) |
121 | 126 | plt.show() |
122 | 127 | plt.close() |
123 | 128 |
|
|
0 commit comments