public void GenerateDefault()
        {
            var singlePlaneModalities = new[] { @"CR", @"DX", @"MG", @"KO" };
            var collection            = new ToolModalityBehaviorCollection();

            foreach (var modality in singlePlaneModalities)
            {
                collection[modality] = new ToolModalityBehavior
                {
                    SelectedImageWindowLevelTool        = true,
                    SelectedImageWindowLevelPresetsTool = true,
                    SelectedImageInvertTool             = true,
                    SelectedImageZoomTool   = true,
                    SelectedImagePanTool    = true,
                    SelectedImageFlipTool   = true,
                    SelectedImageRotateTool = true,
                    SelectedImageResetTool  = true
                };
            }

            using (var stream = File.Open(typeof(ToolModalityBehaviorCollection).FullName + @".default.xml", FileMode.Create))
            {
                _xmlSerializer.Serialize(stream, collection);
            }
        }
Example #2
0
		protected override void OnSettingChanging(object sender, SettingChangingEventArgs e)
		{
			if (e.SettingName == "ToolModalityBehavior")
				_cachedToolModalityBehavior = null;

			base.OnSettingChanging(sender, e);
		}
Example #3
0
        protected override void OnSettingChanging(object sender, SettingChangingEventArgs e)
        {
            if (e.SettingName == "ToolModalityBehavior")
            {
                _cachedToolModalityBehavior = null;
            }

            base.OnSettingChanging(sender, e);
        }
        public void TestRoundtripSerialization()
        {
            var collection = new ToolModalityBehaviorCollection();

            collection[@"CT"] = new ToolModalityBehavior {
                SelectedImageFlipTool = true, SelectedImagePanTool = true, SelectedImageWindowLevelPresetsTool = true
            };
            collection[@"DX"] = new ToolModalityBehavior {
                SelectedImageResetTool = true, SelectedImageInvertTool = true, SelectedImageWindowLevelTool = true
            };
            collection[null] = new ToolModalityBehavior {
                SelectedImageRotateTool = true, SelectedImageZoomTool = true
            };

            using (var stream = new MemoryStream())
            {
                _xmlSerializer.Serialize(stream, collection);

                stream.Seek(0, SeekOrigin.Begin);
                collection = _xmlSerializer.Deserialize(stream) as ToolModalityBehaviorCollection;
            }

            Assert.IsNotNull(collection);
            Assert.AreEqual(3, collection.Count);
            Assert.AreEqual(true, collection.Contains(@"CT"));
            Assert.AreEqual(true, collection.Contains(@"ct"));
            Assert.AreEqual(true, collection.Contains(@"DX"));
            Assert.AreEqual(true, collection.Contains(@""));
            Assert.AreEqual(true, collection.Contains(null));
            Assert.AreEqual(false, collection.Contains(@"XA"));

            Assert.AreEqual(true, collection[@"CT"].SelectedImageFlipTool);
            Assert.AreEqual(true, collection[@"CT"].SelectedImagePanTool);
            Assert.AreEqual(true, collection[@"CT"].SelectedImageWindowLevelPresetsTool);
            Assert.AreEqual(false, collection[@"CT"].SelectedImageResetTool);
            Assert.AreEqual(false, collection[@"CT"].SelectedImageInvertTool);

            Assert.AreEqual(true, collection[@"DX"].SelectedImageResetTool);
            Assert.AreEqual(true, collection[@"DX"].SelectedImageInvertTool);
            Assert.AreEqual(true, collection[@"DX"].SelectedImageWindowLevelTool);
            Assert.AreEqual(false, collection[@"DX"].SelectedImagePanTool);
            Assert.AreEqual(false, collection[@"DX"].SelectedImageZoomTool);

            Assert.AreEqual(true, collection[null].SelectedImageRotateTool);
            Assert.AreEqual(true, collection[@""].SelectedImageZoomTool);
            Assert.AreEqual(false, collection[null].SelectedImageWindowLevelPresetsTool);
            Assert.AreEqual(false, collection[@""].SelectedImageWindowLevelTool);
            Assert.AreEqual(false, collection[@""].SelectedImageFlipTool);
        }
