protected void DeserializeSoftcopyVoiLut(SoftcopyVoiLutModuleIod module, T image)
        {
            SoftcopyVoiLutModuleIod.SoftcopyVoiLutSequenceItem[] lutSequences = module.SoftcopyVoiLutSequence;
            if (lutSequences == null)
            {
                return;
            }

            DicomVoiLuts voiLuts = (DicomVoiLuts)image.DicomVoiLuts;

            voiLuts.ReinitializePresentationLuts(this.PresentationSopInstanceUid);

            foreach (SoftcopyVoiLutModuleIod.SoftcopyVoiLutSequenceItem lutSequence in lutSequences)
            {
                ImageSopInstanceReferenceDictionary dictionary = new ImageSopInstanceReferenceDictionary(lutSequence.ReferencedImageSequence, true);
                if (dictionary.ReferencesFrame(image.ImageSop.SopInstanceUid, image.Frame.FrameNumber))
                {
                    if (lutSequence.CountWindows > 0)
                    {
                        double[] widths       = lutSequence.WindowWidth;
                        double[] centers      = lutSequence.WindowCenter;
                        int      countWindows = Math.Min(widths.Length, centers.Length);
                        string[] explanation  = lutSequence.WindowCenterWidthExplanation;
                        if (explanation == null || explanation.Length < countWindows)
                        {
                            explanation = new string[countWindows];
                        }

                        if (lutSequence.VoiLutFunction == VoiLutFunction.Sigmoid)
                        {
                            Platform.Log(LogLevel.Warn, "Sigmoid LUTs are not currently supported.");
                        }
                        else                         // default is linear
                        {
                            for (int n = 0; n < countWindows; n++)
                            {
                                voiLuts.AddPresentationLinearLut(widths[n], centers[n], explanation[n]);
                            }
                        }
                    }

                    if (lutSequence.CountDataLuts > 0)
                    {
                        foreach (VoiLutSequenceItem item in lutSequence.VoiLutSequence)
                        {
                            DataLutIod dl = DataLutIod.Create(item.DicomSequenceItem, item.DicomAttributeProvider[DicomTags.LutDescriptor] is DicomAttributeSS, false);
                            voiLuts.AddPresentationDataLut(new VoiDataLut(dl.FirstMappedPixelValue, dl.BitsPerEntry, dl.Data, dl.Explanation));
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public static IEnumerable <DicomGraphicAnnotation> CreateGraphicAnnotations(Frame frame, GraphicAnnotationModuleIod annotationsFromPresentationState, RectangleF displayedArea)
        {
            List <DicomGraphicAnnotation> list = new List <DicomGraphicAnnotation>();

            GraphicAnnotationSequenceItem[] annotationSequences = annotationsFromPresentationState.GraphicAnnotationSequence;
            if (annotationSequences != null)
            {
                foreach (GraphicAnnotationSequenceItem sequenceItem in annotationSequences)
                {
                    ImageSopInstanceReferenceDictionary dictionary = new ImageSopInstanceReferenceDictionary(sequenceItem.ReferencedImageSequence, true);
                    if (dictionary.ReferencesFrame(frame.ParentImageSop.SopInstanceUid, frame.FrameNumber))
                    {
                        list.Add(new DicomGraphicAnnotation(sequenceItem, displayedArea));
                    }
                }
            }

            return(list.AsReadOnly());
        }
Ejemplo n.º 3
0
        public static DicomGraphicAnnotation CreateGraphicAnnotation(Frame frame, GraphicAnnotationSequenceItem sequenceItem, RectangleF displayedArea, bool interactive = false)
        {
            ImageSopInstanceReferenceDictionary dictionary = new ImageSopInstanceReferenceDictionary(sequenceItem.ReferencedImageSequence, true);

            return(dictionary.ReferencesFrame(frame.ParentImageSop.SopInstanceUid, frame.FrameNumber) ? DicomGraphicAnnotation.Create(sequenceItem, displayedArea) : null);
        }