Contours/ROIs/RoiList

Contours

Create a contour

CreateNewROI = "Add Region Of Interest"; //This creates a blank contour with no slices

Name contour

RoiList.Current.Name = "SomeName";

Choose contour's associated dataset

//(RoiList.Current.VolumeName = Dataset Name)
RoiList.Current.VolumeName = VolumeList.#"#1".Name; //where the index # corresponds to the dataset index (0=primary, 1=secondary #1, etc)

Contour display

RoiList.Current.Display2dWithMeshCheck = "Both";//Supports other options like "Contour", "Colorwash", "Poly", "Mesh", "Off"

Contour color

RoiList.Current.Color = "blue"; //Supports generic Pinnacle colors like "red", "green", "yellow", "purple", "skyblue", etc

Clean contour

RoiList.Current.CurveMinArea = "100"; //Minimum curve area
RoiList.Current.CurveOverlapMinimum = "88"; //Minimum curve overlap
RoiList.Current.Clean = "Rescan"; //Scan for nonconforming curves
RoiList.Current.CleanAndDelete = "Delete Curves"; //Delete non-conforming curves

Destroy contour

RoiList.#"SomeContourName".Destroy=1;

ROI Expansion/Contraction/Rings

Open ROI Expand/Contract Window

  • It is not necessary to open the ROI Expand/Contract Window to alter ROIs
WindowList .RoiExpandWindow .Create = "ROI Expansion/Contraction...";

Clear all previous selections

  • This command should be run before any expansion/contraction/ring action to remove previous selections
RoiList.#"*".ResetRoiExpandState="Clear All";

Select Source

Avoid Interior

Avoid Exterior

Use constant thickness padding(1=yes, 0=no)

RoiExpandControl .UseConstantPadding = "1";
RoiExpandControl .UseConstantPadding = "0";

Thickness of padding

  • Constant thickness
//Thickness of constant padding (cm)
RoiExpandControl .ConstantPadding = " 1";
  • Variable thickness
//Direction of expansion/contraction (in cm)

//Right
RoiExpandControl .NegXPadding = "1";

//Left
RoiExpandControl .PosXPadding = "2";

//Anterior
RoiExpandControl .NegYPadding = "3";

//Posterior
RoiExpandControl .PosYPadding = "4";

//Superior
RoiExpandControl .NegZPadding = " 5";

//Inferior
RoiExpandControl .PosZPadding = "6";

Create new ROI for expansion/contraction

RoiExpandControl .CreateNewTarget = "1";
//Name of target
RoiExpandControl .TargetRoiName = "SomeContourName";

Replace an existing ROI

RoiExpandControl .TargetRoi = "SomeOtherContourName";
RoiExpandControl .CreateNewTarget = "0";

Expand the source ROI

RoiExpandControl .Expand = "1";
RoiExpandControl .DoExpand = "Expand";

Contract the source ROI

RoiExpandControl .Expand = "0";
RoiExpandControl .DoExpand = "Contract";

Create a Ring

RoiExpandControl .DoRingExpansion = "Create Ring ROI";

Examples

Constant Margin Expansion

RoiList .#"BBs".RoiExpandState = "Source";
RoiExpandControl .CheckTargetRoi = RoiList .#"BBs+2" .Address;
RoiExpandControl .ConstantPadding = " 2";
RoiExpandControl .UseConstantPadding = "1";
RoiExpandControl .TargetRoiName = "BBs+2";
RoiExpandControl .CreateNewTarget = "1";
RoiExpandControl .DoExpand = "Expand";

Contraction with Variable Margin

RoiList .#"NameOfSourceROI".RoiExpandState = "Source";
RoiExpandControl .CheckTargetRoi = RoiList .#"BBsContract" .Address;

RoiExpandControl .NegXPadding = " .1";
RoiExpandControl .UseConstantPadding = "0";
RoiExpandControl .PosXPadding = " .2";
RoiExpandControl .UseConstantPadding = "0";
RoiExpandControl .NegYPadding = " .3";
RoiExpandControl .UseConstantPadding = "0";
RoiExpandControl .PosYPadding = " .4";
RoiExpandControl .UseConstantPadding = "0";
RoiExpandControl .NegZPadding = " .5";
RoiExpandControl .UseConstantPadding = "0";
RoiExpandControl .PosZPadding = " .6";
RoiExpandControl .UseConstantPadding = "0";

RoiExpandControl .TargetRoiName = "NewROIName";
RoiExpandControl .CreateNewTarget = "1";
RoiExpandControl .Expand = "0";
RoiExpandControl .DoExpand = "Contract";

Ring

