![]() |
VOOZH | about |
dotnet add package Aspose.Medical --version 26.3.0
NuGet\Install-Package Aspose.Medical -Version 26.3.0
<PackageReference Include="Aspose.Medical" Version="26.3.0" />
<PackageVersion Include="Aspose.Medical" Version="26.3.0" />Directory.Packages.props
<PackageReference Include="Aspose.Medical" />Project file
paket add Aspose.Medical --version 26.3.0
#r "nuget: Aspose.Medical, 26.3.0"
#:package Aspose.Medical@26.3.0
#addin nuget:?package=Aspose.Medical&version=26.3.0Install as a Cake Addin
#tool nuget:?package=Aspose.Medical&version=26.3.0Install as a Cake Tool
Product Page | Docs | Demos | API Reference | Examples | Blog | Releases | Free Support | Temporary License
Aspose.Medical for .NET is a cross-platform API that helps in developing applications with the ability to create, manipulate, inspect, or convert DICOM files and other medical imaging formats without any dependency.
Without having to install specialized medical imaging software or any 3rd party component, you can use Aspose.Medical to build different types of .NET applications, e.g., Windows Forms Apps, Windows Web Apps, as well as to deploy Web Services for medical image processing and analysis.
System.IO.Pipelines. Read and write DICOM files using Pipe, PipeReader, and PipeWriter for zero-allocation scenarios, producer/consumer patterns, and optimal async/await performance with fine-grained buffer control.DICOM: DCM files, DICOMDIR
Aspose.Medical for .NET can be used to build any type of .NET 8.0 application including ASP.NET, WCF & WinForms. The package provides assemblies to be used with .NET 8.0 on various flavors of Windows and Linux.
Aspose.Medical for .NET is actively under development with new features being added in each release. Version 26.3 introduces a pure C# High-Throughput JPEG 2000 (HTJ2K) codec implementation, adding platform-independent support for the HTJ2K transfer syntax.
Currently, there are some limitations regarding codec support:
We are continuously improving the library based on user feedback and industry needs. Future releases will add support for additional transfer syntaxes and enhance existing codec functionality. If you have specific requirements or encounter any issues, please share your feedback through our support forum to help us prioritize development efforts.
Execute Install-Package Aspose.Medical -Version 26.3 from Package Manager Console in Visual Studio to fetch the NuGet package. If you already have Aspose.Medical for .NET and want to upgrade the version, please execute Update-Package Aspose.Medical to get the latest version.
You can control memory usage when opening large DICOM files using different reading strategies and buffer tuning options.
// Configure file read options with buffer tuning
var options = new Aspose.Medical.Dicom.Readers.ReadDicomFileOptions
{
FallbackEncoding = System.Text.Encoding.UTF8,
BufferTuningOptions = new Aspose.Medical.Dicom.Readers.ReadBufferTuningOptions
{
BufferSize = 64 * 1024, // 64 KiB buffer
MinimumReadSize = 32 * 1024 // 32 KiB read size
}
};
// Strategy 1: Read all tags immediately (default behavior)
var dicomFileAll = Aspose.Medical.Dicom.DicomFile.Open("large_file.dcm",
options, Aspose.Medical.Dicom.Readers.TagDataReadingStrategies.ReadAll());
// Strategy 2: Defer loading of large tags (e.g., > 128 KB) until they are accessed
var dicomFileOnDemand = Aspose.Medical.Dicom.DicomFile.Open("large_file.dcm",
options, Aspose.Medical.Dicom.Readers.TagDataReadingStrategies.ReadLargeOnDemand(128));
// Large tags are loaded only when you access them, for example:
// var pixelData = dicomFileOnDemand.Dataset.GetValues<byte>(Aspose.Medical.Dicom.Tags.Tag.PixelData);
// Strategy 3: Skip large tags entirely to save memory
var dicomFileSkipLarge = Aspose.Medical.Dicom.DicomFile.Open("large_file.dcm",
options, Aspose.Medical.Dicom.Readers.TagDataReadingStrategies.SkipLargeTags(128));
// Create an empty DICOM file
var dicomFile = new Aspose.Medical.Dicom.DicomFile();
// Add data to the newly created DICOM file
dicomFile.Dataset.AddOrUpdate(Aspose.Medical.Dicom.Tags.Tag.PatientName, "John Doe");
dicomFile.Dataset.AddOrUpdate(Aspose.Medical.Dicom.Tags.Tag.PatientID, "12345");
dicomFile.Dataset.AddOrUpdate(Aspose.Medical.Dicom.Tags.Tag.PatientBirthDate, new DateOnly(1980, 1, 1));
dicomFile.Dataset.AddOrUpdate(Aspose.Medical.Dicom.Tags.Tag.StudyDate, new DateOnly(2025, 3, 25));
dicomFile.Dataset.AddOrUpdate(Aspose.Medical.Dicom.Tags.Tag.XAAcquisitionFrameRate, 17.95);
// Save the DICOM file
dicomFile.Save("output.dcm");
// Load a DICOM file
var dcmFile = Aspose.Medical.Dicom.DicomFile.Open("sample.dcm");
var dataset = dcmFile.Dataset;
// Serialize dataset to XML
// Ensure the Aspose.Medical.Dicom.Serialization namespace is imported
string xmlString = Aspose.Medical.Dicom.Serialization.DicomXmlSerializer.Serialize(dataset);
System.Console.WriteLine("DICOM as XML:\n" + xmlString);
// Deserialize XML back to Dataset
var deserializedDatasetFromXml = Aspose.Medical.Dicom.Serialization.DicomXmlSerializer.Deserialize(xmlString);
if (deserializedDatasetFromXml != null && deserializedDatasetFromXml.Contains(Aspose.Medical.Dicom.Tags.Tag.PatientName))
{
System.Console.WriteLine("Deserialized Patient Name from XML: " + deserializedDatasetFromXml.GetSingleValue<string>(Aspose.Medical.Dicom.Tags.Tag.PatientName));
}
// Load a DICOM file
var dcmFile = Aspose.Medical.Dicom.DicomFile.Open("sample.dcm");
var dataset = dcmFile.Dataset;
// Serialize dataset to JSON
// Ensure the Aspose.Medical.Dicom.Serialization namespace is imported
string? jsonString = Aspose.Medical.Dicom.Serialization.DicomJsonSerializer.Serialize(dataset, writeIndented: true);
System.Console.WriteLine("DICOM as JSON:\n" + jsonString);
// Deserialize JSON back to Dataset
var deserializedDataset = Aspose.Medical.Dicom.Serialization.DicomJsonSerializer.Deserialize(jsonString);
if (deserializedDataset != null && deserializedDataset.Contains(Aspose.Medical.Dicom.Tags.Tag.PatientName))
{
System.Console.WriteLine("Deserialized Patient Name: " + deserializedDataset.GetSingleValue<string>(Aspose.Medical.Dicom.Tags.Tag.PatientName));
}
// Load a DICOM file
var dicomFile = Aspose.Medical.Dicom.DicomFile.Open("input.dcm");
// Get the total number of frames
int frameCount = dicomFile.NumberOfFrames;
Console.WriteLine($"Total Frames: {frameCount}");
// Render the first frame
var rawImage = dicomFile.RenderImage(0);
// Display image properties
Console.WriteLine($"Image Dimensions: {rawImage.Width} x {rawImage.Height}");
// Access pixel values if needed
var pixelColor = rawImage[10, 10];
Console.WriteLine($"Pixel at (10,10): R={pixelColor.R}, G={pixelColor.G}, B={pixelColor.B}");
// Load a DICOM file
var dicomFile = Aspose.Medical.Dicom.DicomFile.Open("input.dcm");
// Create an anonymizer with the default profile
var anonymizer = new Aspose.Medical.Dicom.Anonymization.Anonymizer();
// Anonymize the DICOM file
var anonymizedFile = anonymizer.Anonymize(dicomFile);
// Save the anonymized file
anonymizedFile.Save("anonymized_output.dcm");
// Load existing file
var dcm = Aspose.Medical.Dicom.DicomFile.Open("input.dcm");
// Transcode the loaded file to JPEG 2000 Lossless Transfer Syntax
var transcodedDcm = dcm.Transcode(Aspose.Medical.Dicom.TransferSyntax.Jpeg2000Lossless);
// Save the transcoded file
transcodedDcm.Save("transcoded_output.dcm");
// Read DICOM from PipeReader for async producer/consumer scenarios
var pipeOptions = new Aspose.Medical.Dicom.Readers.ReadDicomPipeOptions
{
FallbackEncoding = System.Text.Encoding.UTF8
};
System.IO.Pipelines.Pipe pipe = new System.IO.Pipelines.Pipe();
var dcm = Aspose.Medical.Dicom.DicomFile.Open(pipe, pipeOptions,
Aspose.Medical.Dicom.Readers.TagDataReadingStrategies.ReadAll());
// Save DICOM to PipeWriter with buffer tuning
var saveOptions = new Aspose.Medical.Dicom.Writers.SaveDicomToStreamOptions
{
BufferTuningOptions = new Aspose.Medical.Dicom.Writers.WriteBufferTuningOptions
{
MinimumSegmentSizeBytes = 64 * 1024,
ProducerFlushThresholdBytes = 256 * 1024
}
};
using var stream = new System.IO.MemoryStream();
dcm.Save(stream, saveOptions);
// Set up metered license
var metered = new Aspose.Medical.Metered();
metered.SetMeteredKey("your-public-key", "your-private-key");
// Verify license status
bool isLicensed = metered.IsMeteredLicensed();
// Get consumption metrics
decimal consumedQuantity = metered.GetConsumptionQuantity();
decimal consumedCredit = metered.GetConsumptionCredit();
Product Page | Docs | Demos | API Reference | Examples | Blog | Releases | Free Support | Temporary License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on Aspose.Medical:
| Package | Downloads |
|---|---|
|
Aspose.Total
Aspose.Total for .NET is the most complete package of all .NET file format APIs offered by Aspose. It empowers developers to create, edit, render, print and convert between a wide range of popular document formats within any .NET, C#, ASP.NET and VB.NET applications. |
This package is not used by any popular GitHub repositories.