Class DicomJson
Inheritance
Inherited Members
Namespace: FellowOakDicom.Serialization
Assembly: fo-dicom.core.dll
Syntax
public static class DicomJson
Methods
ConvertDicomToJson(DicomDataset, Boolean, Boolean, NumberSerializationMode)
Converts a DicomDataset to a Json-String.
Declaration
public static string ConvertDicomToJson(DicomDataset dataset, bool writeTagsAsKeywords = false, bool formatIndented = false, NumberSerializationMode numberSerializationMode = NumberSerializationMode.AsNumber)
Parameters
Type | Name | Description |
---|---|---|
DicomDataset | dataset | |
System.Boolean | writeTagsAsKeywords | Whether to write the json keys as DICOM keywords instead of tags. This makes the json non-compliant to DICOM JSON. |
System.Boolean | formatIndented | Gets or sets a value that defines whether JSON should use pretty printing. By default, JSON is serialized without any extra white space. |
NumberSerializationMode | numberSerializationMode | Defines how numbers should be serialized. Defaults to 'AsNumber', which will throw FormatException when a number is not parsable. |
Returns
Type | Description |
---|---|
System.String |
ConvertDicomToJson(IEnumerable<DicomDataset>, Boolean, Boolean)
Converts an array or list of DicomDataset to a Json-String.
Declaration
public static string ConvertDicomToJson(IEnumerable<DicomDataset> dataset, bool writeTagsAsKeywords = false, bool formatIndented = false)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<DicomDataset> | dataset | |
System.Boolean | writeTagsAsKeywords | Whether to write the json keys as DICOM keywords instead of tags. This makes the json non-compliant to DICOM JSON. |
System.Boolean | formatIndented | Gets or sets a value that defines whether JSON should use pretty printing. By default, JSON is serialized without any extra white space. |
Returns
Type | Description |
---|---|
System.String |
ConvertJsonToDicom(String, Boolean)
Converts a Json-String to a DicomDataset.
Declaration
public static DicomDataset ConvertJsonToDicom(string json, bool autoValidate = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | json | |
System.Boolean | autoValidate | Whether the content of DicomItems shall be validated as soon as they are added to the DicomDataset. |
Returns
Type | Description |
---|---|
DicomDataset |
ConvertJsonToDicomArray(String)
Declaration
public static DicomDataset[] ConvertJsonToDicomArray(string json)
Parameters
Type | Name | Description |
---|---|---|
System.String | json |
Returns
Type | Description |
---|---|
DicomDataset[] |