Class DicomOptions

Class DicomOptions

名称: Aspose.Imaging.ImageOptions 收藏: Aspose.Imaging.dll (25.4.0)

医学中的数字图像和通信的API(DICOM)格式创建是一种专门的工具,适用于医疗设备的应用。允许无缝生成DICOM图像,对于医疗存储至关重要数据和包含重要识别信息。并设置压缩,定义颜色类型,并嵌入XMP甲数据,开发人员能够确保 DICOM 图像管理的符合性和灵活性描绘目的。

public class DicomOptions : ImageOptionsBase, IDisposable, IHasXmpData, IHasMetadata, ICloneable

Inheritance

object DisposableObject ImageOptionsBase DicomOptions

Implements

IDisposable , IHasXmpData , IHasMetadata , ICloneable

继承人

ImageOptionsBase.Clone() , ImageOptionsBase.ReleaseManagedResources() , ImageOptionsBase.KeepMetadata , ImageOptionsBase.XmpData , ImageOptionsBase.Source , ImageOptionsBase.Palette , ImageOptionsBase.ResolutionSettings , ImageOptionsBase.VectorRasterizationOptions , ImageOptionsBase.BufferSizeHint , ImageOptionsBase.MultiPageOptions , ImageOptionsBase.FullFrame , ImageOptionsBase.ProgressEventHandler , DisposableObject.Dispose() , DisposableObject.ReleaseManagedResources() , DisposableObject.ReleaseUnmanagedResources() , DisposableObject.VerifyNotDisposed() , DisposableObject.Disposed , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

在 DICOM 压缩中更改颜色类型。

using (var inputImage = Image.Load("original.jpg"))
                                                  {
                                                      var options = new DicomOptions { ColorType = ColorType.Grayscale8Bit };

                                                      inputImage.Save("original_8Bit.dcm", options);
                                                  }

在 DICOM 图像中使用 RLE 压缩。

using (var inputImage = Image.Load("original.jpg"))
                                              {
                                                  var options = new DicomOptions
                                                  {
                                                      ColorType = ColorType.Rgb24Bit,
                                                      Compression = new Compression { Type = CompressionType.Rle }
                                                  };

                                                  inputImage.Save("original_RLE.dcm", options);
                                              }

在 DICOM 图像中使用 JPEG 2000 压缩。

using (var inputImage = Image.Load("original.jpg"))
                                                    {
                                                        var options = new DicomOptions
                                                        {
                                                            ColorType = ColorType.Rgb24Bit,
                                                            Compression = new Compression
                                                            {
                                                                Type = CompressionType.Jpeg2000,
                                                                Jpeg2000 = new Jpeg2000Options
                                                                {
                                                                    Codec = Jpeg2000Codec.Jp2,
                                                                    Irreversible = false
                                                                }
                                                            }
                                                        };

                                                        inputImage.Save("original_JPEG2000.dcm", options);
                                                    }

在 DICOM 图像中使用 JPEG 压缩。

using (var inputImage = Image.Load("original.jpg"))
                                               {
                                                   var options = new DicomOptions
                                                   {
                                                       ColorType = ColorType.Rgb24Bit,
                                                       Compression = new Compression
                                                       {
                                                           Type = CompressionType.Jpeg,
                                                           Jpeg = new JpegOptions
                                                           {
                                                               CompressionType = JpegCompressionMode.Baseline,
                                                               SampleRoundingMode = SampleRoundingMode.Truncate,
                                                               Quality = 50
                                                           }
                                                       }
                                                   };

                                                   inputImage.Save("original_JPEG.dcm", options);
                                               }

下面的示例显示出口到DICOM文件格式(单页和多页)。

string fileName = "sample.jpg";
                                                                                          string inputFileNameSingle = fileName;
                                                                                          string inputFileNameMultipage = "multipage.tif";
                                                                                          string outputFileNameSingleDcm = "output.dcm";
                                                                                          string outputFileNameMultipageDcm = "outputMultipage.dcm";

                                                                                          // The next code sample converts JPEG image to DICOM file format
                                                                                          using (var image = Aspose.Imaging.Image.Load(inputFileNameSingle))
                                                                                          {
                                                                                              image.Save(outputFileNameSingleDcm, new Aspose.Imaging.ImageOptions.DicomOptions());
                                                                                          }

                                                                                          // DICOM format supports multipage images. You can convert GIF or TIFF images to DICOM in the same way as JPEG images
                                                                                          using (var imageMultiple = Aspose.Imaging.Image.Load(inputFileNameMultipage))
                                                                                          {
                                                                                              imageMultiple.Save(outputFileNameMultipageDcm, new Aspose.Imaging.ImageOptions.DicomOptions());
                                                                                          }

创建多页Dicom图像。

