Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.3.25
|
Leadtools.Dicom Namespace > DicomDataSet Class > ChangeTransferSyntax Method : ChangeTransferSyntax(String,String,Int32,ChangeTransferSyntaxFlags,DicomDataSetSaveFlags) Method |
public void ChangeTransferSyntax( string outFile, string uid, int qualityFactor, ChangeTransferSyntaxFlags flags, DicomDataSetSaveFlags saveFlags )
'Declaration
Public Overloads Sub ChangeTransferSyntax( _ ByVal outFile As String, _ ByVal uid As String, _ ByVal qualityFactor As Integer, _ ByVal flags As ChangeTransferSyntaxFlags, _ ByVal saveFlags As DicomDataSetSaveFlags _ )
'Usage
Dim instance As DicomDataSet Dim outFile As String Dim uid As String Dim qualityFactor As Integer Dim flags As ChangeTransferSyntaxFlags Dim saveFlags As DicomDataSetSaveFlags instance.ChangeTransferSyntax(outFile, uid, qualityFactor, flags, saveFlags)
public void ChangeTransferSyntax( string outFile, string uid, int qualityFactor, ChangeTransferSyntaxFlags flags, DicomDataSetSaveFlags saveFlags )
function Leadtools.Dicom.DicomDataSet.ChangeTransferSyntax(String,String,Int32,ChangeTransferSyntaxFlags,DicomDataSetSaveFlags)( outFile , uid , qualityFactor , flags , saveFlags )
public: void ChangeTransferSyntax( String^ outFile, String^ uid, int qualityFactor, ChangeTransferSyntaxFlags flags, DicomDataSetSaveFlags saveFlags )
This method will convert the DicomDataSet Transfer Syntax to the Transfer Syntax specified in uid, maintaining all elements and values in the the DicomDataSet. Additionally, the resulting DicomDataSet is saved as a file outFile using the characteristics specified by saveFlags.
This method does everything the function to ChangeTransferSyntax does, but additionally saves a DicomDataSet with the new transfer syntax at the location outFile with save options specified by saveFlags. Note that this overload should be used when trying to produce a file with the new transfer syntax, as opposed to the ChangeTransferSyntax overload followed by calling Save. Using this overload that produces a file directly will be significantly faster and use fewer resources (memory and disk), especially for large files.
Only the following DicomDataSetSaveFlags flags affect how the DicomDataSet is saved to disk.
The following DicomDataSetSaveFlags flags are ignored, and have no effect with how DicomDataSet is saved to disk. These flags are ignored because the transfer syntax specified by uid determines little endian versus big endian, as implicit VR versus explicit VR.
Passing null for outFile if you do not want to save the result as a file. In this case, the saveFlags are ignored. This is functionally equivalent to using the ChangeTransferSyntax overload .
For more details about changing the transfer syntax, see ChangeTransferSyntax.
This example will change the trasfer syntax of a DicomDataSet and save the result as a file.
Imports Leadtools Imports Leadtools.Dicom ''' <TestMethod> _ Public Sub Test_DicomDataSet_ChangeTransferSyntaxSample() Dim dicomFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "IMAGE2.dcm") Dim dicomResultFileHame As String = Path.Combine(LEAD_VARS.ImagesDir, "Result.dcm") DicomEngine.Startup() Using ds As New DicomDataSet() ds.Load(dicomFileName, DicomDataSetLoadFlags.None) ds.ChangeTransferSyntax(dicomResultFileHame, DicomUidType.ExplicitVRBigEndian, 0, ChangeTransferSyntaxFlags.None, DicomDataSetSaveFlags.None) End Using DicomEngine.Shutdown() End Sub ''' Public NotInheritable Class LEAD_VARS Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" End Class
using Leadtools; using Leadtools.Dicom; /// [TestMethod] public void Test_DicomDataSet_ChangeTransferSyntaxSample() { string dicomFileName = Path.Combine(LEAD_VARS.ImagesDir, "IMAGE2.dcm"); string dicomResultFileHame = Path.Combine(LEAD_VARS.ImagesDir, "Result.dcm"); DicomEngine.Startup(); using (DicomDataSet ds = new DicomDataSet()) { ds.Load(dicomFileName, DicomDataSetLoadFlags.None); ds.ChangeTransferSyntax(dicomResultFileHame, DicomUidType.ExplicitVRBigEndian, 0, ChangeTransferSyntaxFlags.None, DicomDataSetSaveFlags.None); } DicomEngine.Shutdown(); } /// static class LEAD_VARS { public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; }