Exemplo n.º 1
0
        public async Task FindEntityTest()
        {
            var testNumber = 2;

            // Create a test workspace
            var workspaceItem = await TestHelper.CreateWorkspaceAsync(_testClassName, testNumber);

            // Upload test data
            var uploadPath = Path.Combine(TestSettings.TestDataRootDirectory, "Sro", "mr.dcm");
            var overrides  = new UploadFileOverrides
            {
                Patient = new PatientOverridesSchema {
                    Mrn = $"{testNumber}-Mrn", Name = $"{testNumber}-Name"
                }
            };
            var uploadResults = await _proKnow.Uploads.UploadAsync(workspaceItem, uploadPath, overrides);

            var uploadProcessingResults = await _proKnow.Uploads.GetUploadProcessingResultsAsync(workspaceItem, uploadResults);

            var uploadBatch = new UploadBatch(_proKnow, workspaceItem.Id, uploadProcessingResults.Results);

            // Get the summary views of the patient and an entity in the upload response
            var uploadPatientSummary = uploadBatch.FindPatient(uploadPath);
            var uploadEntitySummary  = uploadBatch.FindEntity(uploadPath);

            // Verify the contents
            Assert.AreEqual(workspaceItem.Id, uploadEntitySummary.WorkspaceId);
            Assert.AreEqual(uploadPatientSummary.Id, uploadEntitySummary.PatientId);
            Assert.IsNotNull(uploadEntitySummary.Id);
            Assert.AreEqual("1.2.246.352.221.470938394496317011513892701464452657827", uploadEntitySummary.Uid);
            Assert.AreEqual("image_set", uploadEntitySummary.Type);
            Assert.AreEqual("MR", uploadEntitySummary.Modality);
            Assert.AreEqual("", uploadEntitySummary.Description);
        }
Exemplo n.º 2
0
        public async Task FindSroTest()
        {
            var testNumber = 3;

            // Create a test workspace
            var workspaceItem = await TestHelper.CreateWorkspaceAsync(_testClassName, testNumber);

            // Upload test data
            var uploadPath = Path.Combine(TestSettings.TestDataRootDirectory, "Sro", "reg.dcm");
            var overrides  = new UploadFileOverrides
            {
                Patient = new PatientOverridesSchema {
                    Mrn = $"{testNumber}-Mrn", Name = $"{testNumber}-Name"
                }
            };
            var uploadResults = await _proKnow.Uploads.UploadAsync(workspaceItem, uploadPath, overrides);

            var uploadProcessingResults = await _proKnow.Uploads.GetUploadProcessingResultsAsync(workspaceItem, uploadResults);

            var uploadBatch = new UploadBatch(_proKnow, workspaceItem.Id, uploadProcessingResults.Results);

            // Get the summary views of the patient and the SRO in the upload response
            var uploadPatientSummary = uploadBatch.FindPatient(uploadPath);
            var uploadSroSummary     = uploadBatch.FindSro(uploadPath);

            // Verify the contents
            Assert.AreEqual(workspaceItem.Id, uploadSroSummary.WorkspaceId);
            Assert.AreEqual(uploadPatientSummary.Id, uploadSroSummary.PatientId);
            Assert.IsNotNull(uploadSroSummary.StudyId);
            Assert.IsNotNull(uploadSroSummary.Id);
            Assert.AreEqual("1.2.246.352.221.52738008096457865345287404867971417272", uploadSroSummary.Uid);
        }
