public void MergeResult(LargeSeededGrowResult lsg, SpanFillResult ret) { lsg.resultSet.AddRange(ret.resultSet); lsg.Count += ret.resultCount; }
public void ExecuteSeededGrow(Int16Triple firstseed) { if (buffer == null || seedGrowExecutor == null || dataProvider == null) throw new Exception(); SpanFillInput input = new SpanFillInput(); SpanFillResult ret = new SpanFillResult(); resultSum = new LargeSeededGrowResult(); queue = new Container_Stack<Block>(); Block firstB = GetFirstBlock(firstseed); BlockIR_SP firstBir = GetBlockIR(firstB.indexX, firstB.indexY, firstB.indexZ); firstBir.singleSeed = ConvertGlobalCoodToBlockCoord(firstB, firstseed); queue.Push(firstB); while (!queue.Empty()) { Block block = queue.Pop(); block.VisitedCount++; BlockIR_SP bir = GetBlockIR(block.indexX, block.indexY, block.indexZ); FillBlockData(block); MarshalInputAndOutput(input, ret, block, bir); seedGrowExecutor.ExecuteSeededGrow(input, ret); if (input.GetIsFirst()) bir.singleSeed = new Int16Triple(-1, -1, -1); ConvertBlockCoordsToGlobalCoords(block, ret.resultSet); MergeResult(resultSum, ret); for (int i = 0; i < 2;i++ ) { if (ret.GetNeedsToSeekX(i)) { Block t = image.GetBlock(block.indexX + AdX[i].X, block.indexY, block.indexZ); if (t.VisitedCount < 1) { ConvertThisBlockCoordsToOtherBlockCoords(block, t, ret.boundaryPoints_X[i]); BlockIR_SP tbir = GetBlockIR(t.indexX, t.indexY, t.indexZ); List<Int16Triple> oppInput = tbir.boundarySeedXsInside[OppositePos_X[i]]; if (oppInput != null && oppInput.Count != 0) { oppInput.AddRange(ret.boundaryPoints_X[i]); ret.boundaryPoints_X[i].Clear(); tbir.boundarySeedXsInside[OppositePos_X[i]] = oppInput; } else { oppInput = ret.boundaryPoints_X[i]; ret.boundaryPoints_X[i] = new List<Int16Triple>(); tbir.boundarySeedXsInside[OppositePos_X[i]] = oppInput; } queue.Push(t); } else { ret.boundaryPoints_X[i].Clear(); } } } for (int i = 0; i < 4; i++) { if (ret.GetNeedsToSeekYZ(i)) { Block t = image.GetBlock(block.indexX, block.indexY + AdYZ[i].Y, block.indexZ + AdYZ[i].Z); if (t.VisitedCount < 1000) { ConvertThisBlockRangesToOtherBlockRanges(block, t, ret.boundaryRanges_YZ[i]); BlockIR_SP tbir = GetBlockIR(t.indexX, t.indexY, t.indexZ); List<Range> oppInput = tbir.boundaryRangesYZInside[OppositePos_YZ[i]]; if (oppInput != null && oppInput.Count != 0) { oppInput.AddRange(ret.boundaryRanges_YZ[i]); ret.boundaryRanges_YZ[i].Clear(); tbir.boundaryRangesYZInside[OppositePos_YZ[i]] = oppInput; } else { oppInput = ret.boundaryRanges_YZ[i]; ret.boundaryRanges_YZ[i] = new List<Range>(); tbir.boundaryRangesYZInside[OppositePos_YZ[i]] = oppInput; } queue.Push(t); } else { ret.boundaryRanges_YZ[i].Clear(); } } } input.ClearAll(); } ClearTail(); }