public void BmpTests() { var bmpFolder = Path.Combine(Helper.GetTestResourcesPath(), "bmp"); var bmpFile = Path.Combine(bmpFolder, "test.bmp"); var dcmFolder = Path.Combine(_tmpFolder, "newdicomfolder"); var dcmFile = Path.Combine(dcmFolder, "testdicomfile.dcm"); FileSystem.DirectoryExistsIfNotCreate(dcmFolder); // Convert our bmp file to a dcm file. DicomFileOps.ConvertBmpToDicom(bmpFile, dcmFile); // Check that we can read it as a dicom file. Assert.IsTrue(File.Exists(dcmFile), "Could not convert BMP to DCM."); try { _ = DicomFileOps.GetDicomTags(dcmFile); } catch { Assert.Fail("Could not read output DCM file."); } // Same deal, but this time it will convert all files from .bmp to a similarly named file w/ no extension. DicomFileOps.ConvertBmpsToDicom(bmpFolder, dcmFolder, SliceType.Axial, dcmFolder); // Check that it did that. Assert.IsTrue(File.Exists(Path.Combine(dcmFolder, "test")), "Could not convert BMP to DCM."); try { _ = DicomFileOps.GetDicomTags(Path.Combine(dcmFolder, "test")); } catch { Assert.Fail("Could not read output DCM file."); } //// Another similar method, but we're doing a single file and using adding existing tags. //DicomFileOps.ConvertBmpToDicomAndAddToExistingFolder(bmpFile, dcmFolder, "testdicomfile2.dcm"); //// Check that it did that. //Assert.IsTrue(File.Exists(Path.Combine(dcmFolder, "testdicomfile2.dcm")), "Could not convert BMP to DCM."); //try { _ = DicomFileOps.GetDicomTags(Path.Combine(dcmFolder, "testdicomfile2.dcm")); } //catch { Assert.Fail("Could not read output DCM file."); } }