Exemplo n.º 3
0
        public async Task FindPatientTest()
        {
            var testNumber = 1;

            // Create a test workspace
            var workspaceItem = await TestHelper.CreateWorkspaceAsync(_testClassName, testNumber);

            // Upload test data
            var mrUploadPath  = Path.Combine(TestSettings.TestDataRootDirectory, "Sro", "mr.dcm");
            var sroUploadPath = Path.Combine(TestSettings.TestDataRootDirectory, "Sro", "reg.dcm");
            var uploadPaths   = new List <String>()
            {
                mrUploadPath, sroUploadPath
            };
            var overrides = new UploadFileOverrides
            {
                Patient = new PatientOverridesSchema {
                    Mrn = $"{testNumber}-Mrn", Name = $"{testNumber}-Name"
                }
            };
            var uploadResults = await _proKnow.Uploads.UploadAsync(workspaceItem, uploadPaths, overrides);

            var uploadProcessingResults = await _proKnow.Uploads.GetUploadProcessingResultsAsync(workspaceItem, uploadResults);

            var uploadBatch = new UploadBatch(_proKnow, workspaceItem.Id, uploadProcessingResults.Results);

            // Get the summary view of the patient in the upload response
            var uploadPatientSummary = uploadBatch.FindPatient(mrUploadPath);

            // Verify the contents at the patient level
            Assert.AreEqual(workspaceItem.Id, uploadPatientSummary.WorkspaceId);
            Assert.IsNotNull(uploadPatientSummary.Id);
            Assert.AreEqual(overrides.Patient.Mrn, uploadPatientSummary.Mrn);
            Assert.AreEqual(overrides.Patient.Name, uploadPatientSummary.Name);
            Assert.AreEqual(1, uploadPatientSummary.Entities.Count);
            Assert.AreEqual(1, uploadPatientSummary.Sros.Count);

            // Verify the contents at the entity level
            var uploadEntitySummary = uploadPatientSummary.Entities[0];

            Assert.AreEqual(workspaceItem.Id, uploadEntitySummary.WorkspaceId);
            Assert.AreEqual(uploadPatientSummary.Id, uploadEntitySummary.PatientId);
            Assert.IsNotNull(uploadEntitySummary.Id);
            Assert.AreEqual("1.2.246.352.221.470938394496317011513892701464452657827", uploadEntitySummary.Uid);
            Assert.AreEqual("image_set", uploadEntitySummary.Type);
            Assert.AreEqual("MR", uploadEntitySummary.Modality);
            Assert.AreEqual("", uploadEntitySummary.Description);

            // Verify the contents at the SRO level
            var uploadSroSummary = uploadPatientSummary.Sros[0];

            Assert.AreEqual(workspaceItem.Id, uploadSroSummary.WorkspaceId);
            Assert.AreEqual(uploadPatientSummary.Id, uploadSroSummary.PatientId);
            Assert.IsNotNull(uploadSroSummary.StudyId);
            Assert.IsNotNull(uploadSroSummary.Id);
            Assert.AreEqual("1.2.246.352.221.52738008096457865345287404867971417272", uploadSroSummary.Uid);
        }
        public async Task GetAsyncTest()
        {
            var testNumber = 1;

            // Create a test workspace
            var workspaceItem = await TestHelper.CreateWorkspaceAsync(_testClassName, testNumber);

            // Upload test data
            var uploadPath = Path.Combine(TestSettings.TestDataRootDirectory, "Sro");
            var overrides  = new UploadFileOverrides
            {
                Patient = new PatientOverridesSchema {
                    Mrn = $"{testNumber}-Mrn", Name = $"{testNumber}-Name"
                }
            };
            var uploadResults = await _proKnow.Uploads.UploadAsync(workspaceItem, uploadPath, overrides);

            var uploadProcessingResults = await _proKnow.Uploads.GetUploadProcessingResultsAsync(workspaceItem, uploadResults);

            var uploadBatch = new UploadBatch(_proKnow, workspaceItem.Id, uploadProcessingResults.Results);

            // Get the summary views of the patient, entities, and SRO in the upload response
            var uploadPatientSummary  = uploadBatch.FindPatient(Path.Combine(uploadPath, "reg.dcm"));
            var uploadCtEntitySummary = uploadBatch.FindEntity(Path.Combine(uploadPath, "ct.dcm"));
            var uploadMrEntitySummary = uploadBatch.FindEntity(Path.Combine(uploadPath, "mr.dcm"));
            var uploadSroSummary      = uploadBatch.FindSro(Path.Combine(uploadPath, "reg.dcm"));

            // Get the full representation of the patient, entities, and SRO
            var ctImageSetItem = await uploadCtEntitySummary.GetAsync();

            var mrImageSetItem = await uploadMrEntitySummary.GetAsync();

            var sroItem = await uploadSroSummary.GetAsync();

            // Verify the contents
            Assert.AreEqual(workspaceItem.Id, sroItem.WorkspaceId);
            Assert.AreEqual(uploadPatientSummary.Id, sroItem.PatientId);
            Assert.AreEqual(ctImageSetItem.StudyId, sroItem.StudyId);
            Assert.IsNotNull(sroItem.Id);
            Assert.AreEqual("1.2.246.352.221.52738008096457865345287404867971417272", sroItem.Uid);
            Assert.AreEqual("2018-02-19 09:06:05", sroItem.Name);
            Assert.AreEqual("rigid", sroItem.Type);
            Assert.AreEqual(mrImageSetItem.FrameOfReferenceUid, sroItem.Source.FrameOfReferenceUid);
            Assert.AreEqual(mrImageSetItem.Id, sroItem.Source.ImageSetId);
            Assert.AreEqual(ctImageSetItem.FrameOfReferenceUid, sroItem.Target.FrameOfReferenceUid);
            Assert.AreEqual(ctImageSetItem.Id, sroItem.Target.ImageSetId);
        }
