top of page

Determine Whether a Structure Is a Target or an Organ

There may are cases where you need to know whether a structure is a target, an organ, or something else. For example, you may want to calculate the NTCP for organs, TCP for targets, and ignore everything else.

As another example, when calculating biological dose metrics, you may want to apply a different α/β parameter for organs and targets.

In ESAPI, the Structure class has the string property DicomType, which may be any of the following (according to the documentation):

  • GTV

  • CTV

  • PTV












A structure is a target if it's a GTV, CTV, or PTV, so the following method tests whether the given structure is a target:

public bool IsTarget(Structure s)
    return s.DicomType == "GTV" || s.DicomType == "CTV" || s.DicomType == "PTV";

For convenience, you can turn this method into an extension method (see Enhance ESAPI with Extension Methods).

The following method tests whether the given structure is an organ:

public bool IsOrgan(Structure s)
    return s.DicomType == "ORGAN";

If you want to ignore anything that's not a target or an organ, you can use the following method:

public bool IsOther(Structure s)
    return !IsTarget(s) && !IsOrgan(s);

Note that in English, I said "not a target or an organ," but in Boolean logic this translates to "not a target and not an organ." If I had used or instead, the method would return true for an organ. The reason is that the !IsTarget(s) test is true for an organ, and true or anything is always true.

Related Posts

See All

A few months ago, I introduced ESAPI Essentials—a toolkit for working with ESAPI (available via NuGet). I've recently added one major feature: asynchronous access to ESAPI for binary plugin scripts. Y

A few months ago, Matt Schmidt started the ESAPI subreddit. It's another useful resource for finding and discussing ESAPI-related topics. According to the description, This community is to post and di

If, for whatever reason, you need to dump out all of the data for a patient from ESAPI, there's a quick and dirty way to do it. Well, there are probably several ways to do it, but here's one I've foun

bottom of page