C# के माध्यम से DICOM को फ़िल्टर करें
सर्वर-साइड API का उपयोग करके DICOM फ़ाइलों को फ़िल्टर करने के लिए अपने स्वयं के .NET ऐप्स बनाएं।
C# का उपयोग करके DICOM फ़ाइलों को कैसे फ़िल्टर करें
यहां तक कि सबसे उत्तम छवि को भी आगे बढ़ाया जा सकता है या कला के एक पूरी तरह से अलग और अद्वितीय काम में परिवर्तित किया जा सकता है। छवि प्रभावों की एक विस्तृत श्रृंखला प्राप्त करने के लिए फ़िल्टर लागू करें। उदाहरण के लिए, आप किसी छवि को तेज़ कर सकते हैं या, इसके विपरीत, धुंधलापन जोड़ सकते हैं, उसे चिकना कर सकते हैं, या रंग शोर को ख़त्म कर सकते हैं। जब आप अपनी छवि को विशिष्टता प्रदान करना चाहते हैं तो फ़िल्टर भी अमूल्य हैं। इसे प्राप्त करने के लिए, वांछित प्रभाव लागू करें या विभिन्न प्रभावों को संयोजित करें। यह दृष्टिकोण आपको रंग ग्रेडिएंट को परिष्कृत करने, शोर को खत्म करने और साथ ही फोटो में ऑब्जेक्ट के किनारों की तीक्ष्णता को बढ़ाने की अनुमति देता है। DICOM फ़ाइलों को फ़िल्टर करने के लिए, हम इसका उपयोग करेंगे Aspose.Imaging for .NET API जो एक सुविधा संपन्न, शक्तिशाली और उपयोग में आसान छवि हेरफेर और C# प्लेटफॉर्म के लिए रूपांतरण API है। NuGet पैकेज मैनेजर खोलें, खोजें Aspose.Imaging और इंस्टॉल करें। आप पैकेज मैनेजर कंसोल से निम्न कमांड का भी उपयोग कर सकते हैं।
पैकेज प्रबंधक कंसोल कमांड
PM> Install-Package Aspose.Imaging
C# के माध्यम से DICOM को फ़िल्टर करने के चरण
आपको अपने परिवेश में निम्न वर्कफ़्लो आज़माने के लिए aspose.imaging.dll की आवश्यकता होगी।
- लोड DICOM छवि के साथ फ़ाइलें। लोड विधि
- छवियों को फ़िल्टर करें;
- Aspose द्वारा समर्थित डिस्क में संपीड़ित छवि को सहेजें। इमेजिंग प्रारूप
सिस्टम आवश्यकताएं
Aspose.Imaging for .NET सभी प्रमुख ऑपरेटिंग सिस्टम पर समर्थित है। बस सुनिश्चित करें कि आपके पास निम्नलिखित पूर्वापेक्षाएँ हैं।
- माइक्रोसॉफ्ट विंडोज या .NET फ्रेमवर्क, .NET कोर, विंडोज एप्लीकेशन, एएसपी.नेट वेब एप्लीकेशन के साथ संगत ओएस।
- माइक्रोसॉफ्ट विजुअल स्टूडियो जैसे विकास का माहौल।
- Aspose.Imaging for .NET आपके प्रोजेक्ट में संदर्भित है।
फ़िल्टर DICOM इमेज - .NET
using Aspose.Imaging; | |
using Aspose.Imaging.FileFormats.Bmp; | |
using Aspose.Imaging.FileFormats.Dicom; | |
using Aspose.Imaging.FileFormats.Emf; | |
using Aspose.Imaging.FileFormats.Jpeg; | |
using Aspose.Imaging.FileFormats.Jpeg2000; | |
using Aspose.Imaging.FileFormats.Png; | |
using Aspose.Imaging.FileFormats.Psd; | |
using Aspose.Imaging.FileFormats.Tiff.Enums; | |
using Aspose.Imaging.ImageFilters.FilterOptions; | |
using Aspose.Imaging.ImageOptions; | |
using Aspose.Imaging.Masking; | |
using Aspose.Imaging.Masking.Options; | |
using Aspose.Imaging.Masking.Result; | |
using Aspose.Imaging.Sources; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
string templatesFolder = @"c:\Users\USER\Downloads"; | |
MedianFilter(); | |
void SmallRectangularFilter() | |
{ | |
FilterImages(image => | |
{ | |
//https://apireference.aspose.com/imaging/net/aspose.imaging.imagefilters.filteroptions/smallrectangularfilteroptions | |
var filterRect = new Aspose.Imaging.Rectangle(image.Width / 6, image.Height / 6, image.Width * 2 / 3, image.Height * 2 / 3); | |
image.Filter(filterRect, new SmallRectangularFilterOptions()); | |
}, "smallrectangular"); | |
} | |
void BigRectangularFilter() | |
{ | |
FilterImages(image => | |
{ | |
//https://apireference.aspose.com/imaging/net/aspose.imaging.imagefilters.filteroptions/bigrectangularfilteroptions | |
var filterRect = new Aspose.Imaging.Rectangle(image.Width / 6, image.Height / 6, image.Width * 2 / 3, image.Height * 2 / 3); | |
image.Filter(filterRect, new BigRectangularFilterOptions()); | |
}, "bigrectangular"); | |
} | |
void SharpenFilter() | |
{ | |
FilterImages(image => | |
{ | |
//https://apireference.aspose.com/imaging/net/aspose.imaging.imagefilters.filteroptions/sharpenfilteroptions | |
var filterRect = new Aspose.Imaging.Rectangle(image.Width / 6, image.Height / 6, image.Width * 2 / 3, image.Height * 2 / 3); | |
image.Filter(filterRect, new SharpenFilterOptions()); | |
}, "sharpen"); | |
} | |
void MotionWienerFilter() | |
{ | |
FilterImages(image => | |
{ | |
//https://apireference.aspose.com/imaging/net/aspose.imaging.imagefilters.filteroptions/motionwienerfilteroptions | |
var filterRect = new Aspose.Imaging.Rectangle(image.Width / 6, image.Height / 6, image.Width * 2 / 3, image.Height * 2 / 3); | |
image.Filter(filterRect, new MotionWienerFilterOptions(20, 2, 0)); | |
}, "motionwiener"); | |
} | |
void BilateralSmoothingFilter() | |
{ | |
FilterImages(image => | |
{ | |
//https://apireference.aspose.com/imaging/net/aspose.imaging.imagefilters.filteroptions/bilateralsmoothingfilteroptions | |
var filterRect = new Aspose.Imaging.Rectangle(image.Width / 6, image.Height / 6, image.Width * 2 / 3, image.Height * 2 / 3); | |
image.Filter(filterRect, new BilateralSmoothingFilterOptions()); | |
}, "bilateralsmoothing"); | |
} | |
void GaussBlurFilter() | |
{ | |
FilterImages(image => | |
{ | |
//https://apireference.aspose.com/imaging/net/aspose.imaging.imagefilters.filteroptions/gaussianblurfilteroptions | |
var filterRect = new Aspose.Imaging.Rectangle(image.Width / 6, image.Height / 6, image.Width * 2 / 3, image.Height * 2 / 3); | |
image.Filter(filterRect, new GaussianBlurFilterOptions(5, 4)); | |
}, "gaussblur"); | |
} | |
void GaussWienerFilter() | |
{ | |
FilterImages(image => | |
{ | |
//https://apireference.aspose.com/imaging/net/aspose.imaging.imagefilters.filteroptions/gausswienerfilteroptions | |
var filterRect = new Aspose.Imaging.Rectangle(image.Width / 6, image.Height / 6, image.Width * 2 / 3, image.Height * 2 / 3); | |
image.Filter(filterRect, new GaussWienerFilterOptions(5, 5)); | |
}, "gausswiener"); | |
} | |
void MedianFilter() | |
{ | |
FilterImages(image => | |
{ | |
//https://apireference.aspose.com/imaging/net/aspose.imaging.imagefilters.filteroptions/medianfilteroptions | |
var filterRect = new Aspose.Imaging.Rectangle(image.Width / 6, image.Height / 6, image.Width * 2 / 3, image.Height * 2 / 3); | |
image.Filter(filterRect, new MedianFilterOptions(20)); | |
}, "median"); | |
} | |
void FilterImages(Action<RasterImage> doFilter, string filterName) | |
{ | |
List<string> rasterFormats = new List<string>() { "jpg", "png", "bmp", "apng", "dicom", | |
"jp2", "j2k", "tga", "webp", "tif", "gif","ico" }; | |
List<string> vectorFormats = new List<string>() { "svg", "otg", "odg", "eps", "wmf", "emf", "wmz", "emz", "cmx", "cdr" }; | |
List<string> allFormats = new List<string>(rasterFormats); | |
allFormats.AddRange(vectorFormats); | |
allFormats.ForEach( | |
formatExt => | |
{ | |
var inputFile = Path.Combine(templatesFolder, $"template.{formatExt}"); | |
bool isVectorFormat = vectorFormats.IndexOf(formatExt) > -1; | |
//Need to rasterize vector formats before background remove | |
if (isVectorFormat) | |
{ | |
inputFile = RasterizeVectorImage(formatExt, inputFile); | |
} | |
var outputFile = Path.Combine(templatesFolder, $"{filterName}_{formatExt}.png"); | |
Console.WriteLine($"Processing {formatExt}"); | |
using (var image = (RasterImage)Image.Load(inputFile)) | |
{ | |
doFilter(image); | |
//If image is multipage save each page to png to demonstrate results | |
if (image is IMultipageImage multiPage && multiPage.PageCount > 1) | |
{ | |
for (var pageIndex = 0; pageIndex < multiPage.PageCount; pageIndex++) | |
{ | |
string fileName = $"{filterName}_page{pageIndex}_{formatExt}.png"; | |
multiPage.Pages[pageIndex].Save(templatesFolder + fileName, new PngOptions()); | |
File.Delete(templatesFolder + fileName); | |
} | |
} | |
else | |
{ | |
image.Save(outputFile, new PngOptions()); | |
File.Delete(outputFile); | |
} | |
} | |
//Remove rasterized vector image | |
if (isVectorFormat) | |
{ | |
File.Delete(inputFile); | |
} | |
} | |
); | |
} | |
string RasterizeVectorImage(string formatExt, string inputFile) | |
{ | |
string outputFile = Path.Combine(templatesFolder, $"rasterized.{formatExt}.png"); | |
using (var image = Image.Load(inputFile)) | |
{ | |
image.Save(outputFile, new PngOptions()); | |
} | |
return outputFile; | |
} |
Aspose.Imaging for .NET API . के बारे में
Aspose.Imaging API अनुप्रयोगों के भीतर छवियों (फ़ोटो) को बनाने, संशोधित करने, आकर्षित करने या परिवर्तित करने के लिए एक छवि प्रसंस्करण समाधान है। यह प्रदान करता है: क्रॉस-प्लेटफ़ॉर्म छवि प्रसंस्करण, जिसमें विभिन्न छवि प्रारूपों (समान बहु-पृष्ठ या बहु-फ़्रेम छवि प्रसंस्करण सहित) के बीच रूपांतरण शामिल हैं, लेकिन इन्हीं तक सीमित नहीं है, ड्राइंग जैसे संशोधन, ग्राफिक प्राइमेटिव के साथ काम करना, परिवर्तन (आकार बदलना, फसल करना, फ्लिप करना और घुमाना) , बिनाराइज़ेशन, ग्रेस्केल, एडजस्ट), उन्नत छवि हेरफेर सुविधाएँ (फ़िल्टरिंग, डिथरिंग, मास्किंग, डेस्क्यूइंग), और मेमोरी ऑप्टिमाइज़ेशन रणनीतियाँ। यह एक स्टैंडअलोन लाइब्रेरी है और इमेज ऑपरेशंस के लिए किसी सॉफ्टवेयर पर निर्भर नहीं है। परियोजनाओं के भीतर देशी एपीआई के साथ आसानी से उच्च-प्रदर्शन छवि रूपांतरण सुविधाएँ जोड़ सकते हैं। ये 100% निजी ऑन-प्रिमाइसेस एपीआई हैं और छवियों को आपके सर्वर पर संसाधित किया जाता है।फ़िल्टर DICOMs ऑनलाइन ऐप के माध्यम से
हमारी लाइव डेमो वेबसाइट पर जाकर DICOM दस्तावेज़ों को फ़िल्टर करें। लाइव डेमो के निम्नलिखित लाभ हैं
DICOM क्या है DICOM फाइल का प्रारूप
DICOM चिकित्सा में डिजिटल इमेजिंग और संचार के लिए संक्षिप्त है और चिकित्सा सूचना विज्ञान के क्षेत्र से संबंधित है। DICOM फ़ाइल स्वरूप परिभाषा और एक नेटवर्क संचार प्रोटोकॉल का संयोजन है। DICOM .DCM एक्सटेंशन का उपयोग करता है। .DCM दो अलग-अलग स्वरूपों में मौजूद है अर्थात स्वरूप 1.x और स्वरूप 2.x। DCM प्रारूप 1.x आगे सामान्य और विस्तारित दो संस्करणों में उपलब्ध है। DICOM का उपयोग विभिन्न विक्रेताओं से चिकित्सा इमेजिंग उपकरणों जैसे प्रिंटर, सर्वर, स्कैनर आदि के एकीकरण के लिए किया जाता है और इसमें विशिष्टता के लिए प्रत्येक रोगी का पहचान डेटा भी होता है। DICOM फ़ाइलें दो पक्षों के बीच साझा की जा सकती हैं यदि वे DICOM प्रारूप में छवि डेटा प्राप्त करने में सक्षम हैं। DICOM का संचार भाग अनुप्रयोग परत प्रोटोकॉल है और संस्थाओं के बीच संचार के लिए TCP/IP का उपयोग करता है। DICOM की वेब सेवाओं के लिए HTTP और HTTPS प्रोटोकॉल का उपयोग किया जाता है। वेब सेवाओं द्वारा समर्थित संस्करण 1.0, 1.1, 2 या बाद के संस्करण हैं।
अधिक पढ़ेंअन्य समर्थित फ़िल्टर प्रारूप
C# का उपयोग करके, कोई भी व्यक्ति विभिन्न स्वरूपों को आसानी से फ़िल्टर कर सकता है, जिनमें शामिल हैं।