public PresetVoiLutGroupCollection GetPresetGroups()
        {
            if (_presetGroups != null)
            {
                return(_presetGroups);
            }

            _presetGroups = new PresetVoiLutGroupCollection();

            XmlDocument document = new XmlDocument();

            document.LoadXml(this.SettingsXml);

            XmlNodeList groupNodes = document.SelectNodes("//group");

            foreach (XmlElement groupNode in groupNodes)
            {
                PresetVoiLutGroup group = DeserializeGroup(groupNode);
                if (group != null && !_presetGroups.Contains(group))
                {
                    _presetGroups.Add(group);
                }
            }

            return(_presetGroups);
        }
Ejemplo n.º 2
0
        public override void Start()
        {
            InitializeAddFactories();
            _selectedAddFactory = new PresetFactoryDescriptor(PresetVoiLutOperationFactories.GetFactory(LinearPresetVoiLutOperationFactory.FactoryName));

            _voiLutPresets = new Table <PresetVoiLut>();

            _availableModalities = new List <string>(StandardModalities.Modalities);
            _availableModalities.Sort();

            _presetVoiLutGroups = PresetVoiLutSettings.DefaultInstance.GetPresetGroups().Clone();

            foreach (string modality in _availableModalities)
            {
                if (!_presetVoiLutGroups.Contains(new PresetVoiLutGroup(modality)))
                {
                    _presetVoiLutGroups.Add(new PresetVoiLutGroup(modality));
                }
            }

            _presetVoiLutGroups.Sort();

            _selectedPresetVoiLutGroup = _presetVoiLutGroups[0];

            InitializeMenuAndToolbar();
            InitializeTable();
            PopulateTable();

            Selection = null;

            base.Start();
        }
        private PresetVoiLutGroup DeserializeGroup(XmlElement groupNode)
        {
            PresetVoiLutGroup group = new PresetVoiLutGroup(groupNode.GetAttribute("modality"));

            XmlNodeList presetNodes = groupNode.SelectNodes("presets/preset");

            DeserializeGroupPresets(group.Presets, presetNodes);

            if (group.Presets.Count == 0)
            {
                group = null;
            }

            return(group);
        }