Skip to content

Commit 50abb5a

Browse files
committed
PortPy Version 1.2.0
1. Add beamlet dose prediction module to portpy.ai 2. create example notebook for it 3. Add scorecard to evaluation.py 4. Update vmat scp to latest version with bug fixes. 5. Make dose prediction module site independent Minor changes. Enhance project structure and functionality: - Update .gitignore to include new data directories. - Modify __init__.py to import scorecard functions. - Adjust test assertions for expected solution values. - Refine optimization.py to use np.inf for max constraints. - Update pred_dose_to_original_portpy.py for improved plan initialization. - Revise requirements.txt for updated package versions. - Enhance single_dataset.py and dosepred3d_dataset.py to handle additional data fields. - Add new optimization parameters in optimization_params_Prostate_5Gy_5Fx_vmat.json.
1 parent d86931d commit 50abb5a

2 files changed

Lines changed: 5 additions & 16 deletions

File tree

portpy/photon/structures.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,10 @@ def expand(self, struct_name: str = None, margin_mm: float = None, new_struct_na
194194

195195
# getting kernel size for expansion or shrinking
196196
if margin_mm > 0:
197-
# num_voxels = np.round(margin_mm / np.asarray(self._ct_voxel_resolution_xyz_mm)).astype(int)
198-
res_xyz = np.asarray(self._ct_voxel_resolution_xyz_mm)
199-
res_zyx = res_xyz[[2, 1, 0]]
200-
num_voxels = np.round(margin_mm / res_zyx).astype(int)
201-
num_voxels = np.maximum(num_voxels, 1)
197+
num_voxels = np.maximum(np.round(margin_mm / np.asarray(self._ct_voxel_resolution_xyz_mm)).astype(int), 1)
202198
kernel = ndimage.generate_binary_structure(rank=3, connectivity=2) # ball kernel
203199
# creating different iterations along z and xy directions
204-
ratio = num_voxels[0] / num_voxels[2] if num_voxels[2] > 0 else 1
205-
num_iterations = max(1, int(np.round(ratio)))
200+
num_iterations = max(1, int(num_voxels[0] / num_voxels[2]))
206201
iterations_in_one_step = max(1, int(np.round(num_voxels[0] / num_iterations)))
207202
# margin_mask_3d = ndimage.binary_dilation(mask_3d, struct_name=struct).astype(mask_3d.dtype)
208203
for i in range(num_iterations):
@@ -246,16 +241,10 @@ def shrink(self, struct_name: str = None, margin_mm: float = None, new_struct_na
246241

247242

248243
# getting kernel size for expansion or shrinking
249-
250-
# num_voxels = np.round(margin_mm / np.asarray(self._ct_voxel_resolution_xyz_mm)).astype(int)
251-
res_xyz = np.asarray(self._ct_voxel_resolution_xyz_mm)
252-
res_zyx = res_xyz[[2, 1, 0]]
253-
num_voxels = np.round(margin_mm / res_zyx).astype(int)
254-
num_voxels = np.maximum(num_voxels, 1)
244+
num_voxels = np.maximum(np.round(margin_mm / np.asarray(self._ct_voxel_resolution_xyz_mm)).astype(int), 1)
255245
struct = ndimage.generate_binary_structure(rank=3, connectivity=2) # ball kernel
256246
# creating different iterations along z and xy directions
257-
ratio = num_voxels[0] / num_voxels[2] if num_voxels[2] > 0 else 1
258-
num_iterations = max(1, int(np.round(ratio)))
247+
num_iterations = max(1, int(num_voxels[0] / num_voxels[2]))
259248
iterations_in_one_step = max(1, int(np.round(num_voxels[0] / num_iterations)))
260249
for i in range(num_iterations):
261250
if i == 0:

tests/test_basic_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def test_plan_creation(plan_and_solution):
7272
assert hasattr(plan, "beams")
7373
assert len(plan.beams.get_all_beam_ids()) > 0
7474
assert sol is not None
75-
assert np.isclose(sol['obj_value'], 84.71, rtol=0.01)
75+
assert np.isclose(sol['obj_value'], 54.50, rtol=0.01)
7676

7777

7878
def test_visualization_methods(plan_and_solution):

0 commit comments

Comments
 (0)