Class DicomFile
Namespace: Aspose.Medical.Dicom
Assembly: Aspose.Medical.dll (25.11.0)
Encapsulates basic DICOM functionality.
public sealed class DicomFileInheritance
Inherited Members
object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Constructors
DicomFile(DicomFile)
Initializes a new instance of the Aspose.Medical.Dicom.DicomFile class using the data
from the given file.
public DicomFile(DicomFile file)Parameters
file DicomFile
A DICOM file with the initial data that will be copied to the newly created Aspose.Medical.Dicom.DicomFile.
Exceptions
The provided data are invalid.
A DICOM Data element can’t be cloned.
DicomFile(Dataset)
Initializes a new instance of the Aspose.Medical.Dicom.DicomFile class with the given dataset.
public DicomFile(Dataset dataset)Parameters
dataset Dataset
A DICOM dataset with the initial data.
DicomFile(MetaInformation, Dataset)
Initializes a new instance of the Aspose.Medical.Dicom.DicomFile class with the given dataset.
public DicomFile(MetaInformation metaInfo, Dataset dataset)Parameters
metaInfo MetaInformation
A DICOM File Meta Information.
dataset Dataset
A DICOM dataset with the initial data.
DicomFile()
Initializes a new instance of the Aspose.Medical.Dicom.DicomFile class.
public DicomFile()Properties
Dataset
DICOM File Dataset. Read-only Aspose.Medical.Dicom.DicomFile.Dataset.
public Dataset Dataset { get; }Property Value
MetaInfo
DICOM File Meta Information. Read-only Aspose.Medical.Dicom.MetaInformation.
public MetaInformation MetaInfo { get; }Property Value
NumberOfFrames
The number of frames in the DICOM file. Read-only, System.Int32.
public int NumberOfFrames { get; }Property Value
Methods
Open(Pipe, ReadDicomPipeOptions?, ITagDataReadingStrategy?)
Reads a DICOM file from a System.IO.Pipelines.Pipe and returns the Aspose.Medical.Dicom.DicomFile.
public static DicomFile Open(Pipe pipe, ReadDicomPipeOptions? options = null, ITagDataReadingStrategy? strategy = null)Parameters
pipe Pipe
The pipe supplying DICOM bytes (its System.IO.Pipelines.Pipe.Reader is used).
options ReadDicomPipeOptions
?
Pipe-read options (e.g., fallback encoding).
strategy ITagDataReadingStrategy
?
Tag data access strategy (e.g., immediate, deferred, or selective large-value handling).
Returns
The parsed Aspose.Medical.Dicom.DicomFile.
Open(PipeReader, ReadDicomPipeOptions?, ITagDataReadingStrategy?)
Reads a DICOM file from a System.IO.Pipelines.PipeReader and returns the Aspose.Medical.Dicom.DicomFile.
public static DicomFile Open(PipeReader pipeReader, ReadDicomPipeOptions? options = null, ITagDataReadingStrategy? strategy = null)Parameters
pipeReader PipeReader
The pipe reader supplying DICOM bytes.
options ReadDicomPipeOptions
?
Pipe-read options (e.g., fallback encoding).
strategy ITagDataReadingStrategy
?
Tag data access strategy (e.g., immediate, deferred, or selective large-value handling).
Returns
The parsed Aspose.Medical.Dicom.DicomFile.
Exceptions
Thrown when Aspose.Medical.Dicom.Readers.TagDataReadingStrategies.ReadLargeTagOnDemandStrategy is used (unsupported for pipe input).
Open(Stream, ReadDicomStreamOptions?, ITagDataReadingStrategy?)
Reads a DICOM file from a System.IO.Stream and returns the Aspose.Medical.Dicom.DicomFile.
public static DicomFile Open(Stream stream, ReadDicomStreamOptions? options = null, ITagDataReadingStrategy? strategy = null)Parameters
stream Stream
The stream containing DICOM data.
options ReadDicomStreamOptions
?
Stream-read options (fallback encoding, buffer tuning, etc.).
strategy ITagDataReadingStrategy
?
Tag data access strategy (e.g., immediate, deferred, or selective large-value handling).
Returns
The parsed Aspose.Medical.Dicom.DicomFile.
Exceptions
stream does not contain a valid DICOM file.
Open(string, ReadDicomFileOptions?, ITagDataReadingStrategy?)
Reads a DICOM file from a file path and returns the Aspose.Medical.Dicom.DicomFile.
public static DicomFile Open(string file, ReadDicomFileOptions? options = null, ITagDataReadingStrategy? strategy = null)Parameters
file string
The path to the DICOM file.
options ReadDicomFileOptions
?
File-read options (fallback encoding, buffer tuning, etc.).
strategy ITagDataReadingStrategy
?
Tag data access strategy (e.g., immediate, deferred, or selective large-value handling).
Returns
The parsed Aspose.Medical.Dicom.DicomFile.
Exceptions
file is null or whitespace.
The file specified by file was not found.
file is not a valid DICOM file.
RenderImage(int)
Renders the DICOM image stored at the given frameIndex
in Pixel Data into Aspose.Medical.Imaging.RawImage.
public IRawImage RenderImage(int frameIndex = 0)Parameters
frameIndex int
Zero-based indexed frame number.
Returns
The Aspose.Medical.Imaging.RawImage.
RenderImage(RenderOptions, int)
Renders the DICOM image stored at the given frameIndex
in Pixel Data into Aspose.Medical.Imaging.RawImage.
public IRawImage RenderImage(RenderOptions options, int frameIndex = 0)Parameters
options RenderOptions
Options that control rendering process.
frameIndex int
Zero-based indexed frame number.
Returns
The Aspose.Medical.Imaging.RawImage.
Save(string, SaveDicomToFileOptions?)
Saves DICOM file into the given file.
public void Save(string fileName, SaveDicomToFileOptions? options = null)Parameters
fileName string
Destination file name this DICOM file to be saved.
options SaveDicomToFileOptions
?
Save options.
Save(Stream, SaveDicomToStreamOptions?)
Saves DICOM file into the given stream.
public void Save(Stream stream, SaveDicomToStreamOptions? options = null)Parameters
stream Stream
Destination stream this DICOM file to be saved.
options SaveDicomToStreamOptions
?
Save options.
Save(PipeWriter, bool, SaveDicomToPipeOptions?)
Saves this DICOM file to a System.IO.Pipelines.PipeWriter using the specified save options.
public void Save(PipeWriter writer, bool completeOnDispose, SaveDicomToPipeOptions? options = null)Parameters
writer PipeWriter
The destination System.IO.Pipelines.PipeWriter that receives the serialized DICOM bytes.
completeOnDispose bool
When true, completes writer after the save finishes (during disposal of internal
resources);
when false, leaves the writer open for further use by the caller.
options SaveDicomToPipeOptions
?
Optional save options. When null, library defaults are used.
Save(Pipe, bool, SaveDicomToPipeOptions?)
Saves this DICOM file to a System.IO.Pipelines.Pipe using the specified save options.
public void Save(Pipe pipe, bool completeOnDispose, SaveDicomToPipeOptions? options = null)Parameters
pipe Pipe
The destination System.IO.Pipelines.Pipe whose System.IO.Pipelines.Pipe.Writer receives the serialized DICOM bytes. The caller is responsible for draining System.IO.Pipelines.Pipe.Reader.
completeOnDispose bool
When true, completes System.IO.Pipelines.Pipe.Writer after the save finishes (during disposal of internal resources); when false, leaves the writer open for further use by the caller.
options SaveDicomToPipeOptions
?
Optional save options. When null, library defaults are used.
Transcode(TransferSyntax)
Transcodes this Aspose.Medical.Dicom.DicomFile
from Aspose.Medical.Dicom.DicomFile.MetaInfo.Aspose.Medical.Dicom.MetaInformation.TransferSyntax
to the given syntax.
public DicomFile Transcode(TransferSyntax syntax)Parameters
syntax TransferSyntax
The destination transfer syntax DICOM file will be transcoded to.
Returns
The transcoded Aspose.Medical.Dicom.DicomFile.
Exceptions
Transcoding from Aspose.Medical.Dicom.DicomFile.MetaInfo.Aspose.Medical.Dicom.MetaInformation.TransferSyntax
to the given syntax is not supported.