private void OnCompletePreamble(IByteTarget target, object state) { DicomWriter writer = new DicomWriter(DicomTransferSyntax.ExplicitVRLittleEndian, _options, _target); DicomDatasetWalker walker = new DicomDatasetWalker(_fileMetaInfo); walker.BeginWalk(writer, OnCompleteFileMetaInfo, walker); }
private void OnCompletePreamble(IByteTarget target, object state) { // recalculate FMI group length as required by standard _fileMetaInfo.RecalculateGroupLengths(); DicomWriter writer = new DicomWriter(DicomTransferSyntax.ExplicitVRLittleEndian, _options, _target); DicomDatasetWalker walker = new DicomDatasetWalker(_fileMetaInfo); walker.BeginWalk(writer, OnCompleteFileMetaInfo, walker); }
private void OnCompleteFileMetaInfo(IAsyncResult result) { try { DicomDatasetWalker walker; if (result != null) { walker = result.AsyncState as DicomDatasetWalker; walker.EndWalk(result); } DicomTransferSyntax syntax = _fileMetaInfo.TransferSyntax; DicomWriter writer = new DicomWriter(syntax, _options, _target); walker = new DicomDatasetWalker(_dataset); walker.BeginWalk(writer, OnCompleteDataset, walker); } catch (Exception e) { _exception = e; _async.Set(); } }
private void OnCompleteFileMetaInfo(IAsyncResult result) { try { DicomDatasetWalker walker; if (result != null) { walker = result.AsyncState as DicomDatasetWalker; walker.EndWalk(result); } //DicomTransferSyntax syntax = _fileMetaInfo.TransferSyntax; DicomTransferSyntax syntax = _fileMetaInfo.InternalTransferSyntax; if (_options.KeepGroupLengths) { // update transfer syntax and recalculate existing group lengths _dataset.InternalTransferSyntax = syntax; _dataset.RecalculateGroupLengths(false); } else { // remove group lengths as suggested in PS 3.5 7.2 // // 2. It is recommended that Group Length elements be removed during storage or transfer // in order to avoid the risk of inconsistencies arising during coercion of data // element values and changes in transfer syntax. _dataset.RemoveGroupLengths(); } DicomWriter writer = new DicomWriter(syntax, _options, _target); walker = new DicomDatasetWalker(_dataset); walker.BeginWalk(writer, OnCompleteDataset, walker); } catch (Exception e) { _exception = e; _async.Set(); } }
private void OnCompleteFileMetaInfo(IAsyncResult result) { try { DicomDatasetWalker walker; if (result != null) { walker = result.AsyncState as DicomDatasetWalker; walker.EndWalk(result); } DicomTransferSyntax syntax = _fileMetaInfo.TransferSyntax; if (_options.KeepGroupLengths) { // update transfer syntax and recalculate existing group lengths _dataset.InternalTransferSyntax = syntax; _dataset.RecalculateGroupLengths(false); } else { // remove group lengths as suggested in PS 3.5 7.2 // // 2. It is recommended that Group Length elements be removed during storage or transfer // in order to avoid the risk of inconsistencies arising during coercion of data // element values and changes in transfer syntax. _dataset.RemoveGroupLengths(); } DicomWriter writer = new DicomWriter(syntax, _options, _target); walker = new DicomDatasetWalker(_dataset); walker.BeginWalk(writer, OnCompleteDataset, walker); } catch (Exception e) { _exception = e; _async.Set(); } }