private void AddSegmentationMenuInfo(SegmentationDocument segmentationDocument, Seg seg, Sop sop) { if ( !_segmentationMenuInfos.ContainsKey( segmentationDocument.SopInstanceUid + seg.SegmentationNumber)) { SegmentationMenuInfo info = MenuInfoFromDocumentAndSeg(segmentationDocument, seg, sop); if (info != null) { _segmentationMenuInfos.Add( segmentationDocument.SopInstanceUid + seg.SegmentationNumber, info); } } }
public SegmentationActionContainer(SegmentationTool ownerTool, SegmentationMenuInfo info, int index) { _ownerTool = ownerTool; _info = info; StringBuilder pathStringBuilder = new StringBuilder(); pathStringBuilder.AppendFormat("{0}/", ImageViewerComponent.ContextMenuSite); // Multiple patients if (_ownerTool.Context.Viewer.StudyTree.Studies.Any(study => study.ParentPatient.PatientId != info.PatientId)) { pathStringBuilder.AppendFormat("{0} · {1}/", info.PatientsName, info.PatientId); } // Multiple Studies if (_ownerTool.Context.Viewer.StudyTree.Studies.Any(study => study.StudyInstanceUid != info.StudyInstanceUid)) { // We are trying to replicate what ImageSetDescriptior.GetName() does here: string modalitiesInStudy = StringUtilities.Combine(CollectionUtils.Sort( _ownerTool.Context.Viewer.StudyTree.Studies.First( study => study.StudyInstanceUid == info.StudyInstanceUid).ModalitiesInStudy), ", "); DateTime studyDate; DateParser.Parse(info.StudyDate, out studyDate); DateTime studyTime; TimeParser.Parse(info.StudyTime, out studyTime); pathStringBuilder.AppendFormat("{0} {1}", studyDate.ToString(Format.DateFormat), studyTime.ToString(Format.TimeFormat)); if (!string.IsNullOrEmpty(info.StudyAccessionNumber)) { pathStringBuilder.AppendFormat(", A#: {0}", info.StudyAccessionNumber); } pathStringBuilder.AppendFormat(", [{0}] {1}/", modalitiesInStudy ?? "", info.StudyDescription); } pathStringBuilder.AppendFormat("SEG{0}", index); string actionId = String.Format("{0}:apply{1}", typeof(SegmentationTool).FullName, index); var actionPath = new ActionPath(pathStringBuilder.ToString(), _ownerTool._resolver); _action = new MenuAction(actionId, actionPath, ClickActionFlags.None, _ownerTool._resolver); _action.GroupHint = new GroupHint("DisplaySets"); _action.Label = String.Format("{0} SEG: {1}", _info.SeriesNumber, _info.DisplayLabel); _action.SetClickHandler(Apply); }
public SegmentationActionContainer(SegmentationTool ownerTool, SegmentationMenuInfo info, int index) { _ownerTool = ownerTool; _info = info; StringBuilder pathStringBuilder = new StringBuilder(); pathStringBuilder.AppendFormat("{0}/", ImageViewerComponent.ContextMenuSite); // Multiple patients if (_ownerTool.Context.Viewer.StudyTree.Studies.Any(study => study.ParentPatient.PatientId != info.PatientId)) { pathStringBuilder.AppendFormat("{0} · {1}/", info.PatientsName, info.PatientId); } // Multiple Studies if (_ownerTool.Context.Viewer.StudyTree.Studies.Any(study => study.StudyInstanceUid != info.StudyInstanceUid)) { // We are trying to replicate what ImageSetDescriptior.GetName() does here: string modalitiesInStudy = StringUtilities.Combine(CollectionUtils.Sort( _ownerTool.Context.Viewer.StudyTree.Studies.First( study => study.StudyInstanceUid == info.StudyInstanceUid).ModalitiesInStudy), ", "); DateTime studyDate; DateParser.Parse(info.StudyDate, out studyDate); DateTime studyTime; TimeParser.Parse(info.StudyTime, out studyTime); pathStringBuilder.AppendFormat("{0} {1}", studyDate.ToString(Format.DateFormat), studyTime.ToString(Format.TimeFormat)); if (!string.IsNullOrEmpty(info.StudyAccessionNumber)) pathStringBuilder.AppendFormat(", A#: {0}", info.StudyAccessionNumber); pathStringBuilder.AppendFormat(", [{0}] {1}/", modalitiesInStudy ?? "", info.StudyDescription); } pathStringBuilder.AppendFormat("SEG{0}", index); string actionId = String.Format("{0}:apply{1}", typeof (SegmentationTool).FullName, index); var actionPath = new ActionPath(pathStringBuilder.ToString(), _ownerTool._resolver); _action = new MenuAction(actionId, actionPath, ClickActionFlags.None, _ownerTool._resolver); _action.GroupHint = new GroupHint("DisplaySets"); _action.Label = String.Format("{0} SEG: {1}", _info.SeriesNumber, _info.DisplayLabel); _action.SetClickHandler(Apply); }