'DeclarationPublic Overloads Sub Write( _ ByVal Stream As System.IO.Stream _ )
public void Write( System.IO.Stream Stream )
Parameters
- Stream
The Stream to which to write.
The Stream to which to write.
'DeclarationPublic Overloads Sub Write( _ ByVal Stream As System.IO.Stream _ )
public void Write( System.IO.Stream Stream )
The Stream to which to write.
The stream may subsequently be read by the Read method or by other DICOM software.
This method is particularly suitable for use with Delphi, which provides access to streams via classes such as TStreamAdapter.
DicomDataSet ds = new DicomDataSet(); string pixelTransferSyntax = TransferSyntaxes.ExplicitVRLittleEndian; ds.Add(Keyword.SamplesPerPixel, 1); ds.Add(Keyword.PhotometricInterpretation, "MONOCHROME2"); ds.Add(Keyword.Rows, 512); ds.Add(Keyword.Columns, 512); ds.Add(Keyword.PixelSpacing, new float[] { 0.684f, 0.684f }); ds.Add(Keyword.BitsAllocated, 16); ds.Add(Keyword.BitsStored, 12); ds.Add(Keyword.HighBit, 11); ds.Add(Keyword.PixelRepresentation, 0); ds.Add(Keyword.WindowCenter, new int[] { 35, 50 }); ds.Add(Keyword.WindowWidth, new int[] { 350, 150 }); ds.Add(Keyword.RescaleIntercept, -1200); ds.Add(Keyword.RescaleSlope, 1); ds.SetPixelData(pixelTransferSyntax, getData); using (FileStream fs = new FileStream("Output_Dataset.dcm", FileMode.Create, FileAccess.Write)) { ds.Write(fs); } // Method private Stream getData(int arg) { return new FileStream("pixel.data", FileMode.Open, FileAccess.Read, FileShare.Read); }