示例#1
0
        // check each point on the image grid, and store the indices only
        static List <int> GetInterior(VMS.TPS.Common.Model.API.Image dose, VMS.TPS.Common.Model.API.Structure st)
        {
            List <int> result    = new List <int>();
            VVector    p         = new VVector();
            Rect3D     st_bounds = st.MeshGeometry.Bounds;

            for (int z = 0; z < dose.ZSize; ++z)
            {
                for (int y = 0; y < dose.YSize; ++y)
                {
                    for (int x = 0; x < dose.XSize; ++x)
                    {
                        p.x = x * dose.XRes;
                        p.y = y * dose.YRes;
                        p.z = z * dose.ZRes;

                        p = p + dose.Origin;

                        if (st_bounds.Contains(p.x, p.y, p.z) && // trimming
                            st.IsPointInsideSegment(p))    // this is an expensive call
                        {
                            int[,] voxels = new int[dose.XSize, dose.YSize];
                            dose.GetVoxels(z, voxels);
                            result.Add(voxels[x, y]);
                        }
                    }
                }
                GC.Collect(); // do this to avoid time out
                GC.WaitForPendingFinalizers();
            }

            return(result);
        }
        public ESAPIStructureViewModel(v.Structure structure)
        {
            if (structure == null)
            {
                throw new ArgumentNullException("structure");
            }

            _apidataobject = structure;

            Properties.Add(new Property("Id", structure.Id));
            Properties.Add(new Property("Volume", String.Format("{0:.0}", structure.Volume)));
        }