Sets the binary value of an element.
public bool SetBinaryValue(
DicomElement element,
string fileName
)
Public Overloads Function SetBinaryValue( _
ByVal element As DicomElement, _
ByVal fileName As String _
) As Boolean
public:
bool SetBinaryValue(
DicomElement^ element,
String^ fileName
)
element
An item in the Data Set.
fileName
Path name of the file that contains the binary value to set.
True if the binary value of the Data Element was set successfully. false, if it could not set the binary value of the Data Element.
This method overwrites the value of the Data Element. The Value Length of the Data Element is then equal to the file length.
This example will replace the video stored in an existing DICOM Dataset with another one. The replacement video should have the same format, frame rate and compression as the originally stored one.
Note: This example assumes the replacement video has all the correct characteristics of a Dicom video and assumes that the tags found in the original dataset matches the video specs as well, if you need higher level video processing you need to use the medical SDK, which is supported only via the LEADTOOLS Medical Multimedia Module.
using Leadtools;
using Leadtools.Dicom;
public void Test_DicomDataSet_ReplaceVideoExample()
{
string src = @"DaDa_DVD_MPEG2.dcm";
string videoFile = @"DaDa_DVD_MPEG2.mpg";
string target = @"target.dcm";
DicomEngine.Startup();
DicomDataSet ds = new DicomDataSet();
ds.Load(src, DicomDataSetLoadFlags.None);
var pixelDataElement = ds.FindFirstElement(null, DicomTag.PixelData, true);
var itemElement = ds.GetChildElement(pixelDataElement, true);
itemElement = ds.GetNextElement(itemElement, true, true);
ds.SetBinaryValue(itemElement, videoFile);
ds.Save(target, 0);
DicomEngine.Shutdown();
Console.WriteLine("Test_DicomDataSet_ReplaceVideoExample Finished");
}
Imports Leadtools
Imports Leadtools.Dicom
Public Sub Test_DicomDataSet_ReplaceVideoExample()
Dim src As String = "DaDa_DVD_MPEG2.dcm"
Dim videoFile As String = "DaDa_DVD_MPEG2.mpg"
Dim target As String = "target.dcm"
DicomEngine.Startup()
Dim ds As DicomDataSet = New DicomDataSet()
ds.Load(src, DicomDataSetLoadFlags.None)
Dim pixelDataElement As DicomElement = ds.FindFirstElement(Nothing, DicomTag.PixelData, True)
Dim itemElement As DicomElement = ds.GetChildElement(pixelDataElement, True)
itemElement = ds.GetNextElement(itemElement, True, True)
ds.SetBinaryValue(itemElement, videoFile)
ds.Save(target, 0)
DicomEngine.Shutdown()
Console.WriteLine("Test_DicomDataSet_ReplaceVideoExample Finished")
End Sub
SetBinaryValue(DicomElement,IntPtr,Int32) Method
SetStringValue(DicomElement,string) Method
SetStringValue(DicomElement,string,DicomCharacterSetType) Method
SetStringValue(DicomElement,string[]) Method
SetStringValue(DicomElement,string[],DicomCharacterSetType) Method
SetStringValuePtr(DicomElement,IntPtr,int) Method
SetStringValuePtr(DicomElement,IntPtr,int,DicomCharacterSetType) Method
SetShortValue(DicomElement,Int16[],Int32) Method
SetIntValue(DicomElement,Int32[],Int32) Method
SetFloatValue(DicomElement,Single[],Int32) Method
SetDoubleValue(DicomElement,Double[],Int32) Method
SetDateValue(DicomElement,DicomDateValue[]) Method
SetTimeValue(DicomElement,DicomTimeValue[]) Method
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