dicom 打印

// Copyright (c) 2012-2022 fo-dicom contributors.
// Licensed under the Microsoft Public License (MS-PL).

using System;
using System.Drawing;
using FellowOakDicom;
using FellowOakDicom.Imaging;
using FellowOakDicom.Log;
using FellowOakDicom.Printing;

namespace Print_SCU
{

    internal static class Program
    {
        private static async System.Threading.Tasks.Task Main(string[] args)
        {
            // Initialize log manager.
            new DicomSetupBuilder()
                .RegisterServices(s => s
                    .AddFellowOakDicom()
                    .AddLogManager<ConsoleLogManager>()
                    .AddImageManager<WinFormsImageManager>())
                .Build();

            var stopwatch = new System.Diagnostics.Stopwatch();
            stopwatch.Start();

            var printJob = new PrintJob("DICOM PRINT JOB")
            {
                RemoteAddress = "localhost",
                RemotePort = 105,
                CallingAE = "PRINTSCU",
                CalledAE = "Printer"
            };

            //greyscale
            var greyscaleImg = new DicomImage(@"Data\1.3.51.5155.1353.20020423.1100947.1.0.0.dcm");
            var colorImg = new DicomImage(@"Data\US-RGB-8-epicard.dcm");
            using (var bitmap = greyscaleImg.RenderImage().As<Bitmap>())
            {
                var bitmap2 = colorImg.RenderImage().As<Bitmap>();
                printJob.FilmSession.IsColor = false; //set to true to print in color
              printJob.StartFilmBox("STANDARD\\32,32", "PORTRAIT", "14INX17IN");
               
                printJob.AddImage(bitmap, 0);
                printJob.AddImage(bitmap2, 2);
                printJob.EndFilmBox();

             //   printJob.StartFilmBox("STANDARD\\2,1", "PORTRAIT", "14INX17IN");

               // printJob.AddImage(bitmap, 0);
               // printJob.AddImage(bitmap2, 2);
               // printJob.EndFilmBox();
            }

            //color
          
          

            await printJob.Print();

            stopwatch.Stop();
            Console.WriteLine();
            Console.WriteLine(stopwatch.Elapsed);
        }
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值