Ejemplo n.º 1
0
        public static FilmConfigInformation GetFilmInformation(AutomaticFilmSizeConfiguration config, ISelectPresentationsInformation selectPresentation, int sizef)
        {
            List <FilmConfigInformation> list = new List <FilmConfigInformation>();
            float num  = 0f;
            float num2 = 0f;
            float num3 = 0f;
            float num4 = 0f;

            if (config != null)
            {
                num  = config.LeftMargin;
                num2 = config.RightMargin;
                num3 = config.TopMargin;
                num4 = config.BottomMargin;
                if (config.FilmSizes != null)
                {
                    IEnumerable <FilmConfigInformation> collection = FilmConfigInformation.FilmConfigInformationEnumerable(config.FilmSizes);
                    list.AddRange(collection);
                }
            }
            if (list.Count == 1)
            {
                return(list[0]);
            }
            if (list.Count == 0)
            {
                IEnumerable <FilmConfigInformation> enumerable2 = FilmConfigInformation.FilmConfigInformationEnumerable(Macro.Dicom.Iod.Modules.FilmSize.StandardFilmSizes);
                list.AddRange(enumerable2);
            }
            try
            {
                SizeF ef1 = FilmConfigInformation.GetPresentationImageSizeF(selectPresentation, sizef);
                SizeF a   = ef1 + new SizeF(num + num2, num3 + num4);
                FilmConfigInformation filmInfo = list[0];
                SizeF size = filmInfo.FilmSizeF;
                float num5 = FilmConfigInformation.verificationPresentationImageSizeF(a, size);
                for (int i = 1; i < list.Count; i++)
                {
                    FilmConfigInformation local3 = list[i];
                    float num7 = FilmConfigInformation.verificationPresentationImageSizeF(a, local3.FilmSizeF);
                    if (num7 < num5)
                    {
                        num5     = num7;
                        filmInfo = list[i];
                    }
                }
                return(filmInfo);
            }
            catch (Exception exception)
            {
                string message = exception.Message;
                Platform.Log(Macro.Common.LogLevel.Warn, exception, message, new object[0]);
                return(list[0]);
            }
        }
Ejemplo n.º 2
0
        private static IEnumerable <FilmConfigInformation> FilmConfigInformationEnumerable(IEnumerable <Macro.Dicom.Iod.Modules.FilmSize> filmSizeList)
        {
            IEnumerator <Macro.Dicom.Iod.Modules.FilmSize> enumerator = filmSizeList.GetEnumerator();
            FilmConfigInformation info;

            while (enumerator.MoveNext())
            {
                info = new FilmConfigInformation();
                FilmSize size = enumerator.Current;
                info.FilmOrientation = Macro.Dicom.Iod.Modules.FilmOrientation.Portrait;
                info.FilmSize        = size;
                yield return(info);

                info = new FilmConfigInformation();
                info.FilmOrientation = Macro.Dicom.Iod.Modules.FilmOrientation.Landscape;
                info.FilmSize        = size;
                yield return(info);
            }
        }
Ejemplo n.º 3
0
        private static PrintScu.FilmBox GetFilmBox(DicomPrinter.Configuration config, IList <PrintScu.IPrintItem> itemList)
        {
            // This item is obfuscated and can not be translated.
            PrintScu.FilmBox box;
            if (config.FilmBox.FilmSize != PrinterFilmSize.AutoSelect)
            {
                box = new PrintScu.FilmBox(config.StandardResolutionDPI, config.HighResolutionDPI)
                {
                    FilmSizeId         = config.FilmBox.FilmSize.ToFilmSize(),
                    ImageDisplayFormat = config.FilmBox.ImageDisplayFormat.ToImageDisplayFormat()
                };

                if (config.FilmBox.FilmOrientation != FilmOrientation.None)
                {
                    box.FilmOrientation = config.FilmBox.FilmOrientation;
                }

                if (config.FilmBox.BorderDensity != BorderDensity.None)
                {
                    box.BorderDensity = config.FilmBox.BorderDensity;
                }

                if (config.FilmBox.EmptyImageDensity != EmptyImageDensity.None)
                {
                    box.EmptyImageDensity = config.FilmBox.EmptyImageDensity;
                }

                if (config.FilmBox.MagnificationType != MagnificationType.None)
                {
                    box.MagnificationType = config.FilmBox.MagnificationType;
                }

                if (!string.IsNullOrEmpty(config.FilmBox.ConfigurationInformation))
                {
                    box.ConfigurationInformation = config.FilmBox.ConfigurationInformation;
                }

                if (config.FilmBox.RequestedResolution != RequestedResolution.None)
                {
                    box.RequestedResolutionId = config.FilmBox.RequestedResolution;
                }
            }
            else
            {
                box = new PrintScu.FilmBox(config.StandardResolutionDPI, config.HighResolutionDPI)
                {
                    FilmSizeId         = config.FilmBox.FilmSize.ToFilmSize(),
                    ImageDisplayFormat = config.FilmBox.ImageDisplayFormat.ToImageDisplayFormat()
                };

                if (config.FilmBox.RequestedResolution == RequestedResolution.High)
                {
                    int numberOfCopies = config.Session.NumberOfCopies;
                    AutomaticFilmSizeConfiguration automaticFilmSizeConfiguration = config.FilmBox.AutomaticFilmSizeConfiguration;
                    PrintScu.IPrintItem            printItem             = DicomPrintSession.GetT <PrintScu.IPrintItem>(itemList);
                    FilmConfigInformation          fileConfigInformation = FilmConfigInformation.GetFilmInformation(automaticFilmSizeConfiguration, (ISelectPresentationsInformation)printItem, numberOfCopies);
                    box.ImageDisplayFormat = ImageDisplayFormat.Standard_1x1;
                    box.FilmSizeId         = fileConfigInformation.FilmSize;
                    box.FilmOrientation    = fileConfigInformation.FilmOrientation;
                }
            }
            return(box);
        }