protected void DeserializeDisplayShutter(DisplayShutterModuleIod displayShutterModule, T image)
        {
            ShutterShape shape = displayShutterModule.ShutterShape;

            if (shape != ShutterShape.Bitmap && shape != ShutterShape.None)
            {
                IShutterGraphic shutter = DicomGraphicsFactory.CreateGeometricShuttersGraphic(displayShutterModule, image.Frame.Rows, image.Frame.Columns);
                // Some day, we will properly deserialize CIELab colours - until then, leave PresentationColor default black

                DicomGraphicsPlane dicomGraphicsPlane = DicomGraphicsPlane.GetDicomGraphicsPlane(image, true);
                dicomGraphicsPlane.Shutters.Add(shutter);
                dicomGraphicsPlane.Shutters.Activate(shutter);
            }
        }
        protected void SerializeDisplayShutter(DisplayShutterModuleIod displayShutterModule, DicomPresentationImageCollection <T> images)
        {
            // Doesn't support multiframe or whatever case it is when we get more than one image serialized to one state
            CircularShutter    circular    = null;
            RectangularShutter rectangular = null;
            PolygonalShutter   polygonal   = null;
            int unserializedCount          = 0;

            foreach (T image in images)
            {
                DicomGraphicsPlane dicomGraphics = DicomGraphicsPlane.GetDicomGraphicsPlane(image, false);
                if (dicomGraphics != null)
                {
                    // identify visible geometric shutter if exists
                    GeometricShuttersGraphic geometricShutters = dicomGraphics.Shutters.ActiveShutter as GeometricShuttersGraphic;
                    if (geometricShutters != null)
                    {
                        // we can only save the first of each
                        foreach (GeometricShutter shutter in geometricShutters.CustomShutters)
                        {
                            if (shutter is CircularShutter && circular == null)
                            {
                                circular = (CircularShutter)shutter;
                            }
                            else if (shutter is RectangularShutter && rectangular == null)
                            {
                                rectangular = (RectangularShutter)shutter;
                            }
                            else if (shutter is PolygonalShutter && polygonal == null)
                            {
                                polygonal = (PolygonalShutter)shutter;
                            }
                            else
                            {
                                unserializedCount++;
                            }
                        }
                        foreach (GeometricShutter shutter in geometricShutters.DicomShutters)
                        {
                            if (shutter is CircularShutter && circular == null)
                            {
                                circular = (CircularShutter)shutter;
                            }
                            else if (shutter is RectangularShutter && rectangular == null)
                            {
                                rectangular = (RectangularShutter)shutter;
                            }
                            else if (shutter is PolygonalShutter && polygonal == null)
                            {
                                polygonal = (PolygonalShutter)shutter;
                            }
                            else
                            {
                                unserializedCount++;
                            }
                        }
                    }
                }
            }

            ShutterShape shape = ShutterShape.None;

            if (circular != null)
            {
                shape |= ShutterShape.Circular;

                displayShutterModule.CenterOfCircularShutter = circular.Center;
                displayShutterModule.RadiusOfCircularShutter = circular.Radius;
            }
            if (rectangular != null)
            {
                shape |= ShutterShape.Rectangular;

                Rectangle r = rectangular.Rectangle;
                displayShutterModule.ShutterLeftVerticalEdge    = r.Left;
                displayShutterModule.ShutterRightVerticalEdge   = r.Right;
                displayShutterModule.ShutterUpperHorizontalEdge = r.Top;
                displayShutterModule.ShutterLowerHorizontalEdge = r.Bottom;
            }
            if (polygonal != null)
            {
                shape |= ShutterShape.Polygonal;

                List <Point> vertices = new List <Point>();
                vertices.AddRange(polygonal.Vertices);
                displayShutterModule.VerticesOfThePolygonalShutter = vertices.ToArray();
            }

            if (shape != ShutterShape.None)
            {
                displayShutterModule.ShutterShape             = shape;
                displayShutterModule.ShutterPresentationValue = 0;
            }
            else
            {
                foreach (uint tag in DisplayShutterMacroIod.DefinedTags)
                {
                    displayShutterModule.DicomAttributeProvider[tag] = null;
                }
            }

            if (unserializedCount > 0)
            {
                Platform.Log(LogLevel.Warn, "Attempt to serialize presentation state with an unsupported combination of shutters - some information may be lost.");
            }
        }