Commit e69343f20f4285eab8b27a44b983d7de96834e5b
1 parent
6a3795bd
Exists in
master
and in
68 other branches
ADD: function add points from edited image
Showing
1 changed file
with
15 additions
and
0 deletions
Show diff stats
invesalius/data/imagedata_utils.py
| ... | ... | @@ -109,3 +109,18 @@ def FixGantryTilt(imagedata, tilt): |
| 109 | 109 | imagedata.UpdateInformation() |
| 110 | 110 | |
| 111 | 111 | return imagedata |
| 112 | + | |
| 113 | + | |
| 114 | +def BuildEditedImage(imagedata, points): | |
| 115 | + """ | |
| 116 | + Editing the original image in accordance with the edit | |
| 117 | + points in the editor, it is necessary to generate the | |
| 118 | + vtkPolyData via vtkContourFilter | |
| 119 | + """ | |
| 120 | + for point in points: | |
| 121 | + x, y, z = point | |
| 122 | + colour = points[point] | |
| 123 | + imagedata.SetScalarComponentFromDouble(x, y, z, 0, colour) | |
| 124 | + imagedata.Update() | |
| 125 | + | |
| 126 | + return imagedata | ... | ... |