Table of Contents

Class DicomWriterOptions

Namespace
Egami.Formats.Extended.Dicom
Assembly
Egami.Formats.Extended.dll

Options for writing DICOM: the transfer syntax, the quality of lossy ones, and the attributes of a Secondary Capture image. Pass them to Save(Stream, FormatInfo, WriterOptions?) with Info, or to Save(Stream, DicomWriterOptions?, EgamiContext?).

[Experimental("EGAMIX001", UrlFormat = "https://github.com/inexin/Egami/blob/main/docs/articles/formats/dicom.md")]
public sealed class DicomWriterOptions : WriterOptions
Inheritance
DicomWriterOptions
Inherited Members

Examples

// Any raster saves as a Secondary Capture image: gray as MONOCHROME2, colour as RGB, 8 or 16 bits.
using (FileStream output = File.Create("capture.dcm"))
{
    raster.Save(output, DicomFormat.Info, new DicomWriterOptions
    {
        TransferSyntax = DicomTransferSyntax.JpegLsLossless,
        Attributes = new Dictionary<string, string>
        {
            ["PatientName"] = "Doe^Jane",
            ["PatientID"] = "12345",
            ["StudyInstanceUID"] = DicomUid.Generate(),
        },
    });
}

Properties

Attributes

Gets attributes to give a Secondary Capture image written from a raster, by PS3.6 keyword, such as PatientName, PatientID or StudyInstanceUID, each value as text (several values separated by </code>). The VR comes from PS3.6; text is written in UTF-8 (Specific Character Set ISO_IR 192) when it is not ASCII. Ignored by Save(Stream, DicomWriterOptions?, EgamiContext?), which keeps the file's own.

public IReadOnlyDictionary<string, string> Attributes { get; init; }

Property Value

IReadOnlyDictionary<string, string>

Default

Gets the default options: Explicit VR Little Endian, quality 90, the Basic Offset Table.

public static DicomWriterOptions Default { get; }

Property Value

DicomWriterOptions

Near

Gets the largest error per sample of JpegLsNearLossless (the JPEG-LS NEAR parameter), 1 to 255. Defaults to 2.

public int Near { get; init; }

Property Value

int

Exceptions

ArgumentOutOfRangeException

The value is outside 1 to 255.

OffsetTable

Gets where encapsulated pixel data says each frame starts. Defaults to Basic.

public DicomOffsetTable OffsetTable { get; init; }

Property Value

DicomOffsetTable

Quality

Gets the quality of JpegBaseline, JpegExtended and JpegXl, 1 (smallest) to 100 (best), as their own writers take it. Defaults to 90.

public int Quality { get; init; }

Property Value

int

Exceptions

ArgumentOutOfRangeException

The value is outside 1 to 100.

TransferSyntax

public DicomTransferSyntax TransferSyntax { get; init; }

Property Value

DicomTransferSyntax