private DicomTagNode AddAnonymizationTag(AnonymizeScript selectedScript, long tag, string name, string macro) { DicomTag dicomTag = DicomTagTable.Instance.Find(tag); DicomTagNode node = new DicomTagNode(); node.CreateCells(treeGridViewTags); node.SetValues(string.Format("({0:X4},{1:X4})", tag.GetGroup(), tag.GetElement()), name, macro); treeGridViewTags.Rows.Add(node); // treeGridViewTags.Rows.Add(node); node.DicomTag = dicomTag; // node.Image = Resources.Tag_16x16; //if (dicomTag != null && dicomTag.VR == DicomVRType.SQ) // node.Image = Resources.Tags_16x16; Anonymizer selectedAnonymizer = null; if (selectedScript != null) { selectedAnonymizer = selectedScript.Anonymizer; } if (selectedAnonymizer != null) { selectedAnonymizer[tag] = macro; node.Tag = selectedAnonymizer.FindTag(tag); return(node); } return(null); }
private void LoadMacros(AnonymizeScript selectedScript) { treeGridViewTags.Rows.Clear(); ObservableCollection <TagMacro> macros = new ObservableCollection <TagMacro>(); if (selectedScript != null) { macros = selectedScript.Anonymizer.TagMacros; } foreach (TagMacro macro in macros) { DicomTag dicomTag = DicomTagTable.Instance.Find(macro.Tag); string name = dicomTag != null ? dicomTag.Name : string.Empty; DicomTagNode node = new DicomTagNode(); string sValue = string.Format("{0:X4},{1:X4}", macro.Tag.GetGroup(), macro.Tag.GetElement()); // bool bRet = node.SetValues(sValue, name, macro.Macro); // DataGridViewRow row = new DataGridViewRow(); node.CreateCells(treeGridViewTags); node.SetValues(sValue, name, macro.Macro); treeGridViewTags.Rows.Add(node); node.DicomTag = dicomTag; node.Tag = macro; AddToList(macro.Macro); //if (dicomTag != null) //{ // if (dicomTag.VR == DicomVRType.SQ) // node.Image = Resources.Tags_16x16; // else // node.Image = Resources.Tag_16x16; //} } // treeGridViewTags.Refresh(); }