Exemplo n.º 5
0
        public async Task GetAsyncTest()
        {
            var testNumber = 1;

            // Create a test workspace
            var workspaceItem = await TestHelper.CreateWorkspaceAsync(_testClassName, testNumber);

            // Upload test data
            var uploadPath = Path.Combine(TestSettings.TestDataRootDirectory, "Sro", "ct.dcm");
            var overrides  = new UploadFileOverrides
            {
                Patient = new PatientOverridesSchema {
                    Mrn = $"{testNumber}-Mrn", Name = $"{testNumber}-Name"
                }
            };
            var uploadResults = await _proKnow.Uploads.UploadAsync(workspaceItem, uploadPath, overrides);

            var uploadProcessingResults = await _proKnow.Uploads.GetUploadProcessingResultsAsync(workspaceItem, uploadResults);

            var uploadBatch = new UploadBatch(_proKnow, workspaceItem.Id, uploadProcessingResults.Results);

            // Get the summary views of the patient and entity in the upload response
            var uploadPatientSummary = uploadBatch.FindPatient(uploadPath);
            var uploadEntitySummary  = uploadBatch.FindEntity(uploadPath);

            // Get the full representation of the entity
            var imageSetItem = await uploadEntitySummary.GetAsync() as ImageSetItem;

            // Verify the contents
            Assert.AreEqual(workspaceItem.Id, imageSetItem.WorkspaceId);
            Assert.AreEqual(uploadPatientSummary.Id, imageSetItem.PatientId);
            Assert.AreEqual("1.2.246.352.221.5093062159960566210763150553104377477", imageSetItem.FrameOfReferenceUid);
            Assert.IsNotNull(imageSetItem.Id);
            Assert.AreEqual("image_set", imageSetItem.Type);
            Assert.AreEqual("1.2.246.352.221.563569281719761951014104635106765053066", imageSetItem.Uid);
            Assert.AreEqual("CT", imageSetItem.Modality);
            Assert.AreEqual("", imageSetItem.Description);
            Assert.IsTrue(imageSetItem.Metadata.Count == 0);
            Assert.AreEqual("completed", imageSetItem.Status);
        }
        public async Task GetAsyncTest()
        {
            var testNumber = 1;

            // Create a test workspace
            var workspaceItem = await TestHelper.CreateWorkspaceAsync(_testClassName, testNumber);

            // Upload test data
            var uploadPath = Path.Combine(TestSettings.TestDataRootDirectory, "Sro", "ct.dcm");
            var overrides  = new UploadFileOverrides
            {
                Patient = new PatientOverridesSchema {
                    Mrn = $"{testNumber}-Mrn", Name = $"{testNumber}-Name"
                }
            };
            var uploadResults = await _proKnow.Uploads.UploadAsync(workspaceItem, uploadPath, overrides);

            var uploadProcessingResults = await _proKnow.Uploads.GetUploadProcessingResultsAsync(workspaceItem, uploadResults);

            var uploadBatch = new UploadBatch(_proKnow, workspaceItem.Id, uploadProcessingResults.Results);

            // Get the summary view of the patient in the upload response
            var uploadPatientSummary = uploadBatch.FindPatient(uploadPath);

            // Get the full representation of the patient
            var patientItem = await uploadPatientSummary.GetAsync();

            // Verify the contents
            Assert.AreEqual(workspaceItem.Id, patientItem.WorkspaceId);
            Assert.IsNotNull(patientItem.Id);
            Assert.AreEqual(overrides.Patient.Mrn, patientItem.Mrn);
            Assert.AreEqual(overrides.Patient.Name, patientItem.Name);
            Assert.AreEqual(1, patientItem.Studies.Count);
            Assert.AreEqual(workspaceItem.Id, patientItem.Studies[0].WorkspaceId);
            Assert.AreEqual(patientItem.Id, patientItem.Studies[0].PatientId);
            Assert.IsNotNull(patientItem.Studies[0].Id);
            Assert.AreEqual(1, patientItem.Studies[0].Entities.Count);
            Assert.AreEqual(0, patientItem.Studies[0].Sros.Count);
        }