Example #5
0
        public ToolConfigurationComponentControl(ToolConfigurationComponent component)
        {
            InitializeComponent();

            _component = component;

            _collection = new ToolModalityBehaviorCollection(component.ModalityBehavior);
            _collection.CollectionChanged += HandleCollectionChanged;

            var modalities = StandardModalities.Modalities.Union(new[] { string.Empty }).ToList();

            modalities.Sort(StringComparer.InvariantCultureIgnoreCase);
            var bindingSource = new BindingSource {
                DataSource = new BindingList <ToolModalityBehaviorSettings>(modalities.Select(s => new ToolModalityBehaviorSettings(_collection[s], string.IsNullOrEmpty(s) ? SR.LabelDefault : s)).ToList())
            };

            _cboModality.DataSource    = bindingSource;
            _cboModality.DisplayMember = "Modality";

            _tooltipProvider.SetToolTip(_lblSelectedImage, SR.TooltipToolAppliesToSelectedImage);
            _tooltipProvider.SetToolTip(_radWindowLevelImages, SR.TooltipToolAppliesToSelectedImage);
            _tooltipProvider.SetToolTip(_radFlipRotateImages, SR.TooltipToolAppliesToSelectedImage);
            _tooltipProvider.SetToolTip(_radZoomImages, SR.TooltipToolAppliesToSelectedImage);
            _tooltipProvider.SetToolTip(_radPanImages, SR.TooltipToolAppliesToSelectedImage);
            _tooltipProvider.SetToolTip(_radResetImages, SR.TooltipToolAppliesToSelectedImage);

            _tooltipProvider.SetToolTip(_lblEntireDisplaySet, SR.TooltipToolAppliesToEntireDisplaySet);
            _tooltipProvider.SetToolTip(_radWindowLevelDisplaySets, SR.TooltipToolAppliesToEntireDisplaySet);
            _tooltipProvider.SetToolTip(_radFlipRotateDisplaySets, SR.TooltipToolAppliesToEntireDisplaySet);
            _tooltipProvider.SetToolTip(_radZoomDisplaySets, SR.TooltipToolAppliesToEntireDisplaySet);
            _tooltipProvider.SetToolTip(_radPanDisplaySets, SR.TooltipToolAppliesToEntireDisplaySet);
            _tooltipProvider.SetToolTip(_radResetDisplaySets, SR.TooltipToolAppliesToEntireDisplaySet);

            _radWindowLevelImages.DataBindings.Add("Checked", bindingSource, "SelectedOnlyWindowLevel", false, DataSourceUpdateMode.OnPropertyChanged);
            _radFlipRotateImages.DataBindings.Add("Checked", bindingSource, "SelectedOnlyOrientation", false, DataSourceUpdateMode.OnPropertyChanged);
            _radZoomImages.DataBindings.Add("Checked", bindingSource, "SelectedOnlyZoom", false, DataSourceUpdateMode.OnPropertyChanged);
            _radPanImages.DataBindings.Add("Checked", bindingSource, "SelectedOnlyPan", false, DataSourceUpdateMode.OnPropertyChanged);
            _radResetImages.DataBindings.Add("Checked", bindingSource, "SelectedOnlyReset", false, DataSourceUpdateMode.OnPropertyChanged);

            _radWindowLevelDisplaySets.DataBindings.Add("Checked", bindingSource, "DisplaySetWindowLevel", false, DataSourceUpdateMode.OnPropertyChanged);
            _radFlipRotateDisplaySets.DataBindings.Add("Checked", bindingSource, "DisplaySetOrientation", false, DataSourceUpdateMode.OnPropertyChanged);
            _radZoomDisplaySets.DataBindings.Add("Checked", bindingSource, "DisplaySetZoom", false, DataSourceUpdateMode.OnPropertyChanged);
            _radPanDisplaySets.DataBindings.Add("Checked", bindingSource, "DisplaySetPan", false, DataSourceUpdateMode.OnPropertyChanged);
            _radResetDisplaySets.DataBindings.Add("Checked", bindingSource, "DisplaySetReset", false, DataSourceUpdateMode.OnPropertyChanged);

            _chkInvertZoomDirection.DataBindings.Add("Checked", _component, "InvertZoomDirection", false, DataSourceUpdateMode.OnPropertyChanged);
        }
		public ToolConfigurationComponentControl(ToolConfigurationComponent component)
		{
			InitializeComponent();

			_component = component;

			_collection = new ToolModalityBehaviorCollection(component.ModalityBehavior);
			_collection.CollectionChanged += HandleCollectionChanged;

			var modalities = StandardModalities.Modalities.Union(new[] {string.Empty}).ToList();
			modalities.Sort(StringComparer.InvariantCultureIgnoreCase);
			var bindingSource = new BindingSource {DataSource = new BindingList<ToolModalityBehaviorSettings>(modalities.Select(s => new ToolModalityBehaviorSettings(_collection[s], string.IsNullOrEmpty(s) ? SR.LabelDefault : s)).ToList())};

			_cboModality.DataSource = bindingSource;
			_cboModality.DisplayMember = "Modality";

			_tooltipProvider.SetToolTip(_lblSelectedImage, SR.TooltipToolAppliesToSelectedImage);
			_tooltipProvider.SetToolTip(_radWindowLevelImages, SR.TooltipToolAppliesToSelectedImage);
			_tooltipProvider.SetToolTip(_radFlipRotateImages, SR.TooltipToolAppliesToSelectedImage);
			_tooltipProvider.SetToolTip(_radZoomImages, SR.TooltipToolAppliesToSelectedImage);
			_tooltipProvider.SetToolTip(_radPanImages, SR.TooltipToolAppliesToSelectedImage);
			_tooltipProvider.SetToolTip(_radResetImages, SR.TooltipToolAppliesToSelectedImage);

			_tooltipProvider.SetToolTip(_lblEntireDisplaySet, SR.TooltipToolAppliesToEntireDisplaySet);
			_tooltipProvider.SetToolTip(_radWindowLevelDisplaySets, SR.TooltipToolAppliesToEntireDisplaySet);
			_tooltipProvider.SetToolTip(_radFlipRotateDisplaySets, SR.TooltipToolAppliesToEntireDisplaySet);
			_tooltipProvider.SetToolTip(_radZoomDisplaySets, SR.TooltipToolAppliesToEntireDisplaySet);
			_tooltipProvider.SetToolTip(_radPanDisplaySets, SR.TooltipToolAppliesToEntireDisplaySet);
			_tooltipProvider.SetToolTip(_radResetDisplaySets, SR.TooltipToolAppliesToEntireDisplaySet);

			_radWindowLevelImages.DataBindings.Add("Checked", bindingSource, "SelectedOnlyWindowLevel", false, DataSourceUpdateMode.OnPropertyChanged);
			_radFlipRotateImages.DataBindings.Add("Checked", bindingSource, "SelectedOnlyOrientation", false, DataSourceUpdateMode.OnPropertyChanged);
			_radZoomImages.DataBindings.Add("Checked", bindingSource, "SelectedOnlyZoom", false, DataSourceUpdateMode.OnPropertyChanged);
			_radPanImages.DataBindings.Add("Checked", bindingSource, "SelectedOnlyPan", false, DataSourceUpdateMode.OnPropertyChanged);
			_radResetImages.DataBindings.Add("Checked", bindingSource, "SelectedOnlyReset", false, DataSourceUpdateMode.OnPropertyChanged);

			_radWindowLevelDisplaySets.DataBindings.Add("Checked", bindingSource, "DisplaySetWindowLevel", false, DataSourceUpdateMode.OnPropertyChanged);
			_radFlipRotateDisplaySets.DataBindings.Add("Checked", bindingSource, "DisplaySetOrientation", false, DataSourceUpdateMode.OnPropertyChanged);
			_radZoomDisplaySets.DataBindings.Add("Checked", bindingSource, "DisplaySetZoom", false, DataSourceUpdateMode.OnPropertyChanged);
			_radPanDisplaySets.DataBindings.Add("Checked", bindingSource, "DisplaySetPan", false, DataSourceUpdateMode.OnPropertyChanged);
			_radResetDisplaySets.DataBindings.Add("Checked", bindingSource, "DisplaySetReset", false, DataSourceUpdateMode.OnPropertyChanged);

			_chkInvertZoomDirection.DataBindings.Add("Checked", _component, "InvertZoomDirection", false, DataSourceUpdateMode.OnPropertyChanged);
		}
		public void GenerateDefault()
		{
			var singlePlaneModalities = new[] {@"CR", @"DX", @"MG", @"KO"};
			var collection = new ToolModalityBehaviorCollection();
			foreach (var modality in singlePlaneModalities)
			{
				collection[modality] = new ToolModalityBehavior
				                       	{
				                       		SelectedImageWindowLevelTool = true,
				                       		SelectedImageWindowLevelPresetsTool = true,
				                       		SelectedImageInvertTool = true,
				                       		SelectedImageZoomTool = true,
				                       		SelectedImagePanTool = true,
				                       		SelectedImageFlipTool = true,
				                       		SelectedImageRotateTool = true,
				                       		SelectedImageResetTool = true
				                       	};
			}

			using (var stream = File.Open(typeof (ToolModalityBehaviorCollection).FullName + @".default.xml", FileMode.Create))
			{
				_xmlSerializer.Serialize(stream, collection);
			}
		}
		public void TestRoundtripSerialization()
		{
			var collection = new ToolModalityBehaviorCollection();
			collection[@"CT"] = new ToolModalityBehavior {SelectedImageFlipTool = true, SelectedImagePanTool = true, SelectedImageWindowLevelPresetsTool = true};
			collection[@"DX"] = new ToolModalityBehavior {SelectedImageResetTool = true, SelectedImageInvertTool = true, SelectedImageWindowLevelTool = true};
			collection[null] = new ToolModalityBehavior {SelectedImageRotateTool = true, SelectedImageZoomTool = true};

			using (var stream = new MemoryStream())
			{
				_xmlSerializer.Serialize(stream, collection);

				stream.Seek(0, SeekOrigin.Begin);
				collection = _xmlSerializer.Deserialize(stream) as ToolModalityBehaviorCollection;
			}

			Assert.IsNotNull(collection);
			Assert.AreEqual(3, collection.Count);
			Assert.AreEqual(true, collection.Contains(@"CT"));
			Assert.AreEqual(true, collection.Contains(@"ct"));
			Assert.AreEqual(true, collection.Contains(@"DX"));
			Assert.AreEqual(true, collection.Contains(@""));
			Assert.AreEqual(true, collection.Contains(null));
			Assert.AreEqual(false, collection.Contains(@"XA"));

			Assert.AreEqual(true, collection[@"CT"].SelectedImageFlipTool);
			Assert.AreEqual(true, collection[@"CT"].SelectedImagePanTool);
			Assert.AreEqual(true, collection[@"CT"].SelectedImageWindowLevelPresetsTool);
			Assert.AreEqual(false, collection[@"CT"].SelectedImageResetTool);
			Assert.AreEqual(false, collection[@"CT"].SelectedImageInvertTool);

			Assert.AreEqual(true, collection[@"DX"].SelectedImageResetTool);
			Assert.AreEqual(true, collection[@"DX"].SelectedImageInvertTool);
			Assert.AreEqual(true, collection[@"DX"].SelectedImageWindowLevelTool);
			Assert.AreEqual(false, collection[@"DX"].SelectedImagePanTool);
			Assert.AreEqual(false, collection[@"DX"].SelectedImageZoomTool);

			Assert.AreEqual(true, collection[null].SelectedImageRotateTool);
			Assert.AreEqual(true, collection[@""].SelectedImageZoomTool);
			Assert.AreEqual(false, collection[null].SelectedImageWindowLevelPresetsTool);
			Assert.AreEqual(false, collection[@""].SelectedImageWindowLevelTool);
			Assert.AreEqual(false, collection[@""].SelectedImageFlipTool);
		}
Example #9
0
        protected override void OnSettingsLoaded(object sender, SettingsLoadedEventArgs e)
        {
            _cachedToolModalityBehavior = null;

            base.OnSettingsLoaded(sender, e);
        }
Example #10
0
		protected override void OnSettingsLoaded(object sender, SettingsLoadedEventArgs e)
		{
			_cachedToolModalityBehavior = null;

			base.OnSettingsLoaded(sender, e);
		}