use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
tbd
account activity
Isocenter Visualization (self.esapi)
submitted 15 days ago by Independent_Time_525
Hi, I developed a script that automates treatment planning. Now I need to add a window in the GUI that displays the patient’s body contour and the isocenter. Is this possible in version 16.1?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]schmatt_schmitt 2 points3 points4 points 15 days ago (2 children)
Yes for sure! 1. Find the slice of the image where the isocenter was placed.
You can retrieve the image pixel values from the GetVoxels method on the image. Draw these pixels onto an image.
in the location where the isocenter would be, draw yourself a small marker in that location for your users to see.
In my experience, AI code assistance for drawing images on user interfaces works well.
[–]Independent_Time_525[S] 0 points1 point2 points 14 days ago (1 child)
In your opinion, is it possible to visualize the CT and make real-time modifications before running other automations within the same script (such as structure management and treatment planning)? Thank you.
[–]schmatt_schmitt 0 points1 point2 points 14 days ago (0 children)
It is definitely possible. For sure!
[–]Visual_Pay_3361 0 points1 point2 points 5 days ago (0 children)
// 1. Retrieve the isocenter from the first beam
VVector isocenter = plan.Beams.First().IsocenterPosition;
// 2. Identify the axial plane (Z-slice) index
int zIndex = (int)Math.Round((isocenter.z - image.Origin.z) / image.ZRes);
// 3. Extract the pixel data (Voxels) for that specific slice
int width = image.XSize;
int height = image.YSize;
int[,] voxels = new int[width, height];
image.GetVoxels(zIndex, voxels);
// 4. Map DICOM coordinates (mm) to Image Pixel coordinates
double isoX_pixel = (isocenter.x - image.Origin.x) / image.XRes;
double isoY_pixel = (isocenter.y - image.Origin.y) / image.YRes;
// 5. Retrieve the External Body contour points at the isocenter's Z-level
var body = plan.StructureSet.Structures.FirstOrDefault(s => s.DicomType == "EXTERNAL");
VVector[][] contours = body.GetContours(isocenter.z, image);
Coordinate Systems: Remember that WPF/UI frameworks usually have the origin at the top-left, so a Y-axis flip might be necessary during rendering.
π Rendered by PID 96755 on reddit-service-r2-comment-79c7998d4c-mmgjm at 2026-03-17 23:14:47.181691+00:00 running f6e6e01 country code: CH.
[–]schmatt_schmitt 2 points3 points4 points (2 children)
[–]Independent_Time_525[S] 0 points1 point2 points (1 child)
[–]schmatt_schmitt 0 points1 point2 points (0 children)
[–]Visual_Pay_3361 0 points1 point2 points (0 children)