Class DicomWriterOptions
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
Default
Gets the default options: Explicit VR Little Endian, quality 90, the Basic Offset Table.
public static DicomWriterOptions Default { get; }
Property Value
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
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
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
Exceptions
- ArgumentOutOfRangeException
The value is outside 1 to 100.
TransferSyntax
Gets the transfer syntax to write. Native: ExplicitVRLittleEndian (the default), ImplicitVRLittleEndian and DeflatedExplicitVRLittleEndian; lossless: RleLossless, JpegLossless, JpegLsLossless and JpegXlLossless; lossy: JpegBaseline, JpegExtended, JpegLsNearLossless and JpegXl.
public DicomTransferSyntax TransferSyntax { get; init; }