Class DicomImage
İsim alanı : Aspose.Imaging.FileFormats.Dicom Toplantı: Aspose.Imaging.dll (25.4.0)
Bu Sınıf Dijital Görüntüleme ve İletişim’i Tıp’ta Uygulamaktadır(DICOM) raster görüntü formatını destekler ve kapsamlı bir çözüm sunarDICOM görüntüleri hassasiyet ve esneklik ile işleyebilirsiniz.Görüntü sayfalarını manipüle etmek, sayfaları almak, eklemek veya kaldırmak için işlemler de dahil olmak üzere; vevarsayılan ve aktif sayfaları kontrol edin. alfa kanalları ile çalışma yeteneği ile,XMP metadata, resize, rotate, crop, binarize, ayarlayın, filtre uygulayın,ve diğer raster biçimlerine dönüştürülür. bu API geliştiricilerin işlem yapmalarını sağlarDICOM görüntüleri etkili bir şekilde, çeşitli uygulama gereksinimlerini karşılayarakTıbbi Görüntüleme Çerçevesi.
[JsonObject(MemberSerialization.OptIn)]
public sealed class DicomImage : RasterCachedMultipageImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata, IMultipageImageExt, IMultipageImage
Inheritance
object ← DisposableObject ← DataStreamSupporter ← Image ← RasterImage ← RasterCachedImage ← RasterCachedMultipageImage ← DicomImage
Implements
IDisposable , IObjectWithBounds , IRasterImageArgb32PixelLoader , IRasterImageRawDataLoader , IHasXmpData , IHasMetadata , IMultipageImageExt , IMultipageImage
mirasçı üyeleri
RasterCachedMultipageImage.AdjustBrightness(int) , RasterCachedMultipageImage.AdjustContrast(float) , RasterCachedMultipageImage.AdjustGamma(float, float, float) , RasterCachedMultipageImage.AdjustGamma(float) , RasterCachedMultipageImage.Blend(Point, RasterImage, Rectangle, byte) , RasterCachedMultipageImage.BinarizeFixed(byte) , RasterCachedMultipageImage.BinarizeBradley(double, int) , RasterCachedMultipageImage.BinarizeBradley(double) , RasterCachedMultipageImage.BinarizeOtsu() , RasterCachedMultipageImage.Crop(Rectangle) , RasterCachedMultipageImage.Crop(int, int, int, int) , RasterCachedMultipageImage.Dither(DitheringMethod, int, IColorPalette) , RasterCachedMultipageImage.Grayscale() , RasterCachedMultipageImage.NormalizeHistogram() , RasterCachedMultipageImage.Rotate(float, bool, Color) , RasterCachedMultipageImage.RotateFlip(RotateFlipType) , RasterCachedMultipageImage.RotateFlipAll(RotateFlipType) , RasterCachedMultipageImage.Resize(int, int, ResizeType) , RasterCachedMultipageImage.Resize(int, int, ImageResizeSettings) , RasterCachedMultipageImage.ResizeWidthProportionally(int, ResizeType) , RasterCachedMultipageImage.ResizeHeightProportionally(int, ResizeType) , RasterCachedMultipageImage.ReplaceColor(int, byte, int) , RasterCachedMultipageImage.ReplaceNonTransparentColors(int) , RasterCachedMultipageImage.Filter(Rectangle, FilterOptionsBase) , RasterCachedMultipageImage.NormalizeAngle(bool, Color) , RasterCachedMultipageImage.CacheData() , RasterCachedMultipageImage.GetSerializedStream(ImageOptionsBase, Rectangle, out int) , RasterCachedMultipageImage.Height , RasterCachedMultipageImage.Width , RasterCachedMultipageImage.BitsPerPixel , RasterCachedMultipageImage.IsCached , RasterCachedMultipageImage.PageCount , RasterCachedMultipageImage.Pages , RasterCachedMultipageImage.HasAlpha , RasterCachedMultipageImage.HasTransparentColor , RasterCachedMultipageImage.ImageOpacity , RasterCachedMultipageImage.BackgroundColor , RasterCachedMultipageImage.XmpData , RasterCachedMultipageImage.PageExportingAction , RasterCachedImage.CacheData() , RasterCachedImage.Blend(Point, RasterImage, Rectangle, byte) , RasterCachedImage.Resize(int, int, ResizeType) , RasterCachedImage.Resize(int, int, ImageResizeSettings) , RasterCachedImage.RotateFlip(RotateFlipType) , RasterCachedImage.Rotate(float, bool, Color) , RasterCachedImage.Crop(Rectangle) , RasterCachedImage.Dither(DitheringMethod, int, IColorPalette) , RasterCachedImage.Grayscale() , RasterCachedImage.NormalizeHistogram() , RasterCachedImage.BinarizeFixed(byte) , RasterCachedImage.BinarizeOtsu() , RasterCachedImage.BinarizeBradley(double, int) , RasterCachedImage.BinarizeBradley(double) , RasterCachedImage.AdjustBrightness(int) , RasterCachedImage.AdjustContrast(float) , RasterCachedImage.AdjustGamma(float, float, float) , RasterCachedImage.AdjustGamma(float) , RasterCachedImage.IsCached , RasterImage.RemoveMetadata() , RasterImage.Save(Stream, ImageOptionsBase, Rectangle) , RasterImage.GetModifyDate(bool) , RasterImage.Dither(DitheringMethod, int) , RasterImage.Dither(DitheringMethod, int, IColorPalette) , RasterImage.GetDefaultPixels(Rectangle, IPartialArgb32PixelLoader) , RasterImage.GetDefaultRawData(Rectangle, IPartialRawDataLoader, RawDataSettings) , RasterImage.GetDefaultArgb32Pixels(Rectangle) , RasterImage.GetDefaultRawData(Rectangle, RawDataSettings) , RasterImage.GetArgb32Pixel(int, int) , RasterImage.GetPixel(int, int) , RasterImage.SetArgb32Pixel(int, int, int) , RasterImage.SetPixel(int, int, Color) , RasterImage.ReadScanLine(int) , RasterImage.ReadArgb32ScanLine(int) , RasterImage.WriteScanLine(int, Color[]) , RasterImage.WriteArgb32ScanLine(int, int[]) , RasterImage.LoadPartialArgb32Pixels(Rectangle, IPartialArgb32PixelLoader) , RasterImage.LoadPartialPixels(Rectangle, IPartialPixelLoader) , RasterImage.LoadArgb32Pixels(Rectangle) , RasterImage.LoadArgb64Pixels(Rectangle) , RasterImage.LoadPartialArgb64Pixels(Rectangle, IPartialArgb64PixelLoader) , RasterImage.LoadPixels(Rectangle) , RasterImage.LoadCmykPixels(Rectangle) , RasterImage.LoadCmyk32Pixels(Rectangle) , RasterImage.LoadRawData(Rectangle, RawDataSettings, IPartialRawDataLoader) , RasterImage.LoadRawData(Rectangle, Rectangle, RawDataSettings, IPartialRawDataLoader) , RasterImage.SaveRawData(byte[], int, Rectangle, RawDataSettings) , RasterImage.SaveArgb32Pixels(Rectangle, int[]) , RasterImage.SavePixels(Rectangle, Color[]) , RasterImage.SaveCmykPixels(Rectangle, CmykColor[]) , RasterImage.SaveCmyk32Pixels(Rectangle, int[]) , RasterImage.SetResolution(double, double) , RasterImage.SetPalette(IColorPalette, bool) , RasterImage.Resize(int, int, ImageResizeSettings) , RasterImage.Rotate(float, bool, Color) , RasterImage.Rotate(float) , RasterImage.BinarizeFixed(byte) , RasterImage.BinarizeOtsu() , RasterImage.BinarizeBradley(double) , RasterImage.BinarizeBradley(double, int) , RasterImage.Blend(Point, RasterImage, Rectangle, byte) , RasterImage.Blend(Point, RasterImage, byte) , RasterImage.Grayscale() , RasterImage.NormalizeHistogram() , RasterImage.AdjustBrightness(int) , RasterImage.AdjustContrast(float) , RasterImage.AdjustGamma(float, float, float) , RasterImage.AdjustGamma(float) , RasterImage.GetSkewAngle() , RasterImage.NormalizeAngle() , RasterImage.NormalizeAngle(bool, Color) , RasterImage.Filter(Rectangle, FilterOptionsBase) , RasterImage.ReplaceColor(Color, byte, Color) , RasterImage.ReplaceColor(int, byte, int) , RasterImage.ReplaceNonTransparentColors(Color) , RasterImage.ReplaceNonTransparentColors(int) , RasterImage.ToBitmap() , RasterImage.PremultiplyComponents , RasterImage.UseRawData , RasterImage.UpdateXmpData , RasterImage.XmpData , RasterImage.RawIndexedColorConverter , RasterImage.RawCustomColorConverter , RasterImage.RawFallbackIndex , RasterImage.RawDataSettings , RasterImage.UsePalette , RasterImage.RawDataFormat , RasterImage.RawLineSize , RasterImage.IsRawDataAvailable , RasterImage.HorizontalResolution , RasterImage.VerticalResolution , RasterImage.HasTransparentColor , RasterImage.HasAlpha , RasterImage.TransparentColor , RasterImage.ImageOpacity , Image.CanLoad(string) , Image.CanLoad(string, LoadOptions) , Image.CanLoad(Stream) , Image.CanLoad(Stream, LoadOptions) , Image.Create(ImageOptionsBase, int, int) , Image.Create(Image[]) , Image.Create(MultipageCreateOptions) , Image.Create(string[], bool) , Image.Create(string[]) , Image.Create(Image[], bool) , Image.GetFileFormat(string) , Image.GetFileFormat(Stream) , Image.GetFittingRectangle(Rectangle, int, int) , Image.GetFittingRectangle(Rectangle, int[], int, int) , Image.Load(string, LoadOptions) , Image.Load(string) , Image.Load(Stream, LoadOptions) , Image.Load(Stream) , Image.GetProportionalWidth(int, int, int) , Image.GetProportionalHeight(int, int, int) , Image.RemoveMetadata() , Image.CanSave(ImageOptionsBase) , Image.Resize(int, int) , Image.Resize(int, int, ResizeType) , Image.Resize(int, int, ImageResizeSettings) , Image.GetDefaultOptions(object[]) , Image.GetOriginalOptions() , Image.ResizeWidthProportionally(int) , Image.ResizeHeightProportionally(int) , Image.ResizeWidthProportionally(int, ResizeType) , Image.ResizeHeightProportionally(int, ResizeType) , Image.ResizeWidthProportionally(int, ImageResizeSettings) , Image.ResizeHeightProportionally(int, ImageResizeSettings) , Image.RotateFlip(RotateFlipType) , Image.Rotate(float) , Image.Crop(Rectangle) , Image.Crop(int, int, int, int) , Image.Save() , Image.Save(string) , Image.Save(string, ImageOptionsBase) , Image.Save(string, ImageOptionsBase, Rectangle) , Image.Save(Stream, ImageOptionsBase) , Image.Save(Stream, ImageOptionsBase, Rectangle) , Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int) , Image.SetPalette(IColorPalette, bool) , Image.BitsPerPixel , Image.Bounds , Image.Container , Image.Height , Image.Palette , Image.UsePalette , Image.Size , Image.Width , Image.InterruptMonitor , Image.BufferSizeHint , Image.AutoAdjustPalette , Image.HasBackgroundColor , Image.FileFormat , Image.BackgroundColor , DataStreamSupporter.CacheData() , DataStreamSupporter.Save() , DataStreamSupporter.Save(Stream) , DataStreamSupporter.Save(string) , DataStreamSupporter.Save(string, bool) , DataStreamSupporter.DataStreamContainer , DataStreamSupporter.IsCached , DisposableObject.Dispose() , DisposableObject.Disposed , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
DICOM kompresyonunda renk türünü değiştirin.
using (var inputImage = Image.Load("original.jpg"))
{
var options = new DicomOptions { ColorType = ColorType.Grayscale8Bit };
inputImage.Save("original_8Bit.dcm", options);
}
DICOM resiminde RLE kompresyonu kullanın.
using (var inputImage = Image.Load("original.jpg"))
{
var options = new DicomOptions
{
ColorType = ColorType.Rgb24Bit,
Compression = new Compression { Type = CompressionType.Rle }
};
inputImage.Save("original_RLE.dcm", options);
}
DICOM resiminde JPEG 2000 kompresyonu kullanın.
using (var inputImage = Image.Load("original.jpg"))
{
var options = new DicomOptions
{
ColorType = ColorType.Rgb24Bit,
Compression = new Compression
{
Type = CompressionType.Jpeg2000,
Jpeg2000 = new Jpeg2000Options
{
Codec = Jpeg2000Codec.Jp2,
Irreversible = false
}
}
};
inputImage.Save("original_JPEG2000.dcm", options);
}
DICOM resiminde JPEG kompresyonu kullanın.
using (var inputImage = Image.Load("original.jpg"))
{
var options = new DicomOptions
{
ColorType = ColorType.Rgb24Bit,
Compression = new Compression
{
Type = CompressionType.Jpeg,
Jpeg = new JpegOptions
{
CompressionType = JpegCompressionMode.Baseline,
SampleRoundingMode = SampleRoundingMode.Truncate,
Quality = 50
}
}
};
inputImage.Save("original_JPEG.dcm", options);
}
Bu örnek, bir dosya akışından bir DICOM görüntüsünü nasıl yüklediğinizi gösterir.
string dir = "c:\\temp\\";
// Load a DICOM image from a file stream.
using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "sample.dicom"))
{
using (Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = new Aspose.Imaging.FileFormats.Dicom.DicomImage(stream))
{
// Save each page as an individual PNG image.
foreach (Aspose.Imaging.FileFormats.Dicom.DicomPage dicomPage in dicomImage.DicomPages)
{
// Generate a file name based on the page index.
string fileName = string.Format("sample.{0}.png", dicomPage.Index);
// A DICOM page is a raster image, so all allowed operations with a raster image are applicable to a DICOM page.
dicomPage.Save(dir + fileName, new Aspose.Imaging.ImageOptions.PngOptions());
}
}
}
Bir çok sayfalık Dicom görüntüsü oluşturun.
using (DicomImage image = (DicomImage)Image.Create(
new DicomOptions() { Source = new StreamSource(new MemoryStream()) },
100,
100))
{
// Draw something using vector graphics
Graphics graphics = new Graphics(image);
graphics.FillRectangle(new SolidBrush(Color.BlueViolet), image.Bounds);
graphics.FillRectangle(new SolidBrush(Color.Aqua), 10, 20, 50, 20);
graphics.FillEllipse(new SolidBrush(Color.Orange), 30, 50, 70, 30);
// Save the pixels of the drawn image. They are now on the first page of the Dicom image.
int[] pixels = image.LoadArgb32Pixels(image.Bounds);
// Add a few pages after, making them darker
for (int i = 1; i < 5; i++)
{
DicomPage page = image.AddPage();
page.SaveArgb32Pixels(page.Bounds, pixels);
page.AdjustBrightness(i * 30);
}
// Add a few pages in front of the main page, making them brighter
for (int i = 1; i < 5; i++)
{
DicomPage page = image.InsertPage(0);
page.SaveArgb32Pixels(page.Bounds, pixels);
page.AdjustBrightness(-i * 30);
}
// Save the created multi-page image to the output file
image.Save("MultiPage.dcm");
}
Constructors
DicomImage(Sürücüler, int, int)
DicomImage sınıfının yeni bir örneğini çaba sarf etmeden başlatın.yapımcı, dicomOptions parametreleri kullanarak. geliştiriciler için mükemmelAspose.Imaging.FileFormats.Dicom.DicomImage nesneleri projelerinde hızlı ve verimli bir şekilde daldırmak.
public DicomImage(DicomOptions dicomOptions, int width, int height)
Parameters
dicomOptions
DicomOptions
Dicom seçenekleri
width
int
Genişlik için.
height
int
Yükseklik için.
DicomImage(Çıkış, LoadOptions)
DicomImage sınıfının yeni bir örneğini akıcı bir şekilde kullanarak başlatın veyüklemeBu yapımcı parametreleri seçenekleri. başlatmak isteyen geliştiriciler için idealdirAspose.Imaging.FileFormats.Dicom.DicomImage ile çalışmak projelerinde hızlı ve etkili bir şekilde nesneler.
public DicomImage(Stream stream, LoadOptions loadOptions)
Parameters
stream
Stream
akış için.
loadOptions
LoadOptions
Yükleme seçenekleri için.
Examples
Bu örnek, belirlenen hafıza sınırının içinde kalmak için bir dosya akışından bir DICOM görüntüsünü nasıl yükleyeceğinizi gösterir.
string dir = "c:\\temp\\";
// Load a DICOM image from a file stream.
using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "multiframe.dicom"))
{
// The max allowed size for all internal buffers is 256KB.
Aspose.Imaging.LoadOptions loadOptions = new Aspose.Imaging.LoadOptions();
loadOptions.BufferSizeHint = 256 * 1024;
using (Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = new Aspose.Imaging.FileFormats.Dicom.DicomImage(stream, loadOptions))
{
// Save each page as an individual PNG image.
foreach (Aspose.Imaging.FileFormats.Dicom.DicomPage dicomPage in dicomImage.DicomPages)
{
// Generate a file name based on the page index.
string fileName = string.Format("multiframe.{0}.png", dicomPage.Index);
// A DICOM page is a raster image, so all allowed operations with a raster image are applicable to a DICOM page.
dicomPage.Save(dir + fileName, new Aspose.Imaging.ImageOptions.PngOptions());
}
}
}
DicomImage(Stream)
Bir akış parametresi kullanarak DicomImage sınıfının yeni bir örneği oluşturunbu yapımcı. geliştiriciler için mükemmel bir şekilde başlatmak için aramak içinAspose.Imaging.FileFormats.Dicom.DicomImage projelerinde mevcut veri akışlarından nesneler.
public DicomImage(Stream stream)
Parameters
stream
Stream
akış için.
Examples
Bu örnek, bir dosya akışından bir DICOM görüntüsünü nasıl yüklediğinizi gösterir.
string dir = "c:\\temp\\";
// Load a DICOM image from a file stream.
using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "sample.dicom"))
{
using (Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = new Aspose.Imaging.FileFormats.Dicom.DicomImage(stream))
{
// Save each page as an individual PNG image.
foreach (Aspose.Imaging.FileFormats.Dicom.DicomPage dicomPage in dicomImage.DicomPages)
{
// Generate a file name based on the page index.
string fileName = string.Format("sample.{0}.png", dicomPage.Index);
// A DICOM page is a raster image, so all allowed operations with a raster image are applicable to a DICOM page.
dicomPage.Save(dir + fileName, new Aspose.Imaging.ImageOptions.PngOptions());
}
}
}
Properties
ActivePage
Bu sezgisel özellikle resmin aktif sayfasını yönetin. geliştiriciler için idealÇeşitli sayfa görüntüleri içinde sayfalar arasında dinamik olarak geçiş yapmak, verimliNavigasyon ve İşleme.
public DicomPage ActivePage { get; set; }
Mülkiyet Değer
Exceptions
Aktif sayfa başka bir görüntüye ait olduğu için ayarlanamaz.
ActivePageIndex
Bu sezgisel özellikle aktif sayfanın endeksini çaba sarf edin.Güncel sayfa endeksine hızlı erişim arayan geliştiriciler için idealdir.Görüntüler, verimli navigasyon ve işleme sağlar.
public int ActivePageIndex { get; }
Mülkiyet Değer
DicomPages
Bu sezgisel özellik ile görüntü sayfalarına erişin. geliştiriciler için idealGörüntünün içindeki bireysel sayfalarla etkileşime girmeyi amaçlamaktadır.Navigasyon ve manipülasyon.
public DicomPage[] DicomPages { get; }
Mülkiyet Değer
DicomPage […]
FileFormat
Bu sezgisel özellik ile dosya biçiminin değerini çabucak geri getirin.görüntü dosyası biçimine hızlı erişim arayan geliştiriciler, verimliDosya türüne göre işleme ve işleme.
public override FileFormat FileFormat { get; }
Mülkiyet Değer
FileInfo
Değerli başlık bilgilerini DICOM dosyasından çaba sarf etmeyin.İçgüdüsel özellikler. temel ayrıntılara hızlı erişim arayan geliştiriciler için idealDICOM dosyası içinde kapsüle edilmiştir, verilerin verimli bir şekilde çıkarılmasını ve analiz edilmesini sağlar.
public DicomImageInfo FileInfo { get; }
Mülkiyet Değer
HasAlpha
Görüntünün bu sezgisel ile çaba sarf etmeden bir alfa kanalı olup olmadığını tespit edinGörüntünün şeffaflığı olup olmadığını belirlemek isteyen geliştiriciler için idealdir.Bilgi, görüntü işleme görevlerinde alfa kanal verilerinin doğru işlenmesini sağlamak.
public override bool HasAlpha { get; }
Mülkiyet Değer
PageCount
Bu sezgisel özellik ile resmin toplam sayfa sayısını geri getirin.bir görüntü içindeki sayfa sayısına hızlı erişim arayan geliştiriciler,Güçlü navigasyon ve yönetim.
public override int PageCount { get; }
Mülkiyet Değer
Pages
Bu sezgisel özellik ile görüntü sayfalarına erişin. geliştiriciler için idealGörüntünün içindeki bireysel sayfalarla etkileşim kurmaya çalışmak, kayıtsız navigasyon sağlamakve manipülasyon.
public override Image[] Pages { get; }
Mülkiyet Değer
Image […]
Methods
AddPage(RasterImage)
Görüntü koleksiyonunuzu bu sezgisel yöntemle yeni bir sayfa ekleyerek genişletin.Çok sayfalık resimlere sayfa eklemeyi dinamik olarak arayan geliştiriciler için idealdir,Görüntü içeriğinin sınırsız genişlemesini ve organizasyonunu sağlamak.
public void AddPage(RasterImage page)
Parameters
page
RasterImage
eklemek için sayfa.
Exceptions
page’ is null.
AddPage()
Bu basit yöntemle resmin sayfa listesinin sonuna yeni bir sayfa ekleyin.Çok sayfalık görüntüleri dinamik olarak genişletmek isteyen geliştiriciler için idealdir.Görüntü içeriğinin entegrasyonu ve organizasyonu.
public DicomPage AddPage()
Returns
Yeni oluşturulan Aspose.Imaging.FileFormats.Dicom.DicomPage.
Examples
Bir çok sayfalık Dicom görüntüsü oluşturun.
using (DicomImage image = (DicomImage)Image.Create(
new DicomOptions() { Source = new StreamSource(new MemoryStream()) },
100,
100))
{
// Draw something using vector graphics
Graphics graphics = new Graphics(image);
graphics.FillRectangle(new SolidBrush(Color.BlueViolet), image.Bounds);
graphics.FillRectangle(new SolidBrush(Color.Aqua), 10, 20, 50, 20);
graphics.FillEllipse(new SolidBrush(Color.Orange), 30, 50, 70, 30);
// Save the pixels of the drawn image. They are now on the first page of the Dicom image.
int[] pixels = image.LoadArgb32Pixels(image.Bounds);
// Add a few pages after, making them darker
for (int i = 1; i < 5; i++)
{
DicomPage page = image.AddPage();
page.SaveArgb32Pixels(page.Bounds, pixels);
page.AdjustBrightness(i * 30);
}
// Add a few pages in front of the main page, making them brighter
for (int i = 1; i < 5; i++)
{
DicomPage page = image.InsertPage(0);
page.SaveArgb32Pixels(page.Bounds, pixels);
page.AdjustBrightness(-i * 30);
}
// Save the created multi-page image to the output file
image.Save("MultiPage.dcm");
}
AdjustBrightness(int ile)
brightness’ı ayarlayarak görüntü parlaklığını arttırır, geliştiricilerin görüntülerin parlaklığını mükemmel bir şekilde ton etmelerine olanak tanıyan aparametrik bir yöntemdir.Bu kullanıcı dostu fonksiyon geliştiricilerin görüntü parlaklığını kolayca manipüle etmelerini sağlar, görsel estetik üzerinde esneklik ve kontrol sağlar.
public override void AdjustBrightness(int brightness)
Parameters
brightness
int
Işık değeri.
Examples
Aşağıdaki örnek, bir DICOM görüntüsünün parlaklık düzeltmesini gerçekleştirir.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Set the brightness value. The accepted values of brightness are in the range [-255, 255].
dicomImage.AdjustBrightness(50);
dicomImage.Save(dir + "sample.AdjustBrightness.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
AdjustContrast(Floransa)
Aspose.Imaging.Image kontrastını bu kullanıcı dostu yöntemle geliştirin,ışık ve karanlık alanlar arasındaki farklılıklara ayarlanır. görsel netliği veGeliştiricilerin içgüdüsel kontrolü sağlamak için çaba sarf etmez.Optimal rendering için resim kontrastı.
public override void AdjustContrast(float contrast)
Parameters
contrast
float
Kontrast değeri ( aralığında [-100; 100])
Examples
Aşağıdaki örnek, bir DICOM görüntüsünün kontrast düzeltmesini gerçekleştirir.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Set the contrast value. The accepted values of contrast are in the range [-100f, 100f].
dicomImage.AdjustContrast(50f);
dicomImage.Save(dir + "sample.AdjustContrast.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
AdjustGamma(Floransa)
Görüntü kalitesini arttırır ve gamma düzeltme ile ayarlanır, güçlü bir teknikGörsel görünüm için mükemmel. görüntü optimize etmeyi amaçlayan geliştiriciler içinsunum, renk dengesini ayarlayın ve farklı renkler arasında tutarlı bir performans sağlamakcihazlar ve ortamlar.
public override void AdjustGamma(float gamma)
Parameters
gamma
float
Kırmızı, yeşil ve mavi kanallar için Gamma
Examples
Aşağıdaki örnek, bir DICOM görüntüsünün gamma düzeltmesini gerçekleştirir.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Set gamma coefficient for red, green and blue channels.
dicomImage.AdjustGamma(2.5f);
dicomImage.Save(dir + "sample.AdjustGamma.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
AdjustGamma(Yüzme, Yüzme ve Yüzme)
Gamma düzeltmeyi bağımsız olarak uygulayarak doğru renk ayarlarını elde edinBir resmin kırmızı, yeşil ve mavi bileşenleri için. bu yöntem doğruluğu sağlarrenk dengesi ve optimum görsel çıkış, granül arayan geliştiriciler için cateringGörüntü renderasyonu ve renk doğruluğu kontrolü.
public override void AdjustGamma(float gammaRed, float gammaGreen, float gammaBlue)
Parameters
gammaRed
float
Kırmızı Kanal Koşiförü için Gamma
gammaGreen
float
Gamma yeşil kanal koşulları
gammaBlue
float
Mavi Kanal Koefficient için Gamma
Examples
Aşağıdaki örnek, renk bileşenleri için farklı koşulları uygulayan bir DICOM görüntüsünün gamma düzeltmesini gerçekleştirir.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Set individual gamma coefficients for red, green and blue channels.
dicomImage.AdjustGamma(1.5f, 2.5f, 3.5f);
dicomImage.Save(dir + "sample.AdjustGamma.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
BinarizeBradley(Çifte , int)
Görüntüleri Bradley’in adaptif sınırlama algoritması ile ikili hale getirin.Gelişmiş performans için görüntü çerçevesi. geliştiriciler için idealGörüntüleri otomatik olarak parlaklıkta yerel değişikliklere dayanarak segment etme,Farklı aydınlatma koşullarında doğru nesne algılama ve çıkarma.
public override void BinarizeBradley(double brightnessDifference, int windowSize)
Parameters
brightnessDifference
double
Piksel arasındaki parlaklık farkı ve bir s x s penceresinin ortalamasıBu pikselin etrafında duruyoruz.
windowSize
int
Bu piksel etrafında yoğunlaşan piksel penceresinin boyutu s x s
Examples
Aşağıdaki örnek, Bradley’in adaptif çerçeve algoritması ile bir DICOM görüntüsünü belirlenen pencere boyutuna binerleştirir.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Binarize the image with a brightness difference of 5. The brightness is a difference between a pixel and the average of an 10 x 10 window of pixels centered around this pixel.
dicomImage.BinarizeBradley(5, 10);
dicomImage.Save(dir + "sample.BinarizeBradley5_10x10.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
BinarizeFixed(byte)
Görüntüyi önceden belirlenmiş bir sınırı kullanarak kolayca ikili bir biçimde dönüştürün.Bu basit yöntemle. görüntü basitleştirmek isteyen geliştiriciler için idealİşleme görevleri, görüntüyi ön ve arka plan bileşenlerine bölünerekBelirlenen yoğunluk seviyelerine göre.
public override void BinarizeFixed(byte threshold)
Parameters
threshold
byte
Eğer bir pikselin eşdeğer gri değeri sınırdan daha büyük ise, bir255’e göre, 0’a göre başka bir şey verilecektir.
Examples
Aşağıdaki örnek, önceden tanımlanmış çerçeve ile bir DICOM görüntüsünü ikili hale getirir. ikili görüntüler sadece 2 renk içerir - siyah ve beyaz.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Binarize the image with a threshold value of 127.
// If a corresponding gray value of a pixel is greater than 127, a value of 255 will be assigned to it, 0 otherwise.
dicomImage.BinarizeFixed(127);
dicomImage.Save(dir + "sample.BinarizeFixed.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
BinarizeOtsu()
Otsu çerçeve uygulamak görüntüyü ikili hale getirmek için, otomatik olarak optimumgörüntü histogramına dayalı sınır değeri. geliştiriciler için mükemmelgörüntülerin ön ve arka bölgelere bölünmesini sağlamak için güvenilir bir yöntemMinimum manuel müdahale
public override void BinarizeOtsu()
Examples
Aşağıdaki örnek, Otsu çerçevesi ile bir DICOM görüntüsünü ikili hale getirir. ikili görüntüler sadece 2 renk içerir - siyah ve beyaz.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Binarize the image with Otsu thresholding.
dicomImage.BinarizeOtsu();
dicomImage.Save(dir + "sample.BinarizeOtsu.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
CacheData()
Bu yöntem verileri verimli bir şekilde gizler, performansı optimize eder ve hızlı erişim sağlar.İhtiyaç duyulduğunda. geliştiriciler için ideal, kendi hızını ve verimliliğini arttırmak isteyenler içinBilgi kaynaklarını akıllıca yöneterek uygulamalar.
public override void CacheData()
Examples
Aşağıdaki örnek, bir DICOM görüntüsünün tüm sayfalarını nasıl gizleyeceğinizi gösterir.
string dir = "c:\\temp\\";
// Load an image from a DICOM file.
using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
// This call caches all the pages so that no additional data loading will be performed from the underlying data stream.
image.CacheData();
// Or you can cache the pages individually.
foreach (Aspose.Imaging.FileFormats.Dicom.DicomPage page in image.DicomPages)
{
page.CacheData();
}
}
Crop(Rectangle)
İstenmeyen alanları ortadan kaldırmak için görüntüyü yetiştirin ve bununla gerekli içeriğe odaklanın.basit yöntem. geliştiriciler görsel kompozisyonu özelleştirmek isteyen için idealGörüntüler, istenen mesajı etkili bir şekilde iletmelerini sağlar.
public override void Crop(Rectangle rectangle)
Parameters
rectangle
Rectangle
Doğrudan bir şekilde.
Examples
Aşağıdaki örnek bir DICOM görüntüsü toplanır. toplanma alanı Aspose.Imaging.Rectangle aracılığıyla belirtilir.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Crop the image. The cropping area is the rectangular central area of the image.
Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(dicomImage.Width / 4, dicomImage.Height / 4, dicomImage.Width / 2, dicomImage.Height / 2);
dicomImage.Crop(area);
// Save the cropped image to PNG
dicomImage.Save(dir + "sample.Crop.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
Crop(int , int , int , int , int)
Bu çok yönlü yöntemle değişiklikler uygulayarak görüntü kazma alanını ayarlayın.Geliştiriciler için mükemmel, tahıl sürecinin doğru kontrolü gerektiren geliştiriciler,Önemli detaylar saklanır ve gereksiz unsurları ortadan kaldırır.
public override void Crop(int leftShift, int rightShift, int topShift, int bottomShift)
Parameters
leftShift
int
Sağdaki değişim.
rightShift
int
Doğru değişim için.
topShift
int
Yukarıdaki değişim.
bottomShift
int
Aşağıdaki değişim.
Examples
Aşağıdaki örnek bir DICOM görüntüsü toplanır. toplanma alanı sol, üst, sağ, alt marjları aracılığıyla belirtilir.
string dir = @"c:\temp\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Crop again. Set a margin of 10% of the image size.
int horizontalMargin = dicomImage.Width / 10;
int verticalMargin = dicomImage.Height / 10;
dicomImage.Crop(horizontalMargin, horizontalMargin, verticalMargin, verticalMargin);
// Save the cropped image to PNG.
dicomImage.Save(dir + "sample.Crop.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
Dither(DitheringMethod, int, IColorPalette)
Mevcut görüntüyi bu basit bir şekilde uygulayarak güçlendirinMetoda. görüntüye dokunuş ve derinlik eklemeyi amaçlayan geliştiriciler için mükemmel,Görsel kalitesini ve genel çekiciliğini arttırmak.
public override void Dither(DitheringMethod ditheringMethod, int bitsCount, IColorPalette customPalette)
Parameters
ditheringMethod
DitheringMethod
Dithering yöntemini kullanır.
bitsCount
int
Son bitler Dithering için sayılır.
customPalette
IColorPalette
Dithering için geleneksel palet.
Examples
Aşağıdaki örnek bir DICOM görüntüsünü yükler ve farklı palet derinliği kullanılarak sınır ve sıvı dithering yapar.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Perform threshold dithering using 4-bit color palette which contains 16 colors.
// The more bits specified the higher quality and the bigger size of the output image.
// Note that only 1-bit, 4-bit and 8-bit palettes are supported at the moment.
dicomImage.Dither(Aspose.Imaging.DitheringMethod.ThresholdDithering, 4, null);
dicomImage.Save(dir + "sample.ThresholdDithering4.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Perform floyd dithering using 1-bit color palette which contains only 2 colors - black and white.
// The more bits specified the higher quality and the bigger size of the output image.
// Note that only 1-bit, 4-bit and 8-bit palettes are supported at the moment.
dicomImage.Dither(Aspose.Imaging.DitheringMethod.FloydSteinbergDithering, 1, null);
dicomImage.Save(dir + "sample.FloydSteinbergDithering1.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
Filter(Rectangle, FilterOptionsBase)
Görüntünüzün belirli alanlarını belirlenmiş filtreleri uygulayarak kolayca geliştirinBu yöntem geliştiricilerin doğru kontrolü sağlar.Görüntü manipülasyonu, hedefli ayarların istediği şekilde gerçekleştirilmesini sağlarGörsel etkiler kolaylıkla.
public override void Filter(Rectangle rectangle, FilterOptionsBase options)
Parameters
rectangle
Rectangle
Doğrudan bir şekilde.
options
FilterOptionsBase
Seçenekler için.
Examples
Aşağıdaki örnek, bir DICOM görüntüsüne çeşitli filtre türleri uygulanır.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Apply a median filter with a rectangle size of 5 to the entire image.
dicomImage.Filter(dicomImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.MedianFilterOptions(5));
dicomImage.Save(dir + "sample.MedianFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Apply a bilateral smoothing filter with a kernel size of 5 to the entire image.
dicomImage.Filter(dicomImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.BilateralSmoothingFilterOptions(5));
dicomImage.Save(dir + "sample.BilateralSmoothingFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Apply a Gaussian blur filter with a radius of 5 and a sigma value of 4.0 to the entire image.
dicomImage.Filter(dicomImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.GaussianBlurFilterOptions(5, 4.0));
dicomImage.Save(dir + "sample.GaussianBlurFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Apply a Gauss-Wiener filter with a radius of 5 and a smooth value of 4.0 to the entire image.
dicomImage.Filter(dicomImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.GaussWienerFilterOptions(5, 4.0));
dicomImage.Save(dir + "sample.GaussWienerFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Apply a motion wiener filter with a length of 5, a smooth value of 4.0 and an angle of 90.0 degrees to the entire image.
dicomImage.Filter(dicomImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.MotionWienerFilterOptions(10, 1.0, 90.0));
dicomImage.Save(dir + "sample.MotionWienerFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Apply a sharpen filter with a kernel size of 5 and a sigma value of 4.0 to the entire image.
dicomImage.Filter(dicomImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.SharpenFilterOptions(5, 4.0));
dicomImage.Save(dir + "sample.SharpenFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
Grayscale()
Görüntüleri grayscale temsillerine kolayca dönüştürmek, görsel basitleştirmekanaliz ve işleme görevleri. görüntü netliğini arttırmak isteyen geliştiriciler için mükemmel,Karmaşıklığı azaltmak ve verimli grayscale tabanlı algoritmaların kolaylaştırılmasıÇeşitli uygulamalar için.
public override void Grayscale()
Examples
Aşağıdaki örnek, renkli bir DICOM görüntüsünü gri ölçekli görüntüsüne dönüştürür. gri ölçekli görüntüler yalnızca gri gölgelerden oluşur ve yalnızca yoğunluk bilgileri taşır.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
dicomImage.Grayscale();
dicomImage.Save(dir + "sample.Grayscale.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
InsertPage(int ile)
Yeni bir sayfa bu sezgisel ile belirli bir indekse görüntü sayfa listesine girinGeliştiriciler, sayfaların düzenlenmesine doğru kontrol arayanlar için idealdir.Çeşitli sayfa görüntüleri, görüntü içeriğinin güvenli organizasyonunu ve özelleştirilmesini sağlar.
public DicomPage InsertPage(int pageIndex)
Parameters
pageIndex
int
Bu sayfanın indeksi.
Returns
Yeni oluşturulan Aspose.Imaging.FileFormats.Dicom.DicomPage.
Examples
Bir çok sayfalık Dicom görüntüsü oluşturun.
using (DicomImage image = (DicomImage)Image.Create(
new DicomOptions() { Source = new StreamSource(new MemoryStream()) },
100,
100))
{
// Draw something using vector graphics
Graphics graphics = new Graphics(image);
graphics.FillRectangle(new SolidBrush(Color.BlueViolet), image.Bounds);
graphics.FillRectangle(new SolidBrush(Color.Aqua), 10, 20, 50, 20);
graphics.FillEllipse(new SolidBrush(Color.Orange), 30, 50, 70, 30);
// Save the pixels of the drawn image. They are now on the first page of the Dicom image.
int[] pixels = image.LoadArgb32Pixels(image.Bounds);
// Add a few pages after, making them darker
for (int i = 1; i < 5; i++)
{
DicomPage page = image.AddPage();
page.SaveArgb32Pixels(page.Bounds, pixels);
page.AdjustBrightness(i * 30);
}
// Add a few pages in front of the main page, making them brighter
for (int i = 1; i < 5; i++)
{
DicomPage page = image.InsertPage(0);
page.SaveArgb32Pixels(page.Bounds, pixels);
page.AdjustBrightness(-i * 30);
}
// Save the created multi-page image to the output file
image.Save("MultiPage.dcm");
}
Exceptions
pageIndex’ is out of range.
ReleaseManagedResources()
Yönetilmemiş kaynakları serbest bırakın. yönetilmemiş kaynakların burada serbest bırakılmadığından emin olun.Şimdiden serbest bırakıldı.
protected override void ReleaseManagedResources()
RemovePage(int ile)
Bu uygun yöntemi kullanarak sayfa listesinden belirtilen indekse sayfayı kaldırın.Çok sayfalık görüntülerin yönetimi üzerinde doğru kontrol arayan geliştiriciler için ideal,Görüntü içeriğinin güvenli organizasyonu ve özelleştirilmesi.
public void RemovePage(int pageIndex)
Parameters
pageIndex
int
Bu sayfanın indeksi.
Exceptions
pageIndex’ is out of range.
Resize(int, int, resizeType)
Bu basit yöntemle görüntü boyutunu ayarlayın. geliştiriciler için idealGörüntüleri dinamik olarak yeniden şekillendirmek için bakmak, çeşitli şekillerde düzgün uyum sağlar.Konteyner ve uygulama içindeki düzenlemeler.
public override void Resize(int newWidth, int newHeight, ResizeType resizeType)
Parameters
newWidth
int
Yeni bir genişlik.
newHeight
int
Yeni bir yükseklik.
resizeType
ResizeType
Resize türü vardır.
Examples
Bu örnek bir DICOM görüntüsünü yükler ve çeşitli resize yöntemleri kullanılarak resize eder.
string dir = "c:\\temp\\";
using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
// Scale up by 2 times using Nearest Neighbour resampling.
image.Resize(image.Width* 2, image.Height* 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
// Save to PNG with default options.
image.Save(dir + "upsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
// Scale down by 2 times using Nearest Neighbour resampling.
image.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
// Save to PNG with default options.
image.Save(dir + "downsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
// Scale up by 2 times using Bilinear resampling.
image.Resize(image.Width* 2, image.Height* 2, Aspose.Imaging.ResizeType.BilinearResample);
// Save to PNG with default options.
image.Save(dir + "upsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
// Scale down by 2 times using Bilinear resampling.
image.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.BilinearResample);
// Save to PNG with default options.
image.Save(dir + "downsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
Resize(int, int, ImageResizeSettings İndir)
Resim boyutunu bu basit resim yöntemi ile ayarlayın.Görüntünüzü kısaltmak veya genişletmek, bu fonksiyon resim ihtiyacınızın yerine getirilmesini sağlar.verimli ve doğru, hızlı ve kolay arama geliştiricileri için mükemmel hale getirmekGörüntü boyutu ayarları.
public override void Resize(int newWidth, int newHeight, ImageResizeSettings settings)
Parameters
newWidth
int
Yeni bir genişlik.
newHeight
int
Yeni bir yükseklik.
settings
ImageResizeSettings
Değerlendirme ayarları.
Examples
Bu örnek bir DICOM görüntüsünü yükler ve çeşitli resiz ayarları kullanılarak yeniden görüntülenir.
string dir = "c:\\temp\\";
Aspose.Imaging.ImageResizeSettings resizeSettings = new Aspose.Imaging.ImageResizeSettings();
// The adaptive algorithm based on weighted and blended rational function and lanczos3 interpolation.
resizeSettings.Mode = Aspose.Imaging.ResizeType.AdaptiveResample;
// The small rectangular filter
resizeSettings.FilterType = Aspose.Imaging.ImageFilterType.SmallRectangular;
// The number of colors in the palette.
resizeSettings.EntriesCount = 256;
// The color quantization is not used
resizeSettings.ColorQuantizationMethod = ColorQuantizationMethod.None;
// The euclidian method
resizeSettings.ColorCompareMethod = ColorCompareMethod.Euclidian;
using (Aspose.Imaging.Image image = (Aspose.Imaging.Image)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Scale down by 2 times using adaptive resampling.
dicomImage.Resize(image.Width / 2, image.Height / 2, resizeSettings);
// Save to PNG
dicomImage.Save(dir + "downsample.adaptive.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
ResizeHeightProportionally(ResizeType , ResizeType)
Görüntünün yüksekliğini ayarlayın ve görünüm oranını bu şekilde koruyun.Kullanıcı dostu yöntem. Dinamik resim yapmak isteyen geliştiriciler için mükemmeloranlarını korumak, optimum görünüm ve kullanılabilirliği sağlamakUygulamalarında ise.
public override void ResizeHeightProportionally(int newHeight, ResizeType resizeType)
Parameters
newHeight
int
Yeni bir yükseklik.
resizeType
ResizeType
Resize’nin türü
Examples
Bu örnek bir DICOM görüntüsünü yükler ve çeşitli resize yöntemleri kullanılarak orantılı olarak resize eder. yalnızca yükseklik belirtilir, genişlik otomatik olarak hesaplanır.
string dir = "c:\\temp\\";
using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
// Scale up by 2 times using Nearest Neighbour resampling.
image.ResizeHeightProportionally(image.Height* 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
// Save to PNG with the default options.
image.Save(dir + "upsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
// Scale down by 2 times using Nearest Neighbour resampling.
image.ResizeHeightProportionally(image.Height / 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
// Save to PNG with the default options.
image.Save(dir + "downsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
// Scale up by 2 times using Bilinear resampling.
image.ResizeHeightProportionally(image.Height* 2, Aspose.Imaging.ResizeType.BilinearResample);
// Save to PNG with the default options.
image.Save(dir + "upsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
// Scale down by 2 times using Bilinear resampling.
image.ResizeHeightProportionally(image.Height / 2, Aspose.Imaging.ResizeType.BilinearResample);
// Save to PNG with the default options.
image.Save(dir + "downsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
ResizeProportional(int, int, resizeType)
İdeal olarak, görüntü boyutlarını orantılı bir şekilde ayarlamayı, tutarlılığı sağlamayı ve orijinal içeriğin oranlarını korumayı amaçlayan geliştiriciler için.Bu orantılı resize her çerçeveyi <kod sınıfı=“paramref”>newWidth’/width ve <kod sınıfı=“paramref”>newHeight’/height oranına göre yeniden ayarlayacaktır.
public void ResizeProportional(int newWidth, int newHeight, ResizeType resizeType)
Parameters
newWidth
int
Yeni bir genişlik.
newHeight
int
Yeni bir yükseklik.
resizeType
ResizeType
Resize türü vardır.
ResizeWidthProportionally(ResizeType , ResizeType)
Görüntü genişliğini ayarlayın, görünüm oranını bu uygun ile koruyunGörüntüleri orantılı olarak yeniden boyamak isteyen geliştiriciler için idealdir.Farklı ekran ortamlarında tutarlı ve görsel olarak çekici sonuçlar.
public override void ResizeWidthProportionally(int newWidth, ResizeType resizeType)
Parameters
newWidth
int
Yeni bir genişlik.
resizeType
ResizeType
Resize’nin türü
Examples
Bu örnek bir DICOM görüntüsünü yükler ve çeşitli resize yöntemleri kullanılarak orantılı olarak resize eder. yalnızca genişlik belirtilir, yükseklik otomatik olarak hesaplanır.
string dir = "c:\\temp\\";
using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
// Scale up by 2 times using Nearest Neighbour resampling.
image.ResizeWidthProportionally(image.Width* 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
// Save to PNG with the default options.
image.Save(dir + "upsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
// Scale down by 2 times using Nearest Neighbour resampling.
image.ResizeWidthProportionally(image.Width / 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
// Save to PNG with the default options.
image.Save(dir + "downsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
// Scale up by 2 times using Bilinear resampling.
image.ResizeWidthProportionally(image.Width* 2, Aspose.Imaging.ResizeType.BilinearResample);
// Save to PNG with the default options.
image.Save(dir + "upsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
// Scale down by 2 times using Bilinear resampling.
image.ResizeWidthProportionally(image.Width / 2, Aspose.Imaging.ResizeType.BilinearResample);
// Save to PNG with the default options.
image.Save(dir + "downsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
Rotate(Float , Bool , Renk)
Bu uygun yöntemle merkezinin etrafında görüntü döndürün. geliştiriciler için idealGörüntü odaklanmasını dinamik bir şekilde ayarlamaya çalışmak, optimum sunum sağlamak veUygulamalarında uyum sağlar.
public override void Rotate(float angle, bool resizeProportionally, Color backgroundColor)
Parameters
angle
float
Pozitif değerler saatlik olarak döndürülür.
resizeProportionally
bool
Eğer ‘gerçek’ olarak ayarlanırsanız, görüntü boyutunu değiştireceksiniz, diğer durumlarda boyutları dokunmasız bırakır ve yalnızca internal görüntü içeriği döndürülür.
backgroundColor
Color
Arka planın rengi.
Examples
Bu örnek, bir DICOM görüntüsünün tüm sayfalarını nasıl döndürdüğünü ve bunların hepsini bir çok çerçeve TIFF görüntüsüne kaydettiğini gösterir.
string dir = "c:\\temp\\";
// Load a DICOM image from a file stream.
using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "multiframe.dicom"))
{
using (Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = new Aspose.Imaging.FileFormats.Dicom.DicomImage(stream))
{
// Rotate the image around the center by 60 degrees clockwise.
// Use gray as the background color.
dicomImage.Rotate(60, true, Aspose.Imaging.Color.Gray);
Aspose.Imaging.ImageOptions.TiffOptions createOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
createOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Deflate;
// Note that if the image is colorful, it will be automatically converted to the grayscale format according to the options below
createOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
createOptions.BitsPerSample = new ushort[] { 8 };
// Create an array of TIFF frames.
// The number of the frames is equal to the number of the DJVU pages.
Aspose.Imaging.FileFormats.Tiff.TiffFrame[] tiffFrames = new Aspose.Imaging.FileFormats.Tiff.TiffFrame[dicomImage.DicomPages.Length];
// Save each page as an individual TIFF frame.
foreach (Aspose.Imaging.FileFormats.Dicom.DicomPage dicomPage in dicomImage.DicomPages)
{
// Create a TIFF frame based on the DICOM page.
tiffFrames[dicomPage.Index] = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(dicomPage, createOptions);
}
// Compose a TIFF image from the frames.
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(tiffFrames))
{
// Save to a file.
tiffImage.Save(dir + "multiframe.tif");
}
}
}
RotateFlip(RotateFlipType)
Aktif çerçeveyi döndürerek, kaydırarak veya her iki eylemi de yaparak kolayca manipüle edin.bu basit yöntemle aynı anda. geliştiriciler için idealGörüntüleme seansları içinde belirli çerçevelerin yönlendirilmesini dinamik olarak ayarlayın,Optimal sunum ve uyum sağlar.
public override void RotateFlip(RotateFlipType rotateFlipType)
Parameters
rotateFlipType
RotateFlipType
Rota Flip türü.
Examples
Bu örnek bir DICOM görüntüsünü yükler, 90 derecelik saat açısıyla döndürür ve seçmeli olarak görüntüyü yatay ve/veya dikey olarak kaydırır.
string dir = "c:\\temp\\";
Aspose.Imaging.RotateFlipType[] rotateFlipTypes = new Aspose.Imaging.RotateFlipType[]
{
Aspose.Imaging.RotateFlipType.Rotate90FlipNone,
Aspose.Imaging.RotateFlipType.Rotate90FlipX,
Aspose.Imaging.RotateFlipType.Rotate90FlipXY,
Aspose.Imaging.RotateFlipType.Rotate90FlipY,
};
foreach (Aspose.Imaging.RotateFlipType rotateFlipType in rotateFlipTypes)
{
// Rotate, flip and save to the output file.
using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
image.RotateFlip(rotateFlipType);
image.Save(dir + "sample." + rotateFlipType + ".png", new Aspose.Imaging.ImageOptions.PngOptions());
}
}
Save(Akış, ImageOptionsBase, Rectangle)
Görüntü verilerinizi istediğiniz dosya biçiminde belirli bir akışa kolayca kaydedinbu uygun yöntemi kullanın. JPEG, PNG veya başka bir biçimde çalışıyorsanız,Bu fonksiyon, görüntü verilerinizin verimli ve doğru bir şekilde kaydedilmesini sağlar.Tasarımcılar dosya kurtarma süreçlerini akıllı hale getirmek için ideal hale getirmek.
public override void Save(Stream stream, ImageOptionsBase optionsBase, Rectangle boundsRectangle)
Parameters
stream
Stream
Görüntünün verilerini kaydetmek için akış.
optionsBase
ImageOptionsBase
Tasarruf seçenekleri.
boundsRectangle
Rectangle
Hedef görüntüsü düz açı sınırlar. kaynak sınırlarını kullanmak için boş düz açı ayarlayın.
Examples
Aşağıdaki örnek bir dosyadan bir DICOM görüntüsünü yükler, ardından görüntüyi bir PNG dosya akışına kaydeder.
string dir = "c:\\temp\\";
using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
Aspose.Imaging.Rectangle bounds = new Aspose.Imaging.Rectangle(0, 0, image.Width / 2, image.Height / 2);
using (System.IO.Stream outputStream = System.IO.File.Open(dir + "output.png", System.IO.FileMode.Create))
{
// Save the upper-left quarter of the image to a file stream.
image.Save(outputStream, saveOptions, bounds);
}
}
SaveAll(Çerçeve, ImageOptionsBase)
Bir nesnenin verilerini belirlenen dosyaya kaydederek saklayın (indexer + dosya adı)Belirlenen dosya biçimi ve seçenekleri ile birlikte konum. geliştiriciler için idealdirGüvenli bir şekilde çeşitli biçimlerde verileri depolamak, esnekliği ve kontrolü korumakTasarruf Parametreleri
public void SaveAll(string filePath, ImageOptionsBase options)
Parameters
filePath
string
Dosya Yolu.
options
ImageOptionsBase
Seçenekler için.
SaveData(Stream)
Verileri tasarruf edin.
protected override void SaveData(Stream stream)
Parameters
stream
Stream
veri kaydetmek için akış.
SetResolution(Çift , Çift)
Bu Aspose.Imaging.RasterImage çözünürlüğünü doğru bir şekilde ayarlayınbasit yöntem. görüntü çözünürlüğünü ayarlamak isteyen geliştiriciler için idealdirÖzel gereksinimler, optimum görüntü kalitesi ve dosya boyutu yönetimi sağlamak.
public override void SetResolution(double dpiX, double dpiY)
Parameters
dpiX
double
Aspose.Imaging.RasterImage’ın yatay çözünürlüğü, inç başına noktalarda.
dpiY
double
Aspose.Imaging.RasterImage’ın vertikal çözünürlüğü, inç başına noktalarda.
UpdateDimensions(int , int , int)
Görüntü boyutlarını güncelleyin.
protected override void UpdateDimensions(int newWidth, int newHeight)
Parameters
newWidth
int
Yeni görüntü genişliği.
newHeight
int
Yeni görüntü yüksekliği.