SaveJson(DicomDataSet,string,DicomDataSetSaveJsonFlags) Method (original) (raw)
Summary
Saves the contents of the DICOM data set in DICOM (JavaScript Object Notation)JSON model format (specified in PS3.18) to the specified output file.
Syntax
Parameters
ds
The contents of this data set to be saved
fileName
The name of the output JSON file.
jsonFlags
Flags that affect how binary data and other information is saved in the JSON output file.
Example
This example loads a sample DICOM file, and saves the contents as a JSON file, where the binary data is exported as InlineBinary base64
using Leadtools.Dicom;
using Leadtools.Dicom.Common;
using Leadtools.Dicom.Common.Extensions;
using Leadtools;
using Leadtools.Dicom.Common.Linq.BasicDirectory;
using Leadtools.Dicom.Common.DataTypes;
using Leadtools.Codecs;
public static void SaveJsonExample()
{
string dicomFileNameIn = Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm");
string xmlFileNameOut = Path.Combine(LEAD_VARS.ImagesDir, "test.json");
DicomEngine.Startup();
DicomDataSet ds = new DicomDataSet();
// Load an existing DICOM file
ds.Load(dicomFileNameIn, DicomDataSetLoadFlags.None);
ds.SaveJson(xmlFileNameOut, DicomDataSetSaveJsonFlags.InlineBinary);
DicomEngine.Shutdown();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
Leadtools.Dicom.Common Assembly