public AimGraphic(IGraphic graphic, aim_dotnet.ImageAnnotation imageAnnotation, int shapeIdentifier) : base(graphic) { _imageAnnotation = imageAnnotation; _shapeIdentifier = shapeIdentifier; _graphic = graphic; }
private static string GetImageAnnotationHtml(aim_dotnet.ImageAnnotation imageAnnotation) { var sb = new StringBuilder(); var htmlFormatter = new AimHtmlFormatter(); var ctrlColor = Color.FromKnownColor(KnownColor.Control); sb.Append(HtmlDocHeader); sb.AppendFormat("<body style=\"background-color: #{0}{1}{2};\" onload=\"setupPaths(['{3}', '{4}'])\">", ctrlColor.R.ToString("X2"), ctrlColor.G.ToString("X2"), ctrlColor.B.ToString("X2"), MinusImagePathName, PlusImagePathName); sb.Append("<div id=\"main_content\">"); sb.Append(htmlFormatter.GetAnatomicEntitiesHtml(imageAnnotation.AnatomyEntityCollection)); sb.Append(htmlFormatter.GetImagingObservationHtml(imageAnnotation.ImagingObservationCollection)); sb.Append("</div>"); sb.Append("</body>"); sb.Append("</html>"); return(sb.ToString()); }
private aim_dotnet.ImageStudy AimStudyFromAnnotation(aim_dotnet.Annotation annotation) { aim_dotnet.ImageAnnotation imageAnnotation = annotation as aim_dotnet.ImageAnnotation; if (imageAnnotation == null || imageAnnotation.ImageReferenceCollection.Count == 0) { return(null); } aim_dotnet.DICOMImageReference dicomImageReference = imageAnnotation.ImageReferenceCollection[0] as aim_dotnet.DICOMImageReference; if (dicomImageReference == null) { return(null); } if (dicomImageReference.Study == null || dicomImageReference.Study.Series == null || dicomImageReference.Study.Series.ImageCollection == null || dicomImageReference.Study.Series.ImageCollection.Count == 0) { return(null); } return(dicomImageReference.Study); }
private static aim_dotnet.ImageAnnotation CreateImageAnnotation(IImageSopProvider imageSop, AimAnnotationCreationContext creationContext) { // Create Basic Image Annotation Platform.CheckTrue(creationContext.SelectedAnnotationKind == aim_dotnet.AnnotationKind.AK_ImageAnnotation, "ImageAnnotationKind"); Platform.CheckForEmptyString(creationContext.AnnotationName, "AnnotationName"); var imgAnnotation = new aim_dotnet.ImageAnnotation(); imgAnnotation.CodeValue = creationContext.AnnotationTypeCode.CodeValue; imgAnnotation.CodeMeaning = creationContext.AnnotationTypeCode.CodeMeaning; imgAnnotation.CodingSchemeDesignator = creationContext.AnnotationTypeCode.CodingSchemeDesignator; imgAnnotation.CodingSchemeVersion = creationContext.AnnotationTypeCode.CodingSchemeVersion; imgAnnotation.UniqueIdentifier = DicomUid.GenerateUid().UID; imgAnnotation.Name = creationContext.AnnotationName; imgAnnotation.DateTime = DateTime.Now; imgAnnotation.Patient = CreatePatient(imageSop); imgAnnotation.Equipment = CreateEquipment(); if (creationContext.AnnotationUser != null) imgAnnotation.User = new aim_dotnet.User(creationContext.AnnotationUser); if (!string.IsNullOrEmpty(creationContext.AnnotationComment)) imgAnnotation.Comment = creationContext.AnnotationComment; if (creationContext.SelectedAnatomicEntities != null) imgAnnotation.AnatomyEntityCollection = new List<aim_dotnet.AnatomicEntity>(creationContext.SelectedAnatomicEntities); if (creationContext.SelectedImagingObservations != null) imgAnnotation.ImagingObservationCollection = new List<aim_dotnet.ImagingObservation>(creationContext.SelectedImagingObservations); if (creationContext.SelectedInferences != null) imgAnnotation.InferenceCollection = new List<aim_dotnet.Inference>(creationContext.SelectedInferences); return imgAnnotation; }
public override void Execute() { List <AIMSearchResult> results = new List <AIMSearchResult>(); List <aim_dotnet.Annotation> annotations = null; try { if (_aimQueryParameters.AnnotationType == AnnotationType.ImageAnnotation) { AIMTCGAImageAnnotation aimService = new AIMTCGAImageAnnotation(); annotations = aimService.getImageAnnotationInfoList(_aimQueryParameters); } else if (_aimQueryParameters.AnnotationType == AnnotationType.AnnotationOfAnnotation) { AIMTCGAAnnotationOfAnnotation aimService = new AIMTCGAAnnotationOfAnnotation(); annotations = aimService.getAnnotationOfAnnotationInfoList(_aimQueryParameters); } } catch (GridServicerException ex) { SetError(string.Format("{0}. Contact your system administrator", ex.Message)); } if (annotations != null) { foreach (aim_dotnet.Annotation annotation in annotations) { AIMSearchResult result = new AIMSearchResult(); result.RetrievedAnnotation = annotation; if (annotation.AnatomyEntityCollection != null) { foreach (aim_dotnet.AnatomicEntity anatomicEntity in annotation.AnatomyEntityCollection) { AnatomicEntity ae = new AnatomicEntity(); ae.CodeValue = anatomicEntity.CodeValue; ae.CodeMeaning = anatomicEntity.CodeMeaning; ae.CodingSchemeDesignator = anatomicEntity.CodingSchemeDesignator; result.AnatomicEntities.Add(ae); if (anatomicEntity.AnatomicEntityCharacteristicCollection != null) { foreach (aim_dotnet.AnatomicEntityCharacteristic characteristic in anatomicEntity.AnatomicEntityCharacteristicCollection) { AnatomicEntityCharacteristic aec = new AnatomicEntityCharacteristic(); aec.CodeValue = characteristic.CodeValue; aec.CodeMeaning = characteristic.CodeMeaning; aec.CodingSchemeDesignator = characteristic.CodingSchemeDesignator; result.AnatomicEntityCharacteristics.Add(aec); } } } } if (annotation.ImagingObservationCollection != null) { foreach (aim_dotnet.ImagingObservation imagingObservation in annotation.ImagingObservationCollection) { ImagingObservation io = new ImagingObservation(); io.CodeValue = imagingObservation.CodeValue; io.CodeMeaning = imagingObservation.CodeMeaning; io.CodingSchemeDesignator = imagingObservation.CodingSchemeDesignator; result.ImagingObservations.Add(io); if (imagingObservation.ImagingObservationCharacteristicCollection != null) { foreach (aim_dotnet.ImagingObservationCharacteristic characteristic in imagingObservation.ImagingObservationCharacteristicCollection) { ImagingObservationCharacteristic ioc = new ImagingObservationCharacteristic(); ioc.CodeValue = characteristic.CodeValue; ioc.CodeMeaning = characteristic.CodeMeaning; ioc.CodingSchemeDesignator = characteristic.CodingSchemeDesignator; ioc.Comment = characteristic.Comment; result.ImagingObservationCharacteristics.Add(ioc); } } } } if (annotation.User != null) { User user = new User(); user.Name = annotation.User.Name; user.LoginName = annotation.User.LoginName; user.RoleInTrial = annotation.User.RoleInTrial; user.NumberWithinRoleInClinicalTrial = annotation.User.NumberWithinRoleOfClinicalTrial; result.User = user; } if (annotation is aim_dotnet.ImageAnnotation) { aim_dotnet.ImageAnnotation imageAnnotation = (aim_dotnet.ImageAnnotation)annotation; // Study Instance UID if (imageAnnotation.ImageReferenceCollection != null && imageAnnotation.ImageReferenceCollection.Count > 0) { aim_dotnet.DICOMImageReference dicomImageReference = imageAnnotation.ImageReferenceCollection[0] as aim_dotnet.DICOMImageReference; if (dicomImageReference != null) { result.Study.StudyInstanceUid = dicomImageReference.Study.InstanceUID; } } if (imageAnnotation.Patient != null) { result.Patient.PatientId = imageAnnotation.Patient.Id.ToString(); result.Patient.PatientsName = imageAnnotation.Patient.Name; result.Patient.PatientsSex = imageAnnotation.Patient.Sex; result.Patient.PatientBirthDate = imageAnnotation.Patient.BirthDate; } foreach (aim_dotnet.ImageReference imageReference in imageAnnotation.ImageReferenceCollection) { if (imageReference is aim_dotnet.DICOMImageReference) { aim_dotnet.DICOMImageReference dicomImageReference = (aim_dotnet.DICOMImageReference)imageReference; result.Series.SeriesInstanceUid = ((dicomImageReference.Study ?? new aim_dotnet.ImageStudy()).Series ?? new aim_dotnet.ImageSeries()).InstanceUID; } } } results.Add(result); } } AddResultsToTable(results); OnCommandExecuted(); }