コード例 #1
0
        public void ExecuteSeededGrow(Int16Triple firstseed)
        {
            if (buffer == null || seedGrowExecutor == null || dataProvider == null)
            {
                throw new Exception();
            }
            queue = new Container_Stack <LayerDataAndInput>();
            Layer         firstLayer = GetFirstLayer(firstseed);
            SpanFillInput firstInput = new SpanFillInput
                                           (buffer, firstLayer.AllWidth, firstLayer.AllHeight, firstLayer.actualDepth, firstLayer.GetAndInitFlag(),
                                           new List <Range>(), ConvertGlobalCoodToLayerCoold(firstLayer, firstseed), firstLayer.HasUpperLayer(), firstLayer.HasLowerLayer(), true);

            queue.Push(new LayerDataAndInput(firstLayer, firstInput));
            while (!queue.Empty())
            {
                LayerDataAndInput sgi   = queue.Pop();
                Layer             layer = sgi.layer;
                layer.visitcount++;
                SpanFillInput input = sgi.input;
                FillLayerData(layer);
                SpanFillResult ret1 = seedGrowExecutor.ExecuteSeededGrow(input);
                input.spanlist.Clear();
                //ConvertLayerCoordsToGlobalCoords(layer,ret1.resultPointSet);
                // resultSet.AddRange(ret1.resultPointSet);
                resultCount += ret1.resultCount;
                if (ret1.GetNeedsSeekLower())
                {
                    Layer lowerlayer = image.GetLayer(layer.indexZ - 1);
                    if (lowerlayer == null)
                    {
                        ret1.boundaryRequestPoints[0].Clear();
                        continue;
                    }
                    ConvertOtherLayerCoordsToThisLayerCoords(layer, lowerlayer, ret1.boundaryRequestPoints[0]);
                    SpanFillInput newinput = new SpanFillInput
                                                 (buffer, lowerlayer.AllWidth, lowerlayer.AllHeight, lowerlayer.actualDepth, lowerlayer.GetAndInitFlag(),
                                                 ret1.boundaryRequestPoints[0], input.seed, lowerlayer.HasUpperLayer(), lowerlayer.HasLowerLayer(), false);
                    queue.Push(new LayerDataAndInput(lowerlayer, newinput));
                }
                if (ret1.GetNeedsSeekUpper())
                {
                    Layer upperlayer = image.GetLayer(layer.indexZ + 1);
                    if (upperlayer == null)
                    {
                        ret1.boundaryRequestPoints[1].Clear();
                        continue;
                    }
                    ConvertOtherLayerCoordsToThisLayerCoords(layer, upperlayer, ret1.boundaryRequestPoints[1]);
                    SpanFillInput newinput = new SpanFillInput
                                                 (buffer, upperlayer.AllWidth, upperlayer.AllHeight, upperlayer.actualDepth, upperlayer.GetAndInitFlag(),
                                                 ret1.boundaryRequestPoints[1], input.seed, upperlayer.HasUpperLayer(), upperlayer.HasLowerLayer(), false);
                    queue.Push(new LayerDataAndInput(upperlayer, newinput));
                }
            }
        }
コード例 #2
0
 public LayerDataAndInput(Layer layer, SpanFillInput input)
 {
     this.layer = layer;
     this.input = input;
 }