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
ORGAN
CAVITY
AVOIDANCE
EXTERNAL
SUPPORT
CONTROL
FIXATION
DOSE_REGION
TREATED_VOLUME
CONTRAST_AGENT
IRRAD_VOLUME
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.
Comments