Пример #1
0
        public void UpdateImagePositionFromReferenceSeriesTests()
        {
            var bmpFile = Path.Combine(Helper.GetTestResourcesPath(), "bmp", "test.bmp");

            FileSystem.DirectoryExistsIfNotCreate(Path.Combine(_tmpFolder, "1"));
            FileSystem.DirectoryExistsIfNotCreate(Path.Combine(_tmpFolder, "2"));
            var dcmFile  = Path.Combine(_tmpFolder, "1", "testdicomfile.dcm");
            var dcmFile2 = Path.Combine(_tmpFolder, "2", "testdicomfile.dcm");

            DicomFileOps.ConvertBmpToDicom(bmpFile, dcmFile);
            DicomFileOps.ConvertBmpToDicom(bmpFile, dcmFile2);
            DicomTagCollection tags = new DicomTagCollection();

            // Setup the basic thing...
            //tags.SetTagValue(tags.SliceLocation.GetTagValue(), new string[] { "somewhere" });
            //DicomFileOps.UpdateDicomHeaders(dcmFile, tags, DicomNewObjectType.NewPatient);
            //tags.SetTagValue(tags.SliceLocation.GetTagValue(), new string[] { "nowhere" });
            //DicomFileOps.UpdateDicomHeaders(dcmFile2, tags, DicomNewObjectType.NewPatient);

            // Check that we set everything up correctly...
            Assert.IsTrue(DicomFileOps.GetDicomTags(dcmFile).SliceLocation.Values[0].Equals("somewhere"), "Failed to setup.");
            Assert.IsTrue(DicomFileOps.GetDicomTags(dcmFile2).SliceLocation.Values[0].Equals("nowhere"), "Failed to setup.");

            // Update things...
            DicomFileOps.UpdateImagePositionFromReferenceSeries(new string[] { dcmFile }, new string[] { dcmFile2 });

            // Check that things were updated.
            Assert.IsTrue(DicomFileOps.GetDicomTags(dcmFile).SliceLocation.Values[0].Equals("nowhere"), "Failed to update.");
        }