Class DicomFile
Representation of one DICOM file.
Inherited Members
Namespace: Dicom
Assembly: cs.temp.dll.dll
Syntax
public class DicomFile
Constructors
DicomFile()
Declaration
public DicomFile()
DicomFile(DicomDataset)
Declaration
public DicomFile(DicomDataset dataset)
Parameters
Type | Name | Description |
---|---|---|
DicomDataset | dataset |
Properties
Dataset
Gets the DICOM dataset of the file.
Declaration
public DicomDataset Dataset { get; protected set; }
Property Value
Type | Description |
---|---|
DicomDataset |
File
Gets the file reference of the DICOM file.
Declaration
public IFileReference File { get; protected set; }
Property Value
Type | Description |
---|---|
IFileReference |
FileMetaInfo
Gets the DICOM file meta information of the file.
Declaration
public DicomFileMetaInformation FileMetaInfo { get; protected set; }
Property Value
Type | Description |
---|---|
DicomFileMetaInformation |
Format
Gets the DICOM file format.
Declaration
public DicomFileFormat Format { get; protected set; }
Property Value
Type | Description |
---|---|
DicomFileFormat |
IsPartial
Gets whether the parsing of the file ended prematurely.
Declaration
public bool IsPartial { get; protected set; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
HasValidHeader(String)
Test if file has a valid preamble and DICOM 3.0 header.
Declaration
public static bool HasValidHeader(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path | Path to file |
Returns
Type | Description |
---|---|
Boolean | True if valid DICOM 3.0 file header is detected. |
OnSave()
Method to call before performing the actual saving.
Declaration
protected virtual void OnSave()
Open(Stream, FileReadOption)
Read a DICOM file from stream.
Declaration
public static DicomFile Open(Stream stream, FileReadOption readOption = FileReadOption.Default)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | Stream to read. |
FileReadOption | readOption | The option how to deal with large DICOM tags like pixel data. |
Returns
Type | Description |
---|---|
DicomFile | Read DicomFile. |
Open(Stream, Encoding, Func<ParseState, Boolean>, FileReadOption)
Read a DICOM file from stream.
Declaration
public static DicomFile Open(Stream stream, Encoding fallbackEncoding, Func<ParseState, bool> stop = null, FileReadOption readOption = FileReadOption.Default)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | Stream to read. |
Encoding | fallbackEncoding | Encoding to use if encoding cannot be obtained from DICOM file. |
Func<ParseState, Boolean> | stop | Stop criterion in dataset. |
FileReadOption | readOption | The option how to deal with large DICOM tag like pixel data |
Returns
Type | Description |
---|---|
DicomFile | Read DicomFile. |
Open(String, FileReadOption)
Reads the specified filename and returns a DicomFile object. Note that the values for large DICOM elements (e.g. PixelData) are read in "on demand" to conserve memory. Large DICOM elements are determined by their size in bytes - see the default value for this in the FileByteSource._largeObjectSize
Declaration
public static DicomFile Open(string fileName, FileReadOption readOption = FileReadOption.Default)
Parameters
Type | Name | Description |
---|---|---|
String | fileName | The filename of the DICOM file |
FileReadOption | readOption | An option how to deal with large dicom tags like pixel data. |
Returns
Type | Description |
---|---|
DicomFile | DicomFile instance |
Open(String, Encoding, Func<ParseState, Boolean>, FileReadOption)
Reads the specified filename and returns a DicomFile object. Note that the values for large DICOM elements (e.g. PixelData) are read in "on demand" to conserve memory. Large DICOM elements are determined by their size in bytes - see the default value for this in the FileByteSource._largeObjectSize
Declaration
public static DicomFile Open(string fileName, Encoding fallbackEncoding, Func<ParseState, bool> stop = null, FileReadOption readOption = FileReadOption.Default)
Parameters
Type | Name | Description |
---|---|---|
String | fileName | The filename of the DICOM file |
Encoding | fallbackEncoding | Encoding to apply when attribute Specific Character Set is not available. |
Func<ParseState, Boolean> | stop | Stop criterion in dataset. |
FileReadOption | readOption |
Returns
Type | Description |
---|---|
DicomFile | DicomFile instance |
OpenAsync(Stream, FileReadOption)
Asynchronously read a DICOM file from stream.
Declaration
public static Task<DicomFile> OpenAsync(Stream stream, FileReadOption readOption = FileReadOption.Default)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | Stream to read. |
FileReadOption | readOption | The option how to deal with large DICOM tags like pixel data. |
Returns
Type | Description |
---|---|
Task<DicomFile> | Awaitable DicomFile instance. |
OpenAsync(Stream, Encoding, Func<ParseState, Boolean>, FileReadOption)
Asynchronously read a DICOM file from stream.
Declaration
public static async Task<DicomFile> OpenAsync(Stream stream, Encoding fallbackEncoding, Func<ParseState, bool> stop = null, FileReadOption readOption = FileReadOption.Default)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | Stream to read. |
Encoding | fallbackEncoding | Encoding to use if encoding cannot be obtained from DICOM file. |
Func<ParseState, Boolean> | stop | Stop criterion in dataset. |
FileReadOption | readOption | The option how to deal with large DICOM tags like pixel data. |
Returns
Type | Description |
---|---|
Task<DicomFile> | Awaitable DicomFile instance. |
OpenAsync(String, FileReadOption)
Asynchronously reads the specified filename and returns a DicomFile object. Note that the values for large DICOM elements (e.g. PixelData) are read in "on demand" to conserve memory. Large DICOM elements are determined by their size in bytes - see the default value for this in the FileByteSource._largeObjectSize
Declaration
public static Task<DicomFile> OpenAsync(string fileName, FileReadOption readOption = FileReadOption.Default)
Parameters
Type | Name | Description |
---|---|---|
String | fileName | The filename of the DICOM file |
FileReadOption | readOption | The option how to deal with large dicom tags like pixel data. |
Returns
Type | Description |
---|---|
Task<DicomFile> | Awaitable DicomFile instance. |
OpenAsync(String, Encoding, Func<ParseState, Boolean>, FileReadOption)
Asynchronously reads the specified filename and returns a DicomFile object. Note that the values for large DICOM elements (e.g. PixelData) are read in "on demand" to conserve memory. Large DICOM elements are determined by their size in bytes - see the default value for this in the FileByteSource._largeObjectSize
Declaration
public static async Task<DicomFile> OpenAsync(string fileName, Encoding fallbackEncoding, Func<ParseState, bool> stop = null, FileReadOption readOption = FileReadOption.Default)
Parameters
Type | Name | Description |
---|---|---|
String | fileName | The filename of the DICOM file |
Encoding | fallbackEncoding | Encoding to apply when attribute Specific Character Set is not available. |
Func<ParseState, Boolean> | stop | Stop criterion in dataset. |
FileReadOption | readOption |
Returns
Type | Description |
---|---|
Task<DicomFile> | Awaitable DicomFile instance. |
Save(Stream, DicomWriteOptions)
Save DICOM file to stream.
Declaration
public void Save(Stream stream, DicomWriteOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | Stream on which to save DICOM file. |
DicomWriteOptions | options | Options to apply during writing. |
Save(String, DicomWriteOptions)
Save DICOM file.
Declaration
public void Save(string fileName, DicomWriteOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | fileName | File name. |
DicomWriteOptions | options | Options to apply during writing. |
SaveAsync(Stream, DicomWriteOptions)
Asynchronously save DICOM file to stream.
Declaration
public async Task SaveAsync(Stream stream, DicomWriteOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | Stream on which to save DICOM file. |
DicomWriteOptions | options | Options to apply during writing. |
Returns
Type | Description |
---|---|
Task | Awaitable task. |
SaveAsync(String, DicomWriteOptions)
Save to file asynchronously.
Declaration
public async Task SaveAsync(string fileName, DicomWriteOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | fileName | Name of file. |
DicomWriteOptions | options | Options to apply during writing. |
Returns
Type | Description |
---|---|
Task | Awaitable |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | A string that represents the current object. |