RoiList .#"BBs".RoiExpandState = "Source";  //source ROI
RoiExpandControl .CheckTargetRoi = RoiList .#"BBs+2" .Address; //New ROI to be created
RoiExpandControl .ConstantPadding = " 2"; //Expansion in cm
RoiExpandControl .UseConstantPadding = "1"; //Expand the same distance in all directions
RoiExpandControl .TargetRoiName = "BBs+2";//New target
RoiExpandControl .CreateNewTarget = "1";
RoiExpandControl .DoRingExpansion = "Create Ring ROI";//Create a ring

AutoContour

Set max and min autocontour thresholds

RoiList.Current.AutoLower = "200";
RoiList.Current.AutoUpper = "4096";

Set the boundary box

RoiList.Current.ApplyBoundingBox = 1;

//These can be used or commented out. They aren't necessary to perform the autocontour
RoiList.Current.BoundingBox.DisplayXOrigin = "-60";
RoiList .Current.BoundingBox.DisplayYOrigin = TrialList.Current.CouchRemovalYCoordinate;//Only contours above the couch removal line, this can be a number too.
RoiList.Current.BoundingBox.DisplayZOrigin = "0";
RoiList.Current.BoundingBox.Size.X = "128";
RoiList.Current.BoundingBox.Size.Y = "128";
RoiList.Current.BoundingBox.Size.Z = "38.0999";

Perform autocontour

RoiList.Current.AutoContourROI = "Current Region Of Interest";

Contour coordinates

X direction (i.e. Sagittal Orientation, Left-Right)

CT Slice

RoiList.Current.BinaryVolume.XMin;//First CT slice containing contour in X coordinate. 
RoiList.Current.BinaryVolume.XMax;//Last CT slice containing contour in X coordinate.

DICOM Coordinates (Most left and right)

////Most Left Coordinate
//Voxel size
Store.FloatAt.XMinPos = VolumeList.Current.VoxelSize.X;
//Voxel size * slice #
Store.At.XMinPos.Multiply = RoiList.Current.BinaryVolume.XMin;
//(Voxel size * slice #) + origin coordinate = position
Store.At.XMinPos.Add = VolumeList.Current.Origin.X;
//InfoMessage = Store.FloatAt.XMinPos;

////Most Right Coordinate
//Voxel size
Store.FloatAt.XMaxPos = VolumeList.Current.VoxelSize.X;
//Voxel size * slice #
Store.At.XMaxPos.Multiply = RoiList.Current.BinaryVolume.XMax;
//(Voxel size * slice #) + Origin coordinate = position
Store.At.XMaxPos.Add = VolumeList.Current.Origin.X;
//InfoMessage = Store.FloatAt.XMaxPos;

Y direction (i.e. Coronal Orientation, Ant-Post)

The Y coordinate is different from the others in that instead of providing the CT slice number, the variable contains a value equal to the #CT slices - Slice Number. In most, and maybe all, cases there are 512 slices in the CT in the Y direction. So, to find the slice number, simply subtract the number provided by Pinnacle from 512.

CT Slice

RoiList.Current.BinaryVolume.YMin;// "# of CT Slices-First CT" slice containing contour in Y direction
RoiList.Current.BinaryVolume.YMax;

DICOM Coordinate (most anterior)

Replace YMin with YMax for most posterior coordinate

//Most anterior coordinate
//Determine slice # (y slices are determined differently than X and Z)
// (512-Ymin = actual Y slice)
Store.FloatAt.YMinSlice=VolumeList.Current.Dimension.Y;
Store.At.YMinSlice.Subtract=RoiList.Current.BinaryVolume.YMin;

//Voxel size
Store.FloatAt.YMinPos = VolumeList.Current.VoxelSize.Y;
//Voxel size * slice #
Store.At.YMinPos.Multiply = Store.FloatAt.YMinSlice;
//(Voxel size * slice #) + Origin coordinate = position
Store.At.YMinPos.Add = VolumeList.Current.Origin.Y;
InfoMessage = Store.FloatAt.YMinPos;

Z direction (i.e. Transverse Orientation, Sup-Inf)

CT slice

RoiList.Current.BinaryVolume.ZMin;//First CT slice containing contour in Z coordinate.
RoiList.Current.BinaryVolume.ZMax;

DICOM Coordinate (most inferior)

Replace ZMax with Zmin for most superior coordinate

////Most inferior coordinate
//Voxel size
Store.FloatAt.ZMaxPos = VolumeList.Current.VoxelSize.Z;
//Voxel size * slice #
Store.At.ZMaxPos.Multiply = RoiList.Current.BinaryVolume.ZMax;
//(Voxel size * slice #) + Origin coordinate = position
Store.At.ZMaxPos.Add = VolumeList.Current.Origin.Z;
InfoMessage = Store.FloatAt.ZMaxPos;

Example

Set current window view to first CT slice containing the current contour.

ViewWindowList.Current.UserSliceNumber = RoiList.Current.BinaryVolume.ZMin;
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License