예제 #1
0
        private ValidationResult GetValidtionResult(IApplicationComponent component)
        {
            string str;

            DicomPrinter.Configuration config = _dicomPrinter.Item.Config;
            bool success = DicomPrintSession.IsHaveModalityPixelSpacing(config, _selectPresentations, out str);

            return(new ValidationResult(success, str));
        }
예제 #2
0
 public static bool IsHaveModalityPixelSpacing(DicomPrinter.Configuration config, IEnumerable <ISelectPresentationsInformation> collection, out string OutMessage)
 {
     OutMessage = null;
     if (config.PresentationMode == PresentationMode.TrueSize)
     {
         using (IEnumerator <ISelectPresentationsInformation> enumerator = collection.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 ISelectPresentationsInformation selectinfo = enumerator.Current;
                 IPresentationImage     image1  = selectinfo.Image;
                 NormalizedPixelSpacing spacing = ((IImageSopProvider)image1).Frame.NormalizedPixelSpacing;
                 if ((spacing == null) || spacing.IsNull)
                 {
                     OutMessage = "NormalizedPixelSpacing为空";
                     return(false);
                 }
             }
         }
     }
     return(true);
 }
예제 #3
0
        internal static PrintScu.FilmSession GetFilmSession(SelectPresentationsInformationsCollection selects, DicomPrinter.Configuration config)
        {
            FilmBoxConfig fileBoxConfig = new FilmBoxConfig
            {
                config = config
            };

            List <PrintScu.IPrintItem> printItems = new List <PrintScu.IPrintItem>();

            using (IEnumerator <ISelectPresentationsInformation> enumerator = selects.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ISelectPresentationsInformation presentationsInformation = enumerator.Current;
                    IImageSopProvider imageSopProvider = (IImageSopProvider)presentationsInformation.Image;
                    if (imageSopProvider != null)
                    {
                        printItems.Add(new DicomPrintItem(imageSopProvider.ImageSop));
                    }
                }
            }

            PrintScu.FilmSession session = new PrintScu.FilmSession(printItems, new PrintScu.CreateFilmBoxDelegate(fileBoxConfig.GetFilmBox));
            if (fileBoxConfig.config.Session.FilmDestination != FilmDestination.None)
            {
                session.FilmDestination = fileBoxConfig.config.Session.FilmDestination;
            }

            if (fileBoxConfig.config.Session.PrintPriority != PrintPriority.None)
            {
                session.PrintPriority = fileBoxConfig.config.Session.PrintPriority;
            }

            if (fileBoxConfig.config.Session.MediumType != MediumType.None)
            {
                session.MediumType = fileBoxConfig.config.Session.MediumType;
            }
            session.NumberOfCopies = fileBoxConfig.config.Session.NumberOfCopies;

            return(session);
        }
예제 #4
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);
        }