public static void Run() { // ExStart:BinarizationWithOtsuThresholdOnDICOMImage // The path to the documents directory. string dataDir = RunExamples.GetDataDir_DICOM(); // Load an existing image. using (DicomImage image = new DicomImage(dataDir + "image.dcm")) { // Binarize image with Otsu Thresholding and Save the resultant image. image.BinarizeOtsu(); image.Save(dataDir + "BinarizationWithOtsuThresholdOnDICOMImage_out.bmp", new BmpOptions()); } // ExEnd:BinarizationWithOtsuThresholdOnDICOMImage }
public static void Run() { //ExStart:BinarizationWithOtsuThresholdOnDICOMImage // The path to the documents directory. string dataDir = RunExamples.GetDataDir_DICOM(); using (var fileStream = new FileStream(dataDir + "file.dcm", FileMode.Open, FileAccess.Read)) using (DicomImage image = new DicomImage(fileStream)) { // Binarize image with Otsu Thresholding and Save the resultant image. image.BinarizeOtsu(); image.Save(dataDir + "BinarizationWithOtsuThresholdOnDICOMImage_out.bmp", new BmpOptions()); } //ExEnd:BinarizationWithOtsuThresholdOnDICOMImage }