Esempio n. 1
0
        public void Append(ContoursPerSlice newContours)
        {
            lock (_lock)
            {
                if (newContours == null || !newContours.Any())
                {
                    Clear();
                    return;
                }

                foreach (var newContour in newContours)
                {
                    if (newContour.Value.Count > 0)
                    {
                        _contoursBySliceDictionary[newContour.Key] = newContour.Value;
                    }
                    else
                    {
                        _contoursBySliceDictionary.Remove(newContour.Key);
                    }
                }

                CollectionChanged?.Invoke(
                    this,
                    new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
            }
        }
Esempio n. 2
0
        public void Replace(ContoursPerSlice newContours)
        {
            lock (_lock)
            {
                _contoursBySliceDictionary.Clear();
                if (newContours != null)
                {
                    foreach (var newContour in newContours)
                    {
                        if (newContour.Value.Count > 0)
                        {
                            _contoursBySliceDictionary[newContour.Key] = newContour.Value;
                        }
                        else
                        {
                            _contoursBySliceDictionary.Remove(newContour.Key);
                        }
                    }
                }

                CollectionChanged?.Invoke(
                    this,
                    new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Modifies the present volume by filling all points that fall inside of the given contours,
 /// using the provided fill value. Contours are filled on axial slices.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="volume">The volume that should be modified.</param>
 /// <param name="contours">The contours per axial slice.</param>
 /// <param name="value">The value that should be used to fill all points that fall inside of
 /// the given contours.</param>
 public static void FillContours <T>(Volume3D <T> volume, ContoursPerSlice contours, T value)
 {
     foreach (var contourPerSlice in contours)
     {
         foreach (var contour in contourPerSlice.Value)
         {
             Fill(contour.ContourPoints, volume.Array, volume.DimX, volume.DimY, volume.DimZ, contourPerSlice.Key, value);
         }
     }
 }