public long Tag { get; set; }
The tag of the DICOM element that is about to be added to the DicomDataSet.
Modifying Tag changes the element that is added to the DicomDataSet.
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 void LoadJsonCallbackExample(){string dicomFileNameIn = Path.Combine(LEAD_VARS.ImagesDir,"DICOM", "image2.dcm");string jsonFileNameOut = Path.Combine(LEAD_VARS.ImagesDir, "test.json");string dicomFileNameOut = Path.Combine(LEAD_VARS.ImagesDir, "test.dcm");// Initialize DICOM engineDicomEngine.Startup();DicomDataSet ds = new DicomDataSet();// Load an existing DICOM fileds.Load(dicomFileNameIn, DicomDataSetLoadFlags.None);// Save as JSON to a file with no binary data// For the demo, keep the json output file size small by skipping the pixel data// Use the SaveJsonCallback delegate to customize the json fileDicomDataSetSaveJsonFlags jsonFlags =DicomDataSetSaveJsonFlags.IgnoreBinaryData |DicomDataSetSaveJsonFlags.TrimWhiteSpace;ds.SaveJson(jsonFileNameOut, jsonFlags);// Use a LoadmlCallback to read the customized json fileds.LoadJson(jsonFileNameOut, DicomDataSetLoadJsonFlags.None, MyLoadJsonBeforeElementCallback, MyLoadJsonAfterElementCallback);// Save the result -- there will be no pixel datads.Save(dicomFileNameOut, DicomDataSetSaveFlags.None);DicomEngine.Shutdown();}private static bool MyLoadJsonBeforeElementCallback(LoadJsonBeforeElementData data){// Remove Patient Birth Dateif (data.Tag == DicomTag.PatientBirthDate){return false;}// Change the patient nameif (data.Tag == DicomTag.PatientName){data.ElementValue = "NewLast^NewFirst";}// Write the elements to the consolee that have child elementsif (data.HasChildElements){Console.WriteLine("Element {0} has child elements.", data.Tag);}return true;}private static void MyLoadJsonAfterElementCallback(LoadJsonAfterElementData data){if (data.DicomElement.Tag == DicomTag.PixelData){// here you could call one of the following to set the pixel data// data.DicomDataSet.SetBinaryValue// data.DicomDataSet.SetImage()}}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
