Interface IDicomEncoding

Interface IDicomEncoding

Namespace: Aspose.Medical.Common.Text
Assembly: Aspose.Medical.dll (25.11.0)

Handles alternate character sets for DICOM character strings.

public interface IDicomEncoding

Methods

Decode(Span<byte>, Encoding[], ReadOnlySpan<byte>)

Decodes all the byte fragments in the specified System.Byte array into a System.String using a set of the given encodings.

string Decode(Span<byte> data, Encoding[] encodings, ReadOnlySpan<byte> delimiters)

Parameters

data Span < byte &gt;

The System.Byte data to be decoded into a System.String (can be multi-charset).

encodings Encoding []

A list of registered encodings that can be used to decode the given data.

delimiters ReadOnlySpan < byte &gt;

Delimiters in text values that reset the encoding.

Returns

string

A System.String that contains the results of decoding the specified sequence of bytes.

Exceptions

MedicalApiException

Unknown escape sequence found in the given fragment.

GetByteCount(string, Encoding[], ReadOnlySpan<byte>)

Calculates the number of bytes that encoding all the characters in the specified string would produce, given the same fallback and delimiter logic as your GetBytes method.

int GetByteCount(string data, Encoding[] encodings, ReadOnlySpan<byte> delimiters)

Parameters

data string

The string containing the characters to encode.

encodings Encoding []

Encodings used to encode the given data (for final‐fallback).

delimiters ReadOnlySpan < byte &gt;

Delimiters in text values that reset the encoding.

Returns

int

The total number of bytes that your GetBytes would have returned.

GetBytes(string, Encoding[], byte, ReadOnlySpan<byte>)

Encodes all the characters in the specified string into a System.Byte’s array.

byte[] GetBytes(string data, Encoding[] encodings, byte paddingValue, ReadOnlySpan<byte> delimiters)

Parameters

data string

The string containing the characters to encode.

encodings Encoding []

Encodings used to encode the given data.

paddingValue byte

System.Byte value used to pad result System.Byte’s array to even length.

delimiters ReadOnlySpan < byte &gt;

Delimiters in text values that reset the encoding.

Returns

byte []

A System.Byte array containing the results of encoding the specified set of characters.

GetCharset(Encoding, bool)

Get DICOM character set from .NET System.Text.Encoding.

string GetCharset(Encoding encoding, bool extended = false)

Parameters

encoding Encoding

.NET Encoding.

extended bool

If true, the extended version of the character set is returned.

Returns

string

The System.String Specific Character Set as defined in DICOM.

Exceptions

ArgumentException

No character set found for the encoding.

GetEncoding(string)

Returns the System.Text.Encoding corresponding to charset (DICOM Specific Character Set).

Encoding GetEncoding(string charset)

Parameters

charset string

Name of a DICOM character set (encoding).

Returns

Encoding

The System.Text.Encoding according to the given charset or Aspose.Medical.Common.Text.DicomEncoding.Default if the encoding is unknown.

Remarks

Allows some common misspellings such as redundant spaces, use of ISO-IR ### or ISO IR ### instead of ISO_IR ###.

GetEncodings(string[])

Returns a collection of System.Text.Encoding corresponding to the given charsets, where every charsets item is a name of the DICOM Specific Character Set.

Encoding[] GetEncodings(string[] charsets)

Parameters

charsets string []

List of DICOM Character Sets.

Returns

Encoding []

The collection of System.Text.Encoding specified in charsets.

RegisterEncoding(string, string)

Registers an encoding for a specific character set value.

void RegisterEncoding(string charsetName, string encodingName)

Parameters

charsetName string

The name of the character set as given in the Specific Character Set DICOM attribute.

encodingName string

The name of .NET encoding for the charsetName.

RegisterProvider(EncodingProvider)

Registers an encoding provider.

void RegisterProvider(EncodingProvider provider)

Parameters

provider EncodingProvider

A subclass of System.Text.EncodingProvider that provides access to additional character encodings. </byte></byte></byte></byte>