Skip to content

Commit

Permalink
Merge pull request #2 from paradim-platform/feature/from-coordinates
Browse files Browse the repository at this point in the history
Use ImagePositionPatient rather than SliceLocation
  • Loading branch information
gacou54 authored Apr 22, 2024
2 parents 58f8a6a + 0eab595 commit ee6199a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@ rtstruct.add_roi(
name="RT-Utils ROI!"
)

# Add another ROI from coordinates
rtstruct.add_roi_from_coordinates(
coordinates=[
[
# Example of One contour on one slice
[-20.0, -170.0, -559.0],
[30.0, -170.0, -559.0],
[30.0, -110.0, -559.0],
[-20.0, -110.0, -559.0],
],
[
[-20.0, -170.0, -562.4],
[30.0, -170.0, -562.4],
[30.0, -110.0, -562.4],
[-20.0, -110.0, -562.4],
]
]
)

rtstruct.save('new-rt-struct')
```

Expand Down
2 changes: 1 addition & 1 deletion rt_utils/ds_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,4 @@ def get_contour_sequence_by_roi_number(ds, roi_number):


def _find_closest_slice(series_slices: List[Dataset], z_coord: float) -> Dataset:
return min(series_slices, key=lambda series_slice: abs(series_slice.SliceLocation - z_coord))
return min(series_slices, key=lambda series_slice: abs(series_slice.ImagePositionPatient[2] - z_coord))

0 comments on commit ee6199a

Please sign in to comment.