// After applying display changes (zoom, windowing, scrolling etc.), save presentation state.
bool usePrivate = true;
Viewer.CurrentImage.CurrentToPresentationState(Viewer, usePrivate); // Assumes an existing DicomViewer Object
Viewer.CurrentImage.PresentationState.Write("Output_PresentationState.dcm", TransferSyntaxes.ExplicitVRLittleEndian);
// Example: Applying the presentation state
DicomDataSet ps = new DicomDataSet("Output_PresentationState.dcm");
Viewer.CurrentImage.PresentationState = ps;