本文整理汇总了C#中Structure.IsPointInsideSegment方法的典型用法代码示例。如果您正苦于以下问题:C# Structure.IsPointInsideSegment方法的具体用法?C# Structure.IsPointInsideSegment怎么用?C# Structure.IsPointInsideSegment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Structure
的用法示例。
在下文中一共展示了Structure.IsPointInsideSegment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSliceArea
/// <summary>
/// Calculates the slice area inside of a contour definition for a given slice Z
/// </summary>
private static double GetSliceArea(Image image, int sliceZ, Structure psoas)
{
var area = double.NaN;
var contour = psoas.GetContoursOnImagePlane(sliceZ);
if (contour.Count() > 0)
{
var inside = 0;
for (int x = 0; x < image.XSize; x++)
{
for (int y = 0; y < image.XSize; y++)
{
var dx = (x * image.XRes * image.XDirection + image.Origin).x;
var dy = (y * image.YRes * image.YDirection + image.Origin).y;
var dz = (sliceZ * image.ZRes * image.ZDirection + image.Origin).z;
if (psoas.IsPointInsideSegment(new VVector(dx, dy, dz)))
{
inside++;
}
}
}
var vxArea = image.XRes / 10 * image.YRes / 10;
var contourArea = inside * vxArea;
area = contourArea;
}
return area;
}
示例2: GetSliceHUAvg
/// <summary>
/// For a given slice, and structure this will return the average hounsfield unit inside the contour
/// </summary>
private static double GetSliceHUAvg(Image image, int sliceZ, Structure structr)
{
var contour = structr.GetContoursOnImagePlane(sliceZ);
if (contour.Count() > 0)
{
int[,] buffer = new int[image.XSize, image.YSize];
List<double> hus = new List<double>();
image.GetVoxels(sliceZ, buffer);
for (int x = 0; x < image.XSize; x++)
{
for (int y = 0; y < image.XSize; y++)
{
var dx = (x * image.XRes * image.XDirection + image.Origin).x;
var dy = (y * image.YRes * image.YDirection + image.Origin).y;
var dz = (sliceZ * image.ZRes * image.ZDirection + image.Origin).z;
if (structr.IsPointInsideSegment(new VVector(dx, dy, dz)))
{
var voxel = buffer[x, y];
hus.Add(image.VoxelToDisplayValue(voxel));
}
}
}
return hus.Average();
}
return double.NaN;
}