using (DicomImage image = (DicomImage)Image.Create(
                                                   new DicomOptions() { Source = new StreamSource(new MemoryStream()) },
                                                   100,
                                                   100))
                                           {
                                               // Draw something using vector graphics
                                               Graphics graphics = new Graphics(image);
                                               graphics.FillRectangle(new SolidBrush(Color.BlueViolet), image.Bounds);
                                               graphics.FillRectangle(new SolidBrush(Color.Aqua), 10, 20, 50, 20);
                                               graphics.FillEllipse(new SolidBrush(Color.Orange), 30, 50, 70, 30);

                                               // Save the pixels of the drawn image. They are now on the first page of the Dicom image.
                                               int[] pixels = image.LoadArgb32Pixels(image.Bounds);

                                               // Add a few pages after, making them darker
                                               for (int i = 1; i < 5; i++)
                                               {
                                                   DicomPage page = image.AddPage();
                                                   page.SaveArgb32Pixels(page.Bounds, pixels);
                                                   page.AdjustBrightness(i * 30);
                                               }

                                               // Add a few pages in front of the main page, making them brighter
                                               for (int i = 1; i < 5; i++)
                                               {
                                                   DicomPage page = image.InsertPage(0);
                                                   page.SaveArgb32Pixels(page.Bounds, pixels);
                                                   page.AdjustBrightness(-i * 30);
                                               }

                                               // Save the created multi-page image to the output file
                                               image.Save("MultiPage.dcm");
                                           }

Constructors

DicomOptions()

public DicomOptions()

Properties

ColorType

接收或设置颜色类型。

public ColorType ColorType { get; set; }

财产价值

ColorType

Examples

在 DICOM 压缩中更改颜色类型。

using (var inputImage = Image.Load("original.jpg"))
                                                  {
                                                      var options = new DicomOptions { ColorType = ColorType.Grayscale8Bit };

                                                      inputImage.Save("original_8Bit.dcm", options);
                                                  }

在 DICOM 图像中使用 RLE 压缩。

using (var inputImage = Image.Load("original.jpg"))
                                              {
                                                  var options = new DicomOptions
                                                  {
                                                      ColorType = ColorType.Rgb24Bit,
                                                      Compression = new Compression { Type = CompressionType.Rle }
                                                  };

                                                  inputImage.Save("original_RLE.dcm", options);
                                              }

在 DICOM 图像中使用 JPEG 2000 压缩。

using (var inputImage = Image.Load("original.jpg"))
                                                    {
                                                        var options = new DicomOptions
                                                        {
                                                            ColorType = ColorType.Rgb24Bit,
                                                            Compression = new Compression
                                                            {
                                                                Type = CompressionType.Jpeg2000,
                                                                Jpeg2000 = new Jpeg2000Options
                                                                {
                                                                    Codec = Jpeg2000Codec.Jp2,
                                                                    Irreversible = false
                                                                }
                                                            }
                                                        };

                                                        inputImage.Save("original_JPEG2000.dcm", options);
                                                    }

在 DICOM 图像中使用 JPEG 压缩。

using (var inputImage = Image.Load("original.jpg"))
                                               {
                                                   var options = new DicomOptions
                                                   {
                                                       ColorType = ColorType.Rgb24Bit,
                                                       Compression = new Compression
                                                       {
                                                           Type = CompressionType.Jpeg,
                                                           Jpeg = new JpegOptions
                                                           {
                                                               CompressionType = JpegCompressionMode.Baseline,
                                                               SampleRoundingMode = SampleRoundingMode.Truncate,
                                                               Quality = 50
                                                           }
                                                       }
                                                   };

                                                   inputImage.Save("original_JPEG.dcm", options);
                                               }

Compression

接收或设置压缩。

public Compression Compression { get; set; }

财产价值

Compression

Examples

在 DICOM 压缩中更改颜色类型。

using (var inputImage = Image.Load("original.jpg"))
                                                  {
                                                      var options = new DicomOptions { ColorType = ColorType.Grayscale8Bit };

                                                      inputImage.Save("original_8Bit.dcm", options);
                                                  }

在 DICOM 图像中使用 RLE 压缩。

using (var inputImage = Image.Load("original.jpg"))
                                              {
                                                  var options = new DicomOptions
                                                  {
                                                      ColorType = ColorType.Rgb24Bit,
                                                      Compression = new Compression { Type = CompressionType.Rle }
                                                  };

                                                  inputImage.Save("original_RLE.dcm", options);
                                              }

在 DICOM 图像中使用 JPEG 2000 压缩。

using (var inputImage = Image.Load("original.jpg"))
                                                    {
                                                        var options = new DicomOptions
                                                        {
                                                            ColorType = ColorType.Rgb24Bit,
                                                            Compression = new Compression
                                                            {
                                                                Type = CompressionType.Jpeg2000,
                                                                Jpeg2000 = new Jpeg2000Options
                                                                {
                                                                    Codec = Jpeg2000Codec.Jp2,
                                                                    Irreversible = false
                                                                }
                                                            }
                                                        };

                                                        inputImage.Save("original_JPEG2000.dcm", options);
                                                    }

在 DICOM 图像中使用 JPEG 压缩。

using (var inputImage = Image.Load("original.jpg"))
                                               {
                                                   var options = new DicomOptions
                                                   {
                                                       ColorType = ColorType.Rgb24Bit,
                                                       Compression = new Compression
                                                       {
                                                           Type = CompressionType.Jpeg,
                                                           Jpeg = new JpegOptions
                                                           {
                                                               CompressionType = JpegCompressionMode.Baseline,
                                                               SampleRoundingMode = SampleRoundingMode.Truncate,
                                                               Quality = 50
                                                           }
                                                       }
                                                   };

                                                   inputImage.Save("original_JPEG.dcm", options);
                                               }
 中文