Exemple #1
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            try
            {
                ConfigurationEditorDialog    dlg;
                PlaneOrientation             orientation;
                TagValueOrientationCondition condition;

                if (comboBoxConfigs.SelectedIndex < 0)
                {
                    return;
                }

                dlg         = new ConfigurationEditorDialog(true);
                orientation = comboBoxConfigs.SelectedItem as PlaneOrientation;

                if (null != orientation.Condition)
                {
                    condition = ( TagValueOrientationCondition )orientation.Condition;
                }
                else
                {
                    condition = new TagValueOrientationCondition( );
                }

                dlg.ConfigurationName = orientation.Name;
                dlg.DicomTag          = GetTag(condition.Tag);
                dlg.TagValue          = condition.TagValue;

                dlg.ApplyCondition = orientation.Condition != null;

                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    orientation.Name   = dlg.ConfigurationName;
                    condition.Tag      = GetTag(dlg.DicomTag);
                    condition.TagValue = dlg.TagValue;

                    if (dlg.ApplyCondition)
                    {
                        orientation.Condition = condition;
                    }
                    else
                    {
                        orientation.Condition = null;
                    }

                    SetOrientationInfo(orientation);
                }
            }
            catch (Exception exception)
            {
                Messager.ShowError(this, exception);
            }
        }
Exemple #2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            try
            {
                ConfigurationEditorDialog dlg;


                if (comboBoxPlane.SelectedIndex < 0)
                {
                    return;
                }

                dlg = new ConfigurationEditorDialog(false);

                dlg.ApplyCondition = true;

                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    Plane                        plane;
                    PlaneOrientation             orientation;
                    TagValueOrientationCondition condition;

                    plane       = ( Plane )comboBoxPlane.SelectedItem;
                    orientation = new PlaneOrientation();

                    if (dlg.ApplyCondition)
                    {
                        condition = new TagValueOrientationCondition(GetTag(dlg.DicomTag), dlg.TagValue);
                    }
                    else
                    {
                        condition = null;
                    }

                    orientation.Name      = dlg.ConfigurationName;
                    orientation.Condition = condition;

                    switch (plane)
                    {
                    case Plane.Axial:
                    {
                        _Configuration.Axial.Add(orientation);
                    }
                    break;

                    case Plane.Coronal:
                    {
                        orientation.Top   = OrientationAxis.Superior;
                        orientation.Right = OrientationAxis.Right;

                        _Configuration.Coronal.Add(orientation);
                    }
                    break;

                    case Plane.Sagittal:
                    {
                        orientation.Top   = OrientationAxis.Superior;
                        orientation.Right = OrientationAxis.Anterior;

                        _Configuration.Sagittal.Add(orientation);
                    }
                    break;
                    }

                    comboBoxConfigs.Items.Add(orientation);
                    comboBoxConfigs.SelectedItem = orientation;

                    SetOrientationInfo(orientation);

                    UpdateOrientConfigUI( );
                }
            }
            catch (Exception exception)
            {
                Messager.ShowError(this, exception);
            }
        }