VarianAPIs / Varian-Code-Samples

Code samples for ESAPI and other Varian APIs and web services.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is two structures overlap?

yvsblanc opened this issue · comments

Is there a way to know if two Structures overlaps. I can use St.AND () using "SegmentVolume", but then how do I know if the result is empty? (That's what I could do with structures but then I can't use boolean...).

Have you tried checking the Volume of the structure resulting from the Boolean AND?

There is also an Structure bool „IsEmpty“ that is easy to check

I cant'check the volume because the result is a SegmentVolume and not a structure,
Then I can't either use the "IsEmpty" method

No.
You use SegmentVolume on a Structure and can exchange this for „IsEmpty“.

example:
var saumstructure = ss.AddStructure(„PTV“, saumId);
saumstructure.SegmentVolume = ptv.Sub(saumstructure);
if (saumstructure.IsEmpty)
blaBlaBlup

Thank you,
I'll try this

And for everyone that want to check Overlap in a Single-File-Plugin or do not have Writable scripts because of older Eclipse-Version or because of Rights-issues or because it is simpler to use. Please check out this link:

https://github.com/mtparagon5/ESAPI-Projects/blob/2a65eb5e6112276708083fbedf72ad4268dc64cc/Plugins/DvhLookups_v07.cs#L234

Very very helpful functions for ESAPI beginners but this link brings you exactly to Calculate Overlap methods. Simple Copy&Paste and you can use these methods in all your scripts.
I have something similar but this is the base I found a few years ago and use it in